-
Notifications
You must be signed in to change notification settings - Fork 36
Fix top-level use statements #105
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
Conversation
|
Where |
src/annotations/AnnotationParser.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.
Maybe it's better to be written as if/else without ternary operator to be more readable. Now the 1 + -1 construct that is evaluated at the end is a bit confusing.
|
Today’s review completed. |
bd29b57 to
7973e20
Compare
|
|
src/annotations/AnnotationParser.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.
This line uses the explode function side effect that if char for explode wasn't found in a string the whole string is returned as 1st array element.
It's better to be more specific (this code will replace this and following line):
if (strpos($use, '\\') !== false) {
$uses[substr($use, 1 + strrpos($use, '\\'))] = $use;
}
else {
$uses[$use] = $use;
}|
Today’s review completed. |
Given a namespaced file which uses a top-level name like
namespace mindplay;
use PDO;
the parser will incorrectly generate the following uses information due
to an off-by-one error:
array('DO' => 'PDO')
This commit adjusts the parser to handle use statements which import a
name without a namespace separator.
7973e20 to
a874b4b
Compare
|
Adjusted as requested! |
|
Looks good. Merging. Thanks, @benesch . |
Given a namespaced file which uses a top-level name like
the parser will incorrectly generate the following uses information:
This commit adjusts the parser to handle use statements which import a
name without a namespace separator.