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

Promoted properties & reflection consistency #113

Closed
jkuchar opened this issue Aug 4, 2022 · 2 comments
Closed

Promoted properties & reflection consistency #113

jkuchar opened this issue Aug 4, 2022 · 2 comments

Comments

@jkuchar
Copy link

jkuchar commented Aug 4, 2022

We have built grifart/caffolder on top of php-generator. As we need to also read the state from php-generator I have found an inconsistency with php-reflection.

With php reflection you get properties & promoted properties when retrieving $class->getProperties(). However when using php generator one has to use $class->getProperties() for old-style properties and $class->getMethod('__construct')->getParameters(). See this utils method for more info.

Wouldn't it be nicer to have property accessible directly using $class->getProperties()?

@dg
Copy link
Member

dg commented Aug 5, 2022

It would be a BC break, I don't really want to deal with it.

@JanTvrdik
Copy link
Contributor

JanTvrdik commented Aug 5, 2022

Also it does not make sense to me. PhpGenerator internal structure is AST-like, meaning it corresponds to the code structure, not to the code meaning. So for example PHP reflection will also return methods from traits/parents, but PhpGenerator will not.

@dg dg closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2022
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

No branches or pull requests

3 participants