[Routing] Fix the annotation loader taking a class constant as a beginning of a class name
This commit is contained in:
parent
1d43d9c602
commit
43c7f9b5e9
@ -96,6 +96,8 @@ class AnnotationFileLoader extends FileLoader
|
||||
$token = $tokens[$i];
|
||||
|
||||
if (!isset($token[1])) {
|
||||
$class = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
|
||||
|
||||
trait FooTrait
|
||||
{
|
||||
public function doBar()
|
||||
{
|
||||
$baz = self::class;
|
||||
if (true) {
|
||||
}
|
||||
}
|
||||
}
|
@ -35,6 +35,16 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
|
||||
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.4
|
||||
*/
|
||||
public function testLoadTraitWithClassConstant()
|
||||
{
|
||||
$this->reader->expects($this->never())->method('getClassAnnotation');
|
||||
|
||||
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooTrait.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.6
|
||||
*/
|
||||
|
Reference in New Issue
Block a user