Skip to content

Commit

Permalink
drop support for unmaintained Symfony versions
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jun 5, 2019
1 parent 961cc9c commit d3956d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 48 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
### Changed

- Dropped support for PHP < 7.1
- Dropped support for Symfony 2
- Dropped support for Symfony versions that do not receive bugfixes

### Added

Expand Down
26 changes: 13 additions & 13 deletions composer.json
Expand Up @@ -35,11 +35,11 @@
"php-http/message-factory": "^1.0.2",
"php-http/stopwatch-plugin": "^1.2",
"psr/http-message": "^1.0",
"symfony/config": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/dependency-injection": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/event-dispatcher": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/http-kernel": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/options-resolver": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1"
"symfony/config": "^3.4.20 || ^4.2.1",
"symfony/dependency-injection": "^3.4.20 || ^4.2.1",
"symfony/event-dispatcher": "^3.4.20 || ^4.2.1",
"symfony/http-kernel": "^3.4.20 || ^4.2.1",
"symfony/options-resolver": "^3.4.20 || ^4.2.1"
},
"conflict": {
"php-http/guzzle6-adapter": "<1.1"
Expand All @@ -54,15 +54,15 @@
"php-http/promise": "^1.0",
"php-http/vcr-plugin": "^1.0@dev",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/browser-kit": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/cache": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/dom-crawler": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/framework-bundle": "^3.4.0 || ^4.0",
"symfony/http-foundation": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/browser-kit": "^3.4.20 || ^4.2.1",
"symfony/cache": "^3.4.20 || ^4.2.1",
"symfony/dom-crawler": "^3.4.20 || ^4.2.1",
"symfony/framework-bundle": "^3.4.0 || ^4.2",
"symfony/http-foundation": "^3.4.20 || ^4.2.1",
"symfony/phpunit-bridge": "^3.4 || ^4.2",
"symfony/stopwatch": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/twig-bundle": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/web-profiler-bundle": "^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/stopwatch": "^3.4.20 || ^4.2.1",
"symfony/twig-bundle": "^3.4.20 || ^4.2.1",
"symfony/web-profiler-bundle": "^3.4.20 || ^4.2.1",
"twig/twig": "^1.36 || ^2.6"
},
"suggest": {
Expand Down
39 changes: 5 additions & 34 deletions src/DependencyInjection/Configuration.php
Expand Up @@ -54,12 +54,7 @@ public function __construct($debug)
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('httplug');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('httplug');
} else {
$rootNode = $treeBuilder->getRootNode();
}
$rootNode = $treeBuilder->getRootNode();

$this->configureClients($rootNode);
$this->configureSharedPlugins($rootNode);
Expand Down Expand Up @@ -260,15 +255,9 @@ private function configureSharedPlugins(ArrayNodeDefinition $root)
private function createClientPluginNode()
{
$treeBuilder = new TreeBuilder('plugins');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->root('plugins');
} else {
$node = $treeBuilder->getRootNode();
}

/** @var ArrayNodeDefinition $pluginList */
$pluginList = $node
$pluginList = $treeBuilder->getRootNode()
->info('A list of plugin service ids and client specific plugin definitions. The order is important.')
->prototype('array')
;
Expand Down Expand Up @@ -596,14 +585,8 @@ private function addSharedPluginNodes(ArrayNodeDefinition $pluginNode, $disableA
private function createAuthenticationPluginNode()
{
$treeBuilder = new TreeBuilder('authentication');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->root('authentication');
} else {
$node = $treeBuilder->getRootNode();
}

$node
$treeBuilder->getRootNode()
->useAttributeAsKey('name')
->prototype('array')
->validate()
Expand Down Expand Up @@ -693,14 +676,8 @@ private function validateAuthenticationType(array $expected, array $actual, $aut
private function createCachePluginNode()
{
$builder = new TreeBuilder('config');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($builder, 'getRootNode')) {
$config = $builder->root('config');
} else {
$config = $builder->getRootNode();
}

$config
$builder->getRootNode()
->fixXmlConfig('method')
->fixXmlConfig('respect_response_cache_directive')
->addDefaultsIfNotSet()
Expand Down Expand Up @@ -769,14 +746,8 @@ private function createCachePluginNode()
;

$treeBuilder = new TreeBuilder('cache');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$cache = $treeBuilder->root('cache');
} else {
$cache = $treeBuilder->getRootNode();
}

$cache
$treeBuilder->getRootNode()
->canBeEnabled()
->info('Configure HTTP caching, requires the php-http/cache-plugin package')
->addDefaultsIfNotSet()
Expand Down

0 comments on commit d3956d7

Please sign in to comment.