Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add magic flag to xml template #3520

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Jun 5, 2023

We added support for magic methods added to the Class template recently, but in the generated structure.xml, there's no way to tell if they've been inherited, or if they're magic methods.

Summary of changes:

  • sets inherited_from for magic methods
    • This logic is determined in the template when method.class does not match class. This may not be the best way, but it seemed like the approach with the least churn
    • this feature is (I think) important, since it exists for other methods, and so the behavior was inconsistent
  • a magic="true" attribute to the <method> tag (e.g. <method /* ... */ magic="true">)
    • I think it makes sense to have some way to know if the methods are magic or not, but since the users could check the existence of the @method tag, that's already possible, so I'm 100% okay getting rid of this.

I'd love some feedback here!!

Note: magic is probably the wrong label to use for methods added with __call, because according to the PHP Documentation, PHP magic methods are methods prefixed with __. The methods added with __call are referred to as "overloaded methods", which I also don't like, as that represents something different in other OO languages such as Java.

@jaapio jaapio merged commit 11b9f8d into phpDocumentor:master Jul 3, 2023
21 of 31 checks passed
@jaapio
Copy link
Member

jaapio commented Jul 3, 2023

I think magic makes sense... as the methods do not exist... but are called in a magic way :-)

I have no better name for them.

@bshaffer bshaffer deleted the add-magic-flag branch August 15, 2023 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants