From 1ad05180c577fc2e40cd2995470f35c8416e15e4 Mon Sep 17 00:00:00 2001 From: Zombaya Date: Mon, 16 Dec 2024 20:43:20 +0100 Subject: [PATCH] More cleanup --- .../DoctrineEncryptExtension.php | 20 ------------------- .../ServiceConfigurator.php | 4 ++-- .../DoctrineEncryptExtension.php | 20 ------------------- .../DoctrineEncryptExtensionTest.php | 11 +++++----- 4 files changed, 7 insertions(+), 48 deletions(-) diff --git a/src-new/DependencyInjection/DoctrineEncryptExtension.php b/src-new/DependencyInjection/DoctrineEncryptExtension.php index e9c3051..6549e85 100644 --- a/src-new/DependencyInjection/DoctrineEncryptExtension.php +++ b/src-new/DependencyInjection/DoctrineEncryptExtension.php @@ -16,26 +16,6 @@ public function load(array $configs, ContainerBuilder $container): void $config = $this->processConfiguration(new Configuration($this->getAlias()), $configs); (new ServiceConfigurator($this->versionTester, true))->configure($config, $container); - - // Symfony 1-4 - // Sanity-check since this should be blocked by composer.json - if (Kernel::MAJOR_VERSION < 5 || (Kernel::MAJOR_VERSION === 5 && Kernel::MINOR_VERSION < 4)) { - throw new \RuntimeException('doctrineencryptbundle/doctrine-encrypt-bundle expects symfony-version >= 5.4!'); - } - - // Wrap exceptions - if ($config['wrap_exceptions']) { - self::wrapExceptions(true); - } else { - trigger_deprecation( - 'doctrineencryptbundle/doctrine-encrypt-bundle', - '5.4.2', - <<<'EOF' -Starting from 6.0, all exceptions thrown by this library will be wrapped by \Ambta\DoctrineEncryptBundle\Exception\DoctrineEncryptBundleException or a child-class of it. -You can start using these exceptions today by setting 'ambta_doctrine_encrypt.wrap_exceptions' to TRUE. -EOF - ); - } } /** diff --git a/src-new/DependencyInjection/ServiceConfigurator.php b/src-new/DependencyInjection/ServiceConfigurator.php index d9cb319..bf6a949 100644 --- a/src-new/DependencyInjection/ServiceConfigurator.php +++ b/src-new/DependencyInjection/ServiceConfigurator.php @@ -104,9 +104,9 @@ public function configure(array $config, ContainerBuilder $container): void trigger_deprecation( 'doctrineencryptbundle/doctrine-encrypt-bundle', '5.4.2', - <<<'EOF' + <<longPrefix.'.wrap_exceptions' to TRUE. +You can start using these exceptions today by setting '{$this->prefix}wrap_exceptions' to TRUE. EOF ); } diff --git a/src/DependencyInjection/DoctrineEncryptExtension.php b/src/DependencyInjection/DoctrineEncryptExtension.php index 9ce5d02..0f0f991 100644 --- a/src/DependencyInjection/DoctrineEncryptExtension.php +++ b/src/DependencyInjection/DoctrineEncryptExtension.php @@ -58,26 +58,6 @@ public function load(array $configs, ContainerBuilder $container): void $config = $this->processConfiguration(new Configuration($this->getAlias()), $configs); (new ServiceConfigurator($this->versionTester, false))->configure($config, $container); - - // Symfony 1-4 - // Sanity-check since this should be blocked by composer.json - if (Kernel::MAJOR_VERSION < 5 || (Kernel::MAJOR_VERSION === 5 && Kernel::MINOR_VERSION < 4)) { - throw new \RuntimeException('doctrineencryptbundle/doctrine-encrypt-bundle expects symfony-version >= 5.4!'); - } - - // Wrap exceptions - if ($config['wrap_exceptions']) { - self::wrapExceptions(true); - } else { - trigger_deprecation( - 'doctrineencryptbundle/doctrine-encrypt-bundle', - '5.4.2', - <<<'EOF' -Starting from 6.0, all exceptions thrown by this library will be wrapped by \Ambta\DoctrineEncryptBundle\Exception\DoctrineEncryptBundleException or a child-class of it. -You can start using these exceptions today by setting 'ambta_doctrine_encrypt.wrap_exceptions' to TRUE. -EOF - ); - } } /** diff --git a/tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php b/tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php index 8bb2d2e..153dbfa 100644 --- a/tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php +++ b/tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php @@ -281,14 +281,13 @@ public function testConfigLoadsCorrectServicesAndParameters( $expectedServiceIds = array_merge( array_keys($expectedServices), - array_keys($expectedAliases) + array_keys($expectedAliases), + [ + \Psr\Container\ContainerInterface::class, + \Symfony\Component\DependencyInjection\ContainerInterface::class, + ] ); - if (PHP_MAJOR_VERSION < 8) { - $expectedServiceIds[] = \Psr\Container\ContainerInterface::class; - $expectedServiceIds[] = \Symfony\Component\DependencyInjection\ContainerInterface::class; - } - $this->assertEqualsCanonicalizing($expectedServiceIds, $container->getServiceIds()); foreach ($expectedServices as $expectedService => $expectedValue) {