Skip to content

Commit 7a26ac4

Browse files
Merge branch '5.1' into 5.2
* 5.1: Changed private static array-properties to const
2 parents 90e1d99 + 5b25347 commit 7a26ac4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Loader/YamlFileLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class YamlFileLoader extends FileLoader
3333
use LocalizedRouteTrait;
3434
use PrefixTrait;
3535

36-
private static $availableKeys = [
36+
private const AVAILABLE_KEYS = [
3737
'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', 'name_prefix', 'trailing_slash_on_root', 'locale', 'format', 'utf8', 'exclude', 'stateless',
3838
];
3939
private $yamlParser;
@@ -240,8 +240,8 @@ protected function validate($config, string $name, string $path)
240240
if (!\is_array($config)) {
241241
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
242242
}
243-
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
244-
throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)));
243+
if ($extraKeys = array_diff(array_keys($config), self::AVAILABLE_KEYS)) {
244+
throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::AVAILABLE_KEYS)));
245245
}
246246
if (isset($config['resource']) && isset($config['path'])) {
247247
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name));

0 commit comments

Comments
 (0)