From d6228abe8f45c38cc685ba1fdd507b4e964204f8 Mon Sep 17 00:00:00 2001 From: Michael Erkens Date: Wed, 23 Feb 2022 00:51:52 +0100 Subject: [PATCH] Fixes to real support Symfony 6 with PHP 8; also scheb/2fa-bundle 6.0 must be used --- DependencyInjection/TwoFactorTextExtension.php | 4 ++-- README.md | 14 -------------- TextSender/AuthCodeTextInterface.php | 1 - UPGRADE.md | 17 +++++++++++++++++ composer.json | 4 ++-- 5 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 UPGRADE.md diff --git a/DependencyInjection/TwoFactorTextExtension.php b/DependencyInjection/TwoFactorTextExtension.php index 36f19d2..ac850e6 100644 --- a/DependencyInjection/TwoFactorTextExtension.php +++ b/DependencyInjection/TwoFactorTextExtension.php @@ -23,7 +23,7 @@ public function load(array $configs, ContainerBuilder $container): void } } - public function getAlias() + public function getAlias(): string { return 'two_factor_text'; } @@ -41,7 +41,7 @@ private function configureTextAuthenticationProvider(ContainerBuilder $container $container->setAlias($this->getAlias() . '.security.auth_code_sender', $config['auth_code_sender']); } - public function prepend(ContainerBuilder $container) + public function prepend(ContainerBuilder $container): void { $configs = $container->getExtensionConfig($this->getAlias()); $config = $this->processConfiguration(new Configuration(), $configs); diff --git a/README.md b/README.md index e147d53..bbbf7a2 100644 --- a/README.md +++ b/README.md @@ -25,20 +25,6 @@ two_factor_text: template: '@SchebTwoFactor/Authentication/form.html.twig' ``` -Upgrade to 2.0 --------------- -There are two main breaking changes to version 2.0: - -- The minimum supported version of PHP is upgraded to 7.4 -- In the AuthCodeTextInterface the calling of the method "sendAuthCode" has changed: - old: sendAuthCode(TwoFactorTextInterface $user, string $format): void; - new: sendAuthCode(TwoFactorTextInterface $user, ?string $code): void; - The format/text will be retrieved by the new public method "getMessageFormat" in this way the sender can also be - used for other messages like a confirmation code. If $code is not passed (null) the old way of getting the code via - the user object can be taken. - Note that the default text as specified in the configuration is still used by the default CodeGenerator, - see the ExampleTextSender for an example. - License ------- This software is available under the [MIT license](LICENSE). diff --git a/TextSender/AuthCodeTextInterface.php b/TextSender/AuthCodeTextInterface.php index 7527a78..0de04c7 100644 --- a/TextSender/AuthCodeTextInterface.php +++ b/TextSender/AuthCodeTextInterface.php @@ -14,7 +14,6 @@ interface AuthCodeTextInterface public function setMessageFormat(string $format): void; public function getMessageFormat(): string; - /** * Send the auth code to the user via text * diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..42f5eac --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,17 @@ +Upgrade to 2.0 +-------------- +There are two main breaking changes to version 2.0: + +- The minimum supported version of PHP is upgraded to 7.4 +- In the AuthCodeTextInterface the calling of the method "sendAuthCode" has changed: + old: sendAuthCode(TwoFactorTextInterface $user, string $format): void; + new: sendAuthCode(TwoFactorTextInterface $user, ?string $code): void; + The format/text will be retrieved by the new public method "getMessageFormat" in this way the sender can also be + used for other messages like a confirmation code. If $code is not passed (null) the old way of getting the code via + the user object can be taken. + Note that the default text as specified in the configuration is still used by the default CodeGenerator, + see the ExampleTextSender for an example. + +Upgrade to 2.1 +-------------- +To upgrade, you only need to have to upgrade PHP to at least 8.0 and use the 6.x version of scheb/2fa \ No newline at end of file diff --git a/composer.json b/composer.json index 55fe742..4edcf0b 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,8 @@ } ], "require": { - "php": ">=7.4", - "scheb/2fa-bundle": "^5.0 || ^6.0" + "php": "^8.0", + "scheb/2fa-bundle": "^6.0" }, "require-dev": { "symfony/http-client": "^5.3 || ^6.0"