Skip to content

Commit 2c3c67a

Browse files
authored
Merge pull request #65 from symplify/fix/issue-58-error-with-empty-routes-file
fix: emit empty closure for empty YAML files (fixes #58)
2 parents 557669d + f2aadba commit 2c3c67a

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/Converter/YamlToPhpConverter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ public function convert(string $yaml, string $filePath): string
3232
{
3333
/** @var mixed[]|null $yamlArray */
3434
$yamlArray = $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS | Yaml::PARSE_CONSTANT);
35-
if ($yamlArray === null) {
36-
return '';
37-
}
3835

39-
return $this->convertYamlArray($yamlArray, $filePath);
36+
return $this->convertYamlArray($yamlArray ?? [], $filePath);
4037
}
4138

4239
/**
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#index:
2+
# path: /
3+
# controller: App\Controller\DefaultController::index
4+
-----
5+
<?php
6+
7+
declare(strict_types=1);
8+
9+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
10+
11+
return static function (RoutingConfigurator $routingConfigurator): void {
12+
};

0 commit comments

Comments
 (0)