File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 "require" : {
2323 "php" : " ^8.2" ,
2424 "rollerworks/password-strength-validator" : " ^2.0" ,
25- "symfony/framework-bundle" : " ^6.0 || ^7.0"
25+ "symfony/framework-bundle" : " ^6.4 || ^7.0 || ^8 .0"
2626 },
2727 "require-dev" : {
28- "matthiasnoback/symfony-dependency-injection-test" : " ^4.3.1 || ^5.0" ,
29- "phpunit/phpunit" : " ^9.5" ,
28+ "matthiasnoback/symfony-dependency-injection-test" : " ^4.3.1 || ^5.0 || ^6.2 " ,
29+ "phpunit/phpunit" : " ^9.5 || ^10.0 " ,
3030 "rollerscapes/standards" : " ^1.0" ,
31- "symfony/phpunit-bridge" : " ^7.4"
31+ "symfony/phpunit-bridge" : " ^7.4 || ^8.0 "
3232 },
3333 "minimum-stability" : " dev" ,
3434 "prefer-stable" : true ,
Original file line number Diff line number Diff line change 1616use Symfony \Component \DependencyInjection \ContainerBuilder ;
1717use Symfony \Component \DependencyInjection \Extension \Extension ;
1818use Symfony \Component \DependencyInjection \Extension \PrependExtensionInterface ;
19- use Symfony \Component \DependencyInjection \Loader ;
19+ use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
20+ use Symfony \Component \DependencyInjection \Loader \XmlFileLoader ;
2021
2122final class RollerworksPasswordStrengthExtension extends Extension implements PrependExtensionInterface
2223{
2324 public function load (array $ configs , ContainerBuilder $ container ): void
2425 {
25- $ loader = new Loader \XmlFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
26- $ loader ->load ('strength_validator.xml ' );
26+ if (class_exists (XmlFileLoader::class)) {
27+ $ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
28+ $ loader ->load ('strength_validator.xml ' );
29+ } else {
30+ $ loader = new PhpFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
31+ $ loader ->load ('strength_validator.php ' );
32+ }
2733 }
2834
2935 public function prepend (ContainerBuilder $ container ): void
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /*
6+ * This file is part of the RollerworksPasswordStrengthBundle package.
7+ *
8+ * (c) Sebastiaan Stok <s.stok@rollerscapes.net>
9+ *
10+ * This source file is subject to the MIT license that is bundled
11+ * with this source code in the file LICENSE.
12+ */
13+
14+ use Rollerworks \Component \PasswordStrength \Validator \Constraints \PasswordStrengthValidator ;
15+ use Symfony \Component \DependencyInjection \Loader \Configurator \ContainerConfigurator ;
16+ use function Symfony \Component \DependencyInjection \Loader \Configurator \service ;
17+
18+ return static function (ContainerConfigurator $ container ): void {
19+ $ di = $ container ->services ();
20+
21+ $ di ->set (PasswordStrengthValidator::class)
22+ ->args ([service ('translator ' )->nullOnInvalid ()])
23+ ->tag ('validator.constraint_validator ' );
24+ };
25+
You can’t perform that action at this time.
0 commit comments