[Routing] fix route loading with wildcard, but dir or file is empty

This commit is contained in:
Gerhard Seidel 2019-10-18 13:11:49 +02:00 committed by Nicolas Grekas
parent 537d373e0d
commit 217058b475
5 changed files with 8 additions and 3 deletions

View File

@ -39,7 +39,8 @@ class RoutingConfigurator
final public function import($resource, $type = null, $ignoreErrors = false)
{
$this->loader->setCurrentDir(\dirname($this->path));
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file) ?? [];
if (!\is_array($imported)) {
return new ImportConfigurator($this->collection, $imported);
}

View File

@ -169,7 +169,7 @@ class XmlFileLoader extends FileLoader
$this->setCurrentDir(\dirname($path));
/** @var RouteCollection[] $imported */
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file) ?? [];
if (!\is_array($imported)) {
$imported = [$imported];

View File

@ -187,7 +187,7 @@ class YamlFileLoader extends FileLoader
$this->setCurrentDir(\dirname($path));
$imported = $this->import($config['resource'], $type, false, $file);
$imported = $this->import($config['resource'], $type, false, $file) ?? [];
if (!\is_array($imported)) {
$imported = [$imported];

View File

@ -5,3 +5,7 @@ api:
resource: ../controller/routing.yml
name_prefix: api_
prefix: /api
empty_wildcard:
resource: ../controller/empty_wildcard/*
prefix: /empty_wildcard