You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using annotation based dependency injection on a property of a Trait (accessibility does not matter: private, protected, public), it seems no aliases can be used:
Error-message: The @var annotation on Class::propertyName contains a non existent class "AliasName". Did you maybe forget to add a "use" statement for this annotation?", which seem to origin here
I "guess" the parsing of use statements of the declaring class does not consider stuff that are defined in a trait?
I think not only the declaring class of the property should be considered, but also the traits that are used by that class with ReflectionClass.getTraits()
The text was updated successfully, but these errors were encountered:
Ah right, that's probably not a case handled by PhpDocReader… It might be worth looking into using https://github.com/phpDocumentor/TypeResolver or else that's something to fix in PhpDocReader :/
Mm, interesting package indeed. Might be useful. But I would say to first try to stay with native PHP, recursively iterate over all used Traits (potential performance thingie?). Note that ReflectionClass.getTraitNames() can be used to determine the used Traits, but that it is not recursive by default, see 1st comment.
When using annotation based dependency injection on a property of a Trait (accessibility does not matter: private, protected, public), it seems no aliases can be used:
With the FQCN, it works
When using an alias, an error message is generated:
Error-message:
The @var annotation on Class::propertyName contains a non existent class "AliasName". Did you maybe forget to add a "use" statement for this annotation?"
, which seem to origin hereI "guess" the parsing of use statements of the declaring class does not consider stuff that are defined in a trait?
https://github.com/PHP-DI/PhpDocReader/blob/21dce5e29f640d655e7b4583ecfb7d166127a5da/src/PhpDocReader/PhpDocReader.php#L102
I think not only the declaring class of the property should be considered, but also the traits that are used by that class with ReflectionClass.getTraits()
The text was updated successfully, but these errors were encountered: