-
Notifications
You must be signed in to change notification settings - Fork 286
Handle FQCN parsed parameter as it #197
Conversation
Sami/Parser/NodeVisitor.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the $param->type is sometimes a string with string or other scalar type and sometimes it's a FullyQualified class instance if this is class or interface (I wonder how PhpParser distinguishes between two class/interface or a scalar type).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right !
When the parameter is typed as array, the $param->type property is a string. I've checked with PHP7 and with the types string or float for the moment there is a problem (it return a FullyQualified to A\B\string. Maybe another PR for that 😄.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the spaces after '(' and before ')' and add a space after if?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the spaces after '(' and before ')' and add a space after if?
Usually fabpot.io detects any CS issues and offers quick fix for them. Maybe it's broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated !
5c894b2 to
3644eec
Compare
Sami/Parser/NodeVisitor.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be removed :)
3644eec to
78c2870
Compare
Sami/Parser/NodeVisitor.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... updated
A `PhpParser\Node\Name\FullyQualified` parsed parameter type is not handle like it must be. The `resolveAlias` method check for the `\\` prefix which is missing here so we got a wrong alias. Now, the parameter parsed type is checked to add the prefix when necessary. Work on #194
78c2870 to
fa383f7
Compare
|
Thank you @shulard. |
This PR was merged into the 3.1-dev branch. Discussion ---------- Handle FQCN parsed parameter as it A `PhpParser\Node\Name\FullyQualified` parsed parameter type is not handle like it must be. The `resolveAlias` method check for the `\\` prefix which is missing here so we got a wrong alias. Now, the parameter parsed type is checked to add the prefix when necessary. Work on #194 Commits ------- fa383f7 Handle FQCN parsed parameter as it
A
PhpParser\Node\Name\FullyQualifiedparsed parameter type is not handle like it must be. TheresolveAliasmethod check for the\\prefix which is missing here so we got a wrong alias.Now, the parameter parsed type is checked to add the prefix when necessary.
Work on #194