diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index eeaf12b..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,12 +0,0 @@ -| Q | A -| ---------------- | ----- -| Bug report? | yes/no -| Feature request? | yes/no -| BC Break report? | yes/no -| RFC? | yes/no - - diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md new file mode 100644 index 0000000..085df3a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_Bug_report.md @@ -0,0 +1,22 @@ +--- +name: "\U0001F41B Bug Report" +about: Report errors and problems +title: "[bug] " +labels: Potential Bug +assignees: '' + +--- + +**Version(s) affected**: x.y.z + +**Description** + + +**How to reproduce** + + +**Possible Solution** + + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/2_Feature_request.md b/.github/ISSUE_TEMPLATE/2_Feature_request.md new file mode 100644 index 0000000..c21e708 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_Feature_request.md @@ -0,0 +1,15 @@ +--- +name: "\U0001F680 Feature Request" +about: "I have a suggestion (and may want to implement it \U0001F642)!" +title: "[Feature] " +labels: Feature +assignees: '' + +--- + +**Description** + + +**Example** + diff --git a/.github/ISSUE_TEMPLATE/3_Support_question.md b/.github/ISSUE_TEMPLATE/3_Support_question.md new file mode 100644 index 0000000..71c14bf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3_Support_question.md @@ -0,0 +1,17 @@ +--- +name: 👩‍🏫 Support Question +about: Questions about using this library +labels: Question / Support + +--- + +**Description** + diff --git a/.github/ISSUE_TEMPLATE/4_Security_issue.md b/.github/ISSUE_TEMPLATE/4_Security_issue.md new file mode 100644 index 0000000..56eebe4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4_Security_issue.md @@ -0,0 +1,14 @@ +--- +name: ⛔ Security Issue +about: Report security issues and problems (PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY) + +--- + +⚠ PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, SEE BELOW. + +If you have found a security issue in this library, please send the details +to security [at] rollerscapes.net and don't disclose it publicly until +we can provide a fix for it. + +**Note:** Please don't blindly send reports about automated tools, make sure the +reported issue is in fact exploitable. Thanks. diff --git a/.github/composer-config.json b/.github/composer-config.json new file mode 100644 index 0000000..3cf8468 --- /dev/null +++ b/.github/composer-config.json @@ -0,0 +1,13 @@ +{ + "config": { + "cache-vcs-dir": "/dev/null", + "platform-check": false, + "preferred-install": { + "*": "dist" + }, + "allow-plugins": { + "ergebnis/composer-normalize": true, + "symfony/flex": true + } + } +} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 861ea29..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,157 +0,0 @@ -name: 'CI' - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - cs-fixer: - name: 'PHP CS Fixer' - - runs-on: 'ubuntu-latest' - - strategy: - matrix: - php-version: - - '8.2' - - steps: - - - name: 'Check out' - uses: 'actions/checkout@v4' - - - - name: 'Set up PHP' - uses: 'shivammathur/setup-php@v2' - with: - php-version: '${{ matrix.php-version }}' - coverage: 'none' - - - - name: 'Get Composer cache directory' - id: 'composer-cache' - run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT' - - - - name: 'Cache dependencies' - uses: 'actions/cache@v3' - with: - path: '${{ steps.composer-cache.outputs.cache_dir }}' - key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" - restore-keys: 'php-${{ matrix.php-version }}-composer-locked-' - - - - name: 'Install dependencies' - run: 'composer install --no-progress' - - - - name: 'Check the code style' - run: 'make cs' - - phpstan: - name: 'PhpStan' - - runs-on: 'ubuntu-latest' - - strategy: - matrix: - php-version: - - '8.2' - - steps: - - - name: 'Check out' - uses: 'actions/checkout@v4' - - - - name: 'Set up PHP' - uses: 'shivammathur/setup-php@v2' - with: - php-version: '${{ matrix.php-version }}' - coverage: 'none' - - - - name: 'Get Composer cache directory' - id: 'composer-cache' - run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT' - - - - name: 'Cache dependencies' - uses: 'actions/cache@v3' - with: - path: '${{ steps.composer-cache.outputs.cache_dir }}' - key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" - restore-keys: 'php-${{ matrix.php-version }}-composer-locked-' - - - - name: 'Install dependencies' - run: 'composer install --no-progress' - - - - name: 'Run PhpStan' - run: 'vendor/bin/phpstan analyze --no-progress' - - tests: - name: 'PHPUnit' - - runs-on: 'ubuntu-latest' - - strategy: - matrix: - include: - - - php-version: '8.2' - 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' - - steps: - - - name: 'Check out' - uses: 'actions/checkout@v4' - - - - name: 'Set up PHP' - uses: 'shivammathur/setup-php@v2' - with: - php-version: '${{ matrix.php-version }}' - coverage: 'none' - - - - name: 'Get Composer cache directory' - id: 'composer-cache' - run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT' - - - - name: 'Cache dependencies' - uses: 'actions/cache@v3' - with: - path: '${{ steps.composer-cache.outputs.cache_dir }}' - key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" - restore-keys: 'php-${{ matrix.php-version }}-composer-locked-' - - - - name: 'Install dependencies' - env: - COMPOSER_OPTIONS: '${{ matrix.composer-options }}' - SYMFONY_REQUIRE: '${{ matrix.symfony-version }}' - run: | - composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins symfony/flex - composer update --no-progress $COMPOSER_OPTIONS - - - - name: 'Run tests' - run: make phpunit diff --git a/.github/workflows/composer-validate.yaml b/.github/workflows/composer-validate.yaml new file mode 100644 index 0000000..4eaa602 --- /dev/null +++ b/.github/workflows/composer-validate.yaml @@ -0,0 +1,51 @@ +name: Composer Validate + +on: + push: + paths: + - 'composer.json' + pull_request: + paths: + - 'composer.json' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + composer-sync: + name: 'Composer validation' + runs-on: ubuntu-24.04 + env: + php-version: '8.4' + + steps: + - + name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.php-version }} + ini-values: "memory_limit=-1" + coverage: none + + - + name: Checkout target branch + uses: actions/checkout@v6 + + - + name: 'Install dependencies' + run: | + COMPOSER_HOME="$(composer config home)" + ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" + composer global require -q "ergebnis/composer-normalize" + composer install --no-progress + + - + name: 'Normalized composer.json' + run: | + echo "composer.json" + composer validate + composer normalize diff --git a/.github/workflows/inspector-bot.yaml b/.github/workflows/inspector-bot.yaml new file mode 100644 index 0000000..bfc9091 --- /dev/null +++ b/.github/workflows/inspector-bot.yaml @@ -0,0 +1,16 @@ +name: CS + +on: + pull_request: + +permissions: + contents: read + +jobs: + call-inspector-bot: + name: InspectorBot + uses: rollerscapes/inspector-bot/.github/workflows/inspector-bot.yml@main + with: + package: RollerworksPasswordStrengthBundle + check_license: true + diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml new file mode 100644 index 0000000..6169481 --- /dev/null +++ b/.github/workflows/phpstan.yaml @@ -0,0 +1,62 @@ +name: PHPStan + +on: + pull_request: + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-24.04 + + env: + php-version: '8.2' + steps: + - + name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.php-version }} + ini-values: "memory_limit=-1" + coverage: none + + - + name: Checkout target branch + uses: actions/checkout@v6 + with: + ref: ${{ github.base_ref }} + + - + name: Checkout PR + uses: actions/checkout@v6 + + - + name: Install dependencies + run: | + COMPOSER_HOME="$(composer config home)" + ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" + composer install --no-progress --ansi --no-plugins + + - + name: Generate PHPStan baseline + run: | + git checkout composer.json + git checkout -m ${{ github.base_ref }} + vendor/bin/phpstan analyze --generate-baseline --allow-empty-baseline --no-progress + git checkout -m FETCH_HEAD + + - + name: PHPStan + run: | + vendor/bin/phpstan analyze --no-progress --error-format=github + diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..7ae0e64 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,57 @@ +name: CI +on: + push: + branches: + - '3.x' + pull_request: + branches: + - '3.x' + +jobs: + + test: + + name: 'PHPUnit with PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}' + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - + php-version: '8.2' + composer-options: '--prefer-stable' + symfony-version: '^6.4' + + - + php-version: '8.2' + composer-options: '--prefer-stable' + symfony-version: '^7.0' + steps: + - + name: Checkout + uses: actions/checkout@v6 + + - + name: 'Set up PHP' + uses: 'shivammathur/setup-php@v2' + with: + php-version: '${{ matrix.php-version }}' + coverage: none + env: + update: true + + - + name: 'Install dependencies' + env: + COMPOSER_OPTIONS: '${{ matrix.composer-options }}' + SYMFONY_REQUIRE: '${{ matrix.symfony-version }}' + run: | + rm -f composer.lock + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins symfony/flex + composer update --no-progress --no-interaction --optimize-autoloader $COMPOSER_OPTIONS + + - + name: Run Tests + run: make phpunit diff --git a/composer.json b/composer.json index 898dbb8..a80aebe 100644 --- a/composer.json +++ b/composer.json @@ -20,15 +20,15 @@ } ], "require": { - "php": ">=8.2", + "php": "^8.2", "rollerworks/password-strength-validator": "^2.0", "symfony/framework-bundle": "^6.0 || ^7.0" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^5.0 || ^v4.3.1", + "matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0", "phpunit/phpunit": "^9.5", "rollerscapes/standards": "^1.0", - "symfony/phpunit-bridge": "^6.0 || ^7.0" + "symfony/phpunit-bridge": "^7.4" }, "minimum-stability": "dev", "prefer-stable": true, @@ -52,7 +52,7 @@ }, "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" } } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..aab4991 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,2 @@ +parameters: + ignoreErrors: [] diff --git a/phpstan.neon b/phpstan.neon index d799271..6191b27 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,6 @@ includes: - vendor/rollerscapes/standards/phpstan.neon - #- phpstan-baseline.neon + - phpstan-baseline.neon parameters: #reportUnmatchedIgnoredErrors: false @@ -10,8 +10,6 @@ parameters: - ./src - ./tests excludePaths: - - var/ - - templates/ - - translations/ + - src/Resources #ignoreErrors: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c7d9fc8..23180cc 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,6 +16,8 @@ + + diff --git a/tests/DependencyInjection/ExtensionTest.php b/tests/DependencyInjection/ExtensionTest.php index 90693ce..a19105e 100644 --- a/tests/DependencyInjection/ExtensionTest.php +++ b/tests/DependencyInjection/ExtensionTest.php @@ -19,7 +19,12 @@ use Symfony\Component\Validator\ContainerConstraintValidatorFactory; use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass; -class ExtensionTest extends AbstractExtensionTestCase +/** + * @internal + * + * @group legacy + */ +final class ExtensionTest extends AbstractExtensionTestCase { public function test_password_validators_are_registered() {