Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c7c45a1

Browse filesBrowse files
committed
[Routing] Fix routes annotation loading with glob pattern
1 parent 755d481 commit c7c45a1
Copy full SHA for c7c45a1

File tree

3 files changed

+18
-0
lines changed
Filter options

3 files changed

+18
-0
lines changed

‎src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public function load($file, $type = null)
5656

5757
$collection = new RouteCollection();
5858
if ($class = $this->findClass($path)) {
59+
$refl = new \ReflectionClass($class);
60+
if ($refl->isAbstract()) {
61+
return;
62+
}
63+
5964
$collection->addResource(new FileResource($path));
6065
$collection->addCollection($this->loader->load($class, $type));
6166
}

‎src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@
1313

1414
abstract class AbstractClass
1515
{
16+
abstract public function abstractRouteAction();
17+
18+
public function routeAction($arg1, $arg2 = 'defaultValue2', $arg3 = 'defaultValue3')
19+
{
20+
}
1621
}

‎src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ public function testLoadAnonymousClass()
7878
$this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php');
7979
}
8080

81+
public function testLoadAbstractClass()
82+
{
83+
$this->reader->expects($this->never())->method('getClassAnnotation');
84+
$this->reader->expects($this->never())->method('getMethodAnnotations');
85+
86+
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/AbstractClass.php');
87+
}
88+
8189
public function testSupports()
8290
{
8391
$fixture = __DIR__.'/../Fixtures/annotated.php';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.