[Routing] Fix the annotation loader taking a class constant as a beginning of a class name

This commit is contained in:
Jakub Zalas 2016-04-25 16:50:46 +01:00
parent 1d43d9c602
commit 43c7f9b5e9
3 changed files with 25 additions and 0 deletions

View File

@ -96,6 +96,8 @@ class AnnotationFileLoader extends FileLoader
$token = $tokens[$i];
if (!isset($token[1])) {
$class = false;
continue;
}

View File

@ -0,0 +1,13 @@
<?php
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
trait FooTrait
{
public function doBar()
{
$baz = self::class;
if (true) {
}
}
}

View File

@ -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
*/