Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.2'
- '8.4'

steps:
-
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:

-
name: 'Install dependencies'
run: 'composer install --no-progress'
run: 'composer update --no-progress --prefer-stable'

-
name: 'Check the code style'
Expand All @@ -60,7 +60,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.2'
- '8.4'

steps:
-
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:

-
name: 'Install dependencies'
run: 'composer install --no-progress'
run: 'composer update --no-progress --prefer-stable'

-
name: 'Run PhpStan'
Expand All @@ -104,18 +104,9 @@ jobs:
matrix:
include:
-
php-version: '8.2'
php-version: '8.4'
composer-options: '--prefer-stable'
symfony-version: '6.3'
-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^6.4'

-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^7.0'
symfony-version: '^8.0'

steps:
-
Expand Down Expand Up @@ -154,4 +145,5 @@ jobs:

-
name: 'Run tests'
run: make phpunit
run: |
vendor/bin/phpunit
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ composer.lock
/vendor/

phpunit.xml
.phpunit.result.cache
.phpunit.cache/
.phpunit

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ Otherwise enable the `Rollerworks\Bundle\PasswordStrengthBundle\RollerworksPassw

## Requirements

You need at least PHP PHP 8.2, mbstring is recommended but not required, and at least Symfony 6.
You need at least PHP PHP 8.4 and Symfony 8, mbstring is recommended but not required.

> [!NOTE]
>
> This package requires PHP 8.4 or higher and Symfony 8 or higher.
>
> If you need support for older Symfony versions, use the [3.x branch](https://github.com/rollerworks/PasswordStrengthBundle/tree/3.x).

## Basic Usage

Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
UPGRADE
=======

From 3.x to 4.0
---------------

* Support for Symfony 6 and 7 was removed, PHP 8.4 and Symfony 8.0 is now the minimum required version.

* The constructor of password constraints has changed, see (Upgrade instructions of the validator library)[https://github.com/rollerworks/PasswordStrengthValidator/blob/main/UPGRADE.md]

From 2.x to 3.0
---------------

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
}
],
"require": {
"php": ">=8.2",
"rollerworks/password-strength-validator": "^2.0",
"symfony/framework-bundle": "^6.0 || ^7.0"
"php": ">=8.4",
"rollerworks/password-strength-validator": "^3.0",
"symfony/framework-bundle": "^8.0"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^5.0 || ^v4.3.1",
"phpunit/phpunit": "^9.5",
"matthiasnoback/symfony-dependency-injection-test": "^6.2",
"phpunit/phpunit": "^12.4",
"rollerscapes/standards": "^1.0",
"symfony/phpunit-bridge": "^6.0 || ^7.0"
"symfony/phpunit-bridge": "^8.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -52,7 +52,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "3.0-dev"
"dev-main": "4.0-dev"
}
}
}
26 changes: 16 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
backupGlobals="false"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.4/phpunit.xsd"
bootstrap="vendor/autoload.php"
beStrictAboutTestsThatDoNotTestAnything="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnWarning="true"
colors="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1"/>
Expand All @@ -16,6 +17,8 @@
<ini name="intl.error_level" value="0"/>
<ini name="memory_limit" value="-1"/>
<ini name="default_charset" value="UTF-8"/>

<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
</php>

<testsuites>
Expand All @@ -24,13 +27,16 @@
</testsuite>
</testsuites>

<coverage>
<coverage />

<source>
<include>
<directory>./src</directory>
<directory>src/</directory>
</include>
<exclude>
<directory>./vendor/</directory>
<directory>./tests/</directory>
<directory>src/Resources/</directory>
<directory>vendor/</directory>
<directory>tests/</directory>
</exclude>
</coverage>
</source>
</phpunit>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the RollerworksPasswordStrengthBundle package.
*
Expand All @@ -16,14 +18,14 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

final class RollerworksPasswordStrengthExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('strength_validator.xml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('strength_validator.php');
}

public function prepend(ContainerBuilder $container): void
Expand Down
24 changes: 24 additions & 0 deletions src/Resources/config/strength_validator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/*
* This file is part of the RollerworksPasswordStrengthBundle package.
*
* (c) Sebastiaan Stok <s.stok@rollerscapes.net>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

use Rollerworks\Component\PasswordStrength\Validator\Constraints\PasswordStrengthValidator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $container): void {
$di = $container->services();

$di->set(PasswordStrengthValidator::class)
->args([service('translator')->nullOnInvalid()])
->tag('validator.constraint_validator');
};
18 changes: 0 additions & 18 deletions src/Resources/config/strength_validator.xml

This file was deleted.

6 changes: 5 additions & 1 deletion src/RollerworksPasswordStrengthBundle.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the RollerworksPasswordStrengthBundle package.
*
Expand All @@ -13,4 +15,6 @@

use Symfony\Component\HttpKernel\Bundle\Bundle;

final class RollerworksPasswordStrengthBundle extends Bundle {}
final class RollerworksPasswordStrengthBundle extends Bundle
{
}
9 changes: 7 additions & 2 deletions tests/DependencyInjection/ExtensionTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the RollerworksPasswordStrengthBundle package.
*
Expand All @@ -19,7 +21,10 @@
use Symfony\Component\Validator\ContainerConstraintValidatorFactory;
use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;

class ExtensionTest extends AbstractExtensionTestCase
/**
* @internal
*/
final class ExtensionTest extends AbstractExtensionTestCase
{
public function test_password_validators_are_registered()
{
Expand All @@ -34,7 +39,7 @@ public function test_password_validators_are_registered()
/** @var ContainerConstraintValidatorFactory $factory */
$factory = $this->container->get('validator.validator_factory');

self::assertInstanceOf(PasswordStrengthValidator::class, $factory->getInstance(new PasswordStrength(['minStrength' => 1])));
self::assertInstanceOf(PasswordStrengthValidator::class, $factory->getInstance(new PasswordStrength(minStrength: 1)));
}

protected function getContainerExtensions(): array
Expand Down