Skip to content

Commit

Permalink
[Routing] Fix routes annotation loading with glob pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
snoob committed Mar 29, 2019
1 parent 755d481 commit c7c45a1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
Expand Up @@ -56,6 +56,11 @@ public function load($file, $type = null)

$collection = new RouteCollection();
if ($class = $this->findClass($path)) {
$refl = new \ReflectionClass($class);
if ($refl->isAbstract()) {
return;
}

$collection->addResource(new FileResource($path));
$collection->addCollection($this->loader->load($class, $type));
}
Expand Down
Expand Up @@ -13,4 +13,9 @@

abstract class AbstractClass
{
abstract public function abstractRouteAction();

public function routeAction($arg1, $arg2 = 'defaultValue2', $arg3 = 'defaultValue3')
{
}
}
Expand Up @@ -78,6 +78,14 @@ public function testLoadAnonymousClass()
$this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php');
}

public function testLoadAbstractClass()
{
$this->reader->expects($this->never())->method('getClassAnnotation');
$this->reader->expects($this->never())->method('getMethodAnnotations');

$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/AbstractClass.php');
}

public function testSupports()
{
$fixture = __DIR__.'/../Fixtures/annotated.php';
Expand Down

0 comments on commit c7c45a1

Please sign in to comment.