Skip to content

Commit 6f52503

Browse files
committed
adjust for symfony 4.3
1 parent d51a990 commit 6f52503

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"require-dev": {
3636
"guzzlehttp/psr7": "^1.0",
37-
"matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.3",
37+
"matthiasnoback/symfony-dependency-injection-test": "^3.0",
3838
"nyholm/nsa": "^1.1",
3939
"php-http/cache-plugin": "^1.6",
4040
"php-http/guzzle6-adapter": "^1.1.1 || ^2.0.1",

src/DependencyInjection/Configuration.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,14 @@ private function createCachePluginNode()
768768
->end()
769769
;
770770

771-
$cache = $builder->root('cache');
771+
$treeBuilder = new TreeBuilder('cache');
772+
// Keep compatibility with symfony/config < 4.2
773+
if (!method_exists($treeBuilder, 'getRootNode')) {
774+
$cache = $treeBuilder->root('cache');
775+
} else {
776+
$cache = $treeBuilder->getRootNode();
777+
}
778+
772779
$cache
773780
->canBeEnabled()
774781
->info('Configure HTTP caching, requires the php-http/cache-plugin package')

tests/Functional/ServiceInstantiationTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1919
use Symfony\Component\HttpKernel\HttpKernelInterface;
20+
use Symfony\Component\HttpKernel\Kernel;
2021
use Symfony\Component\HttpKernel\KernelEvents;
2122
use Symfony\Component\HttpKernel\Profiler\Profiler;
2223

@@ -113,7 +114,11 @@ protected static function bootKernel(array $options = [])
113114

114115
$event = new GetResponseEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
115116

116-
$dispatcher->dispatch(KernelEvents::REQUEST, $event);
117+
if (version_compare(Kernel::VERSION, '4.3.0', '>=')) {
118+
$dispatcher->dispatch($event, KernelEvents::REQUEST);
119+
} else {
120+
$dispatcher->dispatch(KernelEvents::REQUEST, $event);
121+
}
117122

118123
return static::$kernel;
119124
}

0 commit comments

Comments
 (0)