Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
23 changes: 3 additions & 20 deletions src/Routing/Loader/YamlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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);
}
Expand Down