Skip to content

Commit f5a0765

Browse files
committed
Changed private static array-properties to const
1 parent 3452dfd commit f5a0765

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
@@ -28,7 +28,7 @@
2828
*/
2929
class YamlFileLoader extends FileLoader
3030
{
31-
private static $availableKeys = [
31+
private const AVAILABLE_KEYS = [
3232
'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', 'name_prefix', 'trailing_slash_on_root', 'locale', 'format', 'utf8', 'exclude',
3333
];
3434
private $yamlParser;
@@ -269,8 +269,8 @@ protected function validate($config, $name, $path)
269269
if (!\is_array($config)) {
270270
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
271271
}
272-
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
273-
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)));
272+
if ($extraKeys = array_diff(array_keys($config), self::AVAILABLE_KEYS)) {
273+
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)));
274274
}
275275
if (isset($config['resource']) && isset($config['path'])) {
276276
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)