diff --git a/.travis.yml b/.travis.yml index af68c8b..48a4e0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,9 @@ php: - 7.1 env: - - SYMFONY_VERSION=2.3.* - - SYMFONY_VERSION=2.7.* - - SYMFONY_VERSION=2.8.* - - SYMFONY_VERSION=3.0.* + - SYMFONY_VERSION=4.4.* + - SYMFONY_VERSION=5.0.* + - SYMFONY_VERSION=5.3.* branches: only: diff --git a/composer.json b/composer.json index b992b49..11c3505 100644 --- a/composer.json +++ b/composer.json @@ -11,16 +11,19 @@ ], "require": { "php": ">=7.0", + "ext-json": "*", "elasticsearch/elasticsearch": "^5.1.0||^6.0.0" }, "require-dev": { "atoum/atoum": "^2.8||^3.0", "m6web/coke": "~1.2.0", "m6web/symfony2-coding-standard": "~1.2.0", - "symfony/dependency-injection": "^2.3||^3.0", - "symfony/event-dispatcher": "^2.3||^3.0", - "symfony/config": "^2.3||^3.0", - "symfony/yaml": "^2.3||^3.0" + "symfony/dependency-injection": "^4.4||^5.0", + "symfony/event-dispatcher": "^4.4||^5.0", + "symfony/config": "^4.4||^5.0", + "symfony/yaml": "^4.4||^5.0", + "symfony/http-foundation": "^4.4||^5.0", + "symfony/http-kernel": "^4.4||^5.0" }, "autoload": { "psr-0": { "": "src/" } diff --git a/src/M6Web/Bundle/ElasticsearchBundle/DataCollector/ElasticsearchDataCollector.php b/src/M6Web/Bundle/ElasticsearchBundle/DataCollector/ElasticsearchDataCollector.php index d605658..174c17d 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/DataCollector/ElasticsearchDataCollector.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/DataCollector/ElasticsearchDataCollector.php @@ -43,7 +43,7 @@ public function handleEvent(ElasticsearchEvent $event) /** * {@inheritdoc} */ - public function collect(Request $request, Response $response, \Exception $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null) { } diff --git a/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/Configuration.php b/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/Configuration.php index 4692740..de22105 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/Configuration.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/Configuration.php @@ -17,8 +17,8 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('m6web_elasticsearch'); + $treeBuilder = new TreeBuilder('m6web_elasticsearch'); + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/M6WebElasticsearchExtension.php b/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/M6WebElasticsearchExtension.php index 2ec8cec..5f5dc08 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/M6WebElasticsearchExtension.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/DependencyInjection/M6WebElasticsearchExtension.php @@ -147,14 +147,8 @@ protected function createHandler(ContainerBuilder $container, array $config, $de */ private function setFactoryToDefinition($className, $method, Definition $definition) { - // Symfony 2.3 backward compatibility - if (method_exists('Symfony\Component\DependencyInjection\Definition', 'setFactory')) { - $definition->setFactory([$className, $method]); - } else { - $definition - ->setFactoryClass($className) - ->setFactoryMethod($method); - } + $definition + ->setFactory([$className, $method]); } /** @@ -168,7 +162,7 @@ protected function createDataCollector(ContainerBuilder $container) $collectorDefinition->addTag( 'data_collector', [ - 'template' => 'M6WebElasticsearchBundle:Collector:elasticsearch', + 'template' => '@M6WebElasticsearch/Collector/elasticsearch.html.twig', 'id' => 'elasticsearch' ] ); diff --git a/src/M6Web/Bundle/ElasticsearchBundle/EventDispatcher/ElasticsearchEvent.php b/src/M6Web/Bundle/ElasticsearchBundle/EventDispatcher/ElasticsearchEvent.php index 43eb536..63486ab 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/EventDispatcher/ElasticsearchEvent.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/EventDispatcher/ElasticsearchEvent.php @@ -4,7 +4,7 @@ namespace M6Web\Bundle\ElasticsearchBundle\EventDispatcher; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class ElasticsearchEvent diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Handler/EventHandler.php b/src/M6Web/Bundle/ElasticsearchBundle/Handler/EventHandler.php index c0cc710..6648514 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Handler/EventHandler.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Handler/EventHandler.php @@ -72,7 +72,7 @@ public function __invoke(array $request) $event->setError($response['error']->getMessage()); } - $this->eventDispatcher->dispatch('m6web.elasticsearch', $event); + $this->eventDispatcher->dispatch($event, 'm6web.elasticsearch'); return $response; }; diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Resources/views/Collector/elasticsearch.html.twig b/src/M6Web/Bundle/ElasticsearchBundle/Resources/views/Collector/elasticsearch.html.twig index b549680..27b2775 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Resources/views/Collector/elasticsearch.html.twig +++ b/src/M6Web/Bundle/ElasticsearchBundle/Resources/views/Collector/elasticsearch.html.twig @@ -1,4 +1,4 @@ -{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %} +{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% block toolbar %} {% set icon %} @@ -18,7 +18,7 @@ {{ '%0.2f'|format(collector.totalExecutionTime * 1000) }} ms {% endset %} - {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'link': profiler_url} %} + {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with {'link': profiler_url} %} {% endblock %} {% block menu %}