From 96d2ab1067befe7690599ebaf080e6c05bd2b439 Mon Sep 17 00:00:00 2001 From: Yoshida Masaaki Date: Mon, 11 Jul 2022 16:54:15 +0900 Subject: [PATCH 1/3] update composer.json --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 6523aa9..fa20cb1 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,11 @@ ], "require": { "php": ">=5.5.9", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~2.8|~3.0|~4.0", - "symfony/framework-bundle": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~2.8|~3.0|~4.0", - "symfony/routing": "~2.8|~3.0|~4.0" + "symfony/config": "~4.0|~5.0", + "symfony/dependency-injection": "~4.0|~5.0", + "symfony/framework-bundle": "~4.0|~5.0", + "symfony/http-kernel": "~4.0|~5.0", + "symfony/routing": "~4.0|~5.0" }, "require-dev": { "ext-dom": "*", From f1754c6fc2e7dd9840f9413834568eb8cb278cae Mon Sep 17 00:00:00 2001 From: Yoshida Masaaki Date: Tue, 19 Jul 2022 11:22:00 +0900 Subject: [PATCH 2/3] update composer.json --- src/DependencyInjection/Configuration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index d2442a7..22a7c2c 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -22,8 +22,8 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $treeBuilder->root('phpmentors_route_templating'); + $treeBuilder = new TreeBuilder('phpmentors_route_templating'); + $treeBuilder->getRootNode(); return $treeBuilder; } From 4935e9a5099e96ee464595dbff7fee1386cc3651 Mon Sep 17 00:00:00 2001 From: Yoshida Masaaki Date: Tue, 19 Jul 2022 11:24:17 +0900 Subject: [PATCH 3/3] change copy_as configured to options child node. --- src/Routing/Loader/YamlFileLoader.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/Routing/Loader/YamlFileLoader.php b/src/Routing/Loader/YamlFileLoader.php index 40cc0ea..abc94a8 100644 --- a/src/Routing/Loader/YamlFileLoader.php +++ b/src/Routing/Loader/YamlFileLoader.php @@ -24,7 +24,7 @@ class YamlFileLoader extends \Symfony\Component\Routing\Loader\YamlFileLoader /** * {@inheritdoc} */ - public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null) + public function import($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, $exclude = null) { $routeCollection = parent::import($resource, $type, $ignoreErrors, $sourceResource); $copyAs = $this->copyAs[count($this->copyAs) - 1]; @@ -43,26 +43,9 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe /** * {@inheritdoc} */ - public function load($file, $type = null) + protected function parseImport(RouteCollection $collection, array $config, string $path, string $file) { - $availableKeysProperty = new \ReflectionProperty(\Symfony\Component\Routing\Loader\YamlFileLoader::class, 'availableKeys'); - $availableKeysProperty->setAccessible(true); - $availableKeys = $availableKeysProperty->getValue(); - if (!in_array('copy_as', $availableKeys)) { - $availableKeys[] = 'copy_as'; - $availableKeysProperty->setValue(null, $availableKeys); - } - $availableKeysProperty->setAccessible(false); - - return parent::load($file, $type); - } - - /** - * {@inheritdoc} - */ - protected function parseImport(RouteCollection $collection, array $config, $path, $file) - { - $this->copyAs[] = isset($config['copy_as']) ? $config['copy_as'] : null; + $this->copyAs[] = isset($config['options']['copy_as']) ? $config['options']['copy_as'] : null; parent::parseImport($collection, $config, $path, $file); }