8000 [Routing] AnnotationDirectoryLoader::load() may return null by mhujer · Pull Request #45263 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Routing] AnnotationDirectoryLoader::load() may return null #45263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
/**
* @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
*/
public function load(mixed $path, string $type = null): RouteCollection
public function load(mixed $path, string $type = null): ?RouteCollection
{
if (!is_dir($dir = $this->locator->locate($path))) {
return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ public function testLoadFileIfLocatedResourceIsFile()
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.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');
}

private function expectAnnotationsToBeReadFrom(array $classes)
{
$this->reader->expects($this->exactly(\count($classes)))
Expand Down
0