php-generator
php-generator copied to clipboard
Promoted properties & reflection consistency
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()?
It would be a BC break, I don't really want to deal with it.
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.