Skip to content

Commit

Permalink
Fixes to real support Symfony 6 with PHP 8; also scheb/2fa-bundle 6.0…
Browse files Browse the repository at this point in the history
… must be used
  • Loading branch information
erkens committed Feb 22, 2022
1 parent f1b27f8 commit d6228ab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions DependencyInjection/TwoFactorTextExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function load(array $configs, ContainerBuilder $container): void
}
}

public function getAlias()
public function getAlias(): string
{
return 'two_factor_text';
}
Expand All @@ -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);
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
1 change: 0 additions & 1 deletion TextSender/AuthCodeTextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
17 changes: 17 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit d6228ab

Please sign in to comment.