Skip to content

Conversation

@jakzal
Copy link
Contributor

@jakzal jakzal commented Apr 25, 2016

Q A
Branch? 2.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #18633
License MIT
Doc PR -

Hold on with the merge. I'd like to see if there should be more test cases added first.

$token = $tokens[$i];

if (!isset($token[1])) {
$class = false;
Copy link

@mkruk-u2 mkruk-u2 Apr 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this really fixes the problem.

Example:

public function doBar()
{
    $isAbc = MyClass::class === ABC;
}

I'll find "ABC" as a class name.

It seems that the problm is on line 114/116, i.e. the condition:

if (T_CLASS === $token[0]) {

because having T_CLASS token doesn't really mean that we've found a class definition.
Until PHP token_get_all() function can differentiate between class MyClass { ... (which is really a class definition), and MyClass::class (which isn't), I think this condition needs to be extended, e.g.:

$previousTokenIsPaamayimNekudotayim = isset($tokens[$i - 1]) && T_PAAMAYIM_NEKUDOTAYIM === $tokens[$i - 1][0];
if (T_CLASS === $token[0] && !$previousTokenIsPaamayimNekudotayim) {
    $class = true;
}

Copy link
Contributor Author

@jakzal jakzal Apr 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said this is not ready yet. Thanks for feedback so far!

@jakzal
Copy link
Contributor Author

jakzal commented May 13, 2016

I'm offline till June. If anyone wants to take over this PR, feel free to do so. Otherwise I'll finish this off when I'm back.

@nicolas-grekas
Copy link
Member

Continued in #18907
Thank you @jakzal

@jakzal jakzal deleted the routing-annotation-file-loader branch June 28, 2016 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants