From 71166602f4ea18f73a215c3529bb5b4e7bfade29 Mon Sep 17 00:00:00 2001 From: rflavien Date: Wed, 8 Apr 2026 10:48:01 +0200 Subject: [PATCH 1/3] fix(deprecated): Since symfony/dependency-injection 7.4: XML configuration format is deprecated Migrate all DI config files from XML to PHP (ContainerConfigurator). This fixes the deprecation while maintaining compatibility with Symfony ^5.4|^6.4|^7.0. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../TiimeNewRelicExtension.php | 16 +++++----- src/Resources/config/command_listener.php | 17 ++++++++++ src/Resources/config/command_listener.xml | 12 ------- src/Resources/config/deprecation_listener.php | 19 ++++++++++++ src/Resources/config/deprecation_listener.xml | 12 ------- src/Resources/config/exception_listener.php | 17 ++++++++++ src/Resources/config/exception_listener.xml | 12 ------- src/Resources/config/http_listener.php | 19 ++++++++++++ src/Resources/config/http_listener.xml | 13 -------- src/Resources/config/monolog.php | 19 ++++++++++++ src/Resources/config/monolog.xml | 14 --------- src/Resources/config/services.php | 31 +++++++++++++++++++ src/Resources/config/services.xml | 18 ----------- src/Resources/config/twig.php | 16 ++++++++++ src/Resources/config/twig.xml | 12 ------- 15 files changed, 146 insertions(+), 101 deletions(-) create mode 100644 src/Resources/config/command_listener.php delete mode 100644 src/Resources/config/command_listener.xml create mode 100644 src/Resources/config/deprecation_listener.php delete mode 100644 src/Resources/config/deprecation_listener.xml create mode 100644 src/Resources/config/exception_listener.php delete mode 100644 src/Resources/config/exception_listener.xml create mode 100644 src/Resources/config/http_listener.php delete mode 100644 src/Resources/config/http_listener.xml create mode 100644 src/Resources/config/monolog.php delete mode 100644 src/Resources/config/monolog.xml create mode 100644 src/Resources/config/services.php delete mode 100644 src/Resources/config/services.xml create mode 100644 src/Resources/config/twig.php delete mode 100644 src/Resources/config/twig.xml diff --git a/src/DependencyInjection/TiimeNewRelicExtension.php b/src/DependencyInjection/TiimeNewRelicExtension.php index 7092cb5..c766e68 100644 --- a/src/DependencyInjection/TiimeNewRelicExtension.php +++ b/src/DependencyInjection/TiimeNewRelicExtension.php @@ -42,8 +42,8 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.xml'); + $loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.php'); $container->setAlias(NewRelicInteractorInterface::class, $this->getInteractorServiceId($config))->setPublic(false); $container->setAlias(TransactionNamingStrategyInterface::class, $this->getTransactionNamingServiceId($config))->setPublic(false); @@ -78,7 +78,7 @@ public function load(array $configs, ContainerBuilder $container): void ); if ($config['http']['enabled']) { - $loader->load('http_listener.xml'); + $loader->load('http_listener.php'); $container->getDefinition(RequestListener::class) ->setArguments( [ @@ -98,7 +98,7 @@ public function load(array $configs, ContainerBuilder $container): void } if ($config['commands']['enabled']) { - $loader->load('command_listener.xml'); + $loader->load('command_listener.php'); $container->getDefinition(CommandListener::class) ->setArguments( [ @@ -108,22 +108,22 @@ public function load(array $configs, ContainerBuilder $container): void } if ($config['exceptions']['enabled']) { - $loader->load('exception_listener.xml'); + $loader->load('exception_listener.php'); } if ($config['deprecations']['enabled']) { - $loader->load('deprecation_listener.xml'); + $loader->load('deprecation_listener.php'); } if ($config['twig']) { - $loader->load('twig.xml'); + $loader->load('twig.php'); } if ($config['enabled'] && $config['monolog']['enabled']) { if (!class_exists(\Monolog\Handler\NewRelicHandler::class)) { throw new \LogicException('The "symfony/monolog-bundle" package must be installed in order to use "monolog" option.'); } - $loader->load('monolog.xml'); + $loader->load('monolog.php'); $container->setParameter('tiime.new_relic.monolog', $config['monolog'] ?? []); $container->setParameter('tiime.new_relic.application_name', $config['application_name']); $container->setAlias('tiime.new_relic.logs_handler', $config['monolog']['service'])->setPublic(false); diff --git a/src/Resources/config/command_listener.php b/src/Resources/config/command_listener.php new file mode 100644 index 0000000..f87dd5f --- /dev/null +++ b/src/Resources/config/command_listener.php @@ -0,0 +1,17 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->set(CommandListener::class); +}; diff --git a/src/Resources/config/command_listener.xml b/src/Resources/config/command_listener.xml deleted file mode 100644 index 968ff0f..0000000 --- a/src/Resources/config/command_listener.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Resources/config/deprecation_listener.php b/src/Resources/config/deprecation_listener.php new file mode 100644 index 0000000..9c247cb --- /dev/null +++ b/src/Resources/config/deprecation_listener.php @@ -0,0 +1,19 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->set(DeprecationListener::class) + ->public() + ; +}; diff --git a/src/Resources/config/deprecation_listener.xml b/src/Resources/config/deprecation_listener.xml deleted file mode 100644 index ce04a98..0000000 --- a/src/Resources/config/deprecation_listener.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Resources/config/exception_listener.php b/src/Resources/config/exception_listener.php new file mode 100644 index 0000000..6d6bd2f --- /dev/null +++ b/src/Resources/config/exception_listener.php @@ -0,0 +1,17 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->set(ExceptionListener::class); +}; diff --git a/src/Resources/config/exception_listener.xml b/src/Resources/config/exception_listener.xml deleted file mode 100644 index baad5fc..0000000 --- a/src/Resources/config/exception_listener.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/Resources/config/http_listener.php b/src/Resources/config/http_listener.php new file mode 100644 index 0000000..417b6a8 --- /dev/null +++ b/src/Resources/config/http_listener.php @@ -0,0 +1,19 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->set(RequestListener::class); + $services->set(ResponseListener::class); +}; diff --git a/src/Resources/config/http_listener.xml b/src/Resources/config/http_listener.xml deleted file mode 100644 index 011ca46..0000000 --- a/src/Resources/config/http_listener.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/Resources/config/monolog.php b/src/Resources/config/monolog.php new file mode 100644 index 0000000..f03db34 --- /dev/null +++ b/src/Resources/config/monolog.php @@ -0,0 +1,19 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->load('Tiime\\NewRelicBundle\\Logging\\', '../../Logging/*'); + + $services->set('tiime.new_relic.monolog_handler', NewRelicHandler::class); +}; diff --git a/src/Resources/config/monolog.xml b/src/Resources/config/monolog.xml deleted file mode 100644 index 3bd204f..0000000 --- a/src/Resources/config/monolog.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php new file mode 100644 index 0000000..096fc46 --- /dev/null +++ b/src/Resources/config/services.php @@ -0,0 +1,31 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->load('Tiime\\NewRelicBundle\\Command\\', '../../Command/*'); + $services->load('Tiime\\NewRelicBundle\\NewRelic\\', '../../NewRelic/*'); + $services->load('Tiime\\NewRelicBundle\\TransactionNamingStrategy\\', '../../TransactionNamingStrategy/*'); + + $services->set(AdaptiveInteractor::class) + ->args([ + service(NewRelicInteractor::class), + service(BlackholeInteractor::class), + ]) + ; +}; diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml deleted file mode 100644 index e673fec..0000000 --- a/src/Resources/config/services.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/Resources/config/twig.php b/src/Resources/config/twig.php new file mode 100644 index 0000000..7c38c21 --- /dev/null +++ b/src/Resources/config/twig.php @@ -0,0 +1,16 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ; + + $services->load('Tiime\\NewRelicBundle\\Twig\\', '../../Twig/*'); +}; diff --git a/src/Resources/config/twig.xml b/src/Resources/config/twig.xml deleted file mode 100644 index 16df064..0000000 --- a/src/Resources/config/twig.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - From 98bebf25f46648e68436883be7a770ab030591ab Mon Sep 17 00:00:00 2001 From: rflavien Date: Wed, 8 Apr 2026 10:58:26 +0200 Subject: [PATCH 2/3] cs --- .gitignore | 1 + src/Resources/config/command_listener.php | 7 +++++++ src/Resources/config/deprecation_listener.php | 7 +++++++ src/Resources/config/exception_listener.php | 7 +++++++ src/Resources/config/http_listener.php | 7 +++++++ src/Resources/config/monolog.php | 7 +++++++ src/Resources/config/services.php | 7 +++++++ src/Resources/config/twig.php | 7 +++++++ 8 files changed, 50 insertions(+) diff --git a/.gitignore b/.gitignore index f740713..feec297 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /composer.lock /vendor /tools/**/vendor +/.claude/ diff --git a/src/Resources/config/command_listener.php b/src/Resources/config/command_listener.php index f87dd5f..a381e9b 100644 --- a/src/Resources/config/command_listener.php +++ b/src/Resources/config/command_listener.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Tiime\NewRelicBundle\Listener\CommandListener; diff --git a/src/Resources/config/deprecation_listener.php b/src/Resources/config/deprecation_listener.php index 9c247cb..555c568 100644 --- a/src/Resources/config/deprecation_listener.php +++ b/src/Resources/config/deprecation_listener.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Tiime\NewRelicBundle\Listener\DeprecationListener; diff --git a/src/Resources/config/exception_listener.php b/src/Resources/config/exception_listener.php index 6d6bd2f..5a796e6 100644 --- a/src/Resources/config/exception_listener.php +++ b/src/Resources/config/exception_listener.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Tiime\NewRelicBundle\Listener\ExceptionListener; diff --git a/src/Resources/config/http_listener.php b/src/Resources/config/http_listener.php index 417b6a8..4985367 100644 --- a/src/Resources/config/http_listener.php +++ b/src/Resources/config/http_listener.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Tiime\NewRelicBundle\Listener\RequestListener; use Tiime\NewRelicBundle\Listener\ResponseListener; diff --git a/src/Resources/config/monolog.php b/src/Resources/config/monolog.php index f03db34..d93d4a1 100644 --- a/src/Resources/config/monolog.php +++ b/src/Resources/config/monolog.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Monolog\Handler\NewRelicHandler; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php index 096fc46..6338867 100644 --- a/src/Resources/config/services.php +++ b/src/Resources/config/services.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; diff --git a/src/Resources/config/twig.php b/src/Resources/config/twig.php index 7c38c21..4b9c66b 100644 --- a/src/Resources/config/twig.php +++ b/src/Resources/config/twig.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of Tiime New Relic bundle. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $container): void { From b89785d9170f03664ee732c3a67b7c1dbaa451a3 Mon Sep 17 00:00:00 2001 From: rflavien Date: Wed, 8 Apr 2026 11:07:01 +0200 Subject: [PATCH 3/3] tests --- .github/workflows/tests.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8435567..0f0e428 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,23 +10,19 @@ jobs: matrix: include: # Lowest Deps - - php: 8.2 - symfony-require: 5.4.* - composer-flags: '--prefer-stable --prefer-lowest' - # LTS with latest stable PHP - - php: 8.2 - symfony-require: 6.4.* - composer-flags: '--prefer-stable' - # Active release - php: 8.3 - symfony-require: 7.1.* + symfony-version: 7.1.* + composer-flags: '--prefer-stable --ignore-platform-req=php+' + # Active release + - php: 8.4 + symfony-version: 7.1.* + composer-flags: '--prefer-stable --ignore-platform-req=php+' + - php: 8.4 + symfony-version: 7.2.* + composer-flags: '--prefer-stable --ignore-platform-req=php+' + - php: 8.4 + symfony-version: 7.3.* composer-flags: '--prefer-stable --ignore-platform-req=php+' - # Development release - - php: nightly - symfony-require: 7.1.*@dev - composer-flags: '--ignore-platform-req=php+' - stability: dev - can-fail: true fail-fast: false steps: