From a2db82adf38a8807aa5f8a0e314d381166c4f881 Mon Sep 17 00:00:00 2001 From: Amir Sghair Date: Fri, 3 Jul 2020 16:17:17 +0200 Subject: [PATCH] feat(env-var): Deprecate EnvVarEncryptedProcessor service and EncryptCommand command --- CHANGELOG.md | 1 + Command/EncryptCommand.php | 8 ++++++++ DependencyInjection/EkinoDataProtectionExtension.php | 6 ++++++ DependencyInjection/EnvVarEncryptedProcessor.php | 8 ++++++++ Resources/config/services.xml | 2 ++ Tests/Command/EncryptCommandTest.php | 7 +++++++ 6 files changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e797a..3404dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG master ------ +* Deprecate EnvVarEncryptedProcessor and EncryptCommand * Improve message in case of encryption error * Add command to encrypt secrets * Drop support for PHP 7.1 diff --git a/Command/EncryptCommand.php b/Command/EncryptCommand.php index bd3b477..e2db123 100644 --- a/Command/EncryptCommand.php +++ b/Command/EncryptCommand.php @@ -19,10 +19,18 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +@trigger_error( + 'The '.__NAMESPACE__.'\EncryptCommand class is deprecated, use symfony secrets management commands instead', + E_USER_DEPRECATED +); + /** * Class EncryptCommand * * @author Christian Kollross + * + * @deprecated use symfony secrets management commands instead. + * @see https://github.com/symfony/symfony/pull/33997 */ final class EncryptCommand extends Command { diff --git a/DependencyInjection/EkinoDataProtectionExtension.php b/DependencyInjection/EkinoDataProtectionExtension.php index 423264a..c4e30fe 100644 --- a/DependencyInjection/EkinoDataProtectionExtension.php +++ b/DependencyInjection/EkinoDataProtectionExtension.php @@ -60,11 +60,17 @@ private function configureEncryptor(array $config, ContainerBuilder $container): } /** + * @deprecated * @param array $config * @param ContainerBuilder $container */ private function configureEncryptCommand(array $config, ContainerBuilder $container): void { + @trigger_error( + 'The '.__METHOD__.' method is deprecated command will be removed, use symfony secret management commands instead.', + E_USER_DEPRECATED + ); + $container ->findDefinition('ekino_data_protection.command.encryptor') ->replaceArgument(0, $config['method']) diff --git a/DependencyInjection/EnvVarEncryptedProcessor.php b/DependencyInjection/EnvVarEncryptedProcessor.php index cefbe03..1e5f3ed 100644 --- a/DependencyInjection/EnvVarEncryptedProcessor.php +++ b/DependencyInjection/EnvVarEncryptedProcessor.php @@ -17,8 +17,16 @@ use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +@trigger_error( + 'The '.__NAMESPACE__.'\EnvVarEncryptedProcessor class is deprecated, use symfony secrets management instead', + E_USER_DEPRECATED +); + /** * @author RĂ©mi Marseille + * + * @deprecated use symfony secrets instead. + * @see https://github.com/symfony/symfony/pull/33997 */ final class EnvVarEncryptedProcessor implements EnvVarProcessorInterface { diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 1d6f5d2..fc3e67e 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -18,12 +18,14 @@ + The "%service_id%" service is deprecated, use symfony secrets management commands instead + The "%service_id%" service is deprecated, use symfony secrets management instead diff --git a/Tests/Command/EncryptCommandTest.php b/Tests/Command/EncryptCommandTest.php index 2ff2a48..2f723ed 100644 --- a/Tests/Command/EncryptCommandTest.php +++ b/Tests/Command/EncryptCommandTest.php @@ -20,10 +20,17 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +@trigger_error( + 'The '.__NAMESPACE__.'\EncryptCommandTest class is deprecated since command is deprecated', + E_USER_DEPRECATED +); + /** * Class EncryptCommandTest * * @author Christian Kollross + * + * @deprecated since EncryptCommand class is deprecated. */ class EncryptCommandTest extends TestCase {