diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 190b4da..2afc6ca 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -15,13 +15,14 @@ jobs: - ubuntu-latest php: - - "8.1" - "8.2" - "8.3" + - "8.4" + - "8.5" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -41,7 +42,6 @@ jobs: key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: | php${{ matrix.php }}-composer- - - name: Install dependencies with composer run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi @@ -49,6 +49,6 @@ jobs: run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml - name: Send code coverage report to Codecov.io - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..26c5802 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,11 @@ +name: "Continuous Integration" + +on: + pull_request: + push: + branches: + tags: + +jobs: + ci: + uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x diff --git a/.github/workflows/cs-tests.yml b/.github/workflows/cs-tests.yml deleted file mode 100644 index e8bbade..0000000 --- a/.github/workflows/cs-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: - - push - -name: Run phpcs checks - -jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - "8.1" - - "8.2" - - "8.3" - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - tools: composer:v2, cs2pr - coverage: none - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v3 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - name: Install dependencies with composer - run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run phpcs checks - run: vendor/bin/phpcs diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index b592a19..9976515 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,11 +1,11 @@ on: - push -name: Run static analysis +name: Run PHPStan checks jobs: mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} + name: PHPStan ${{ matrix.php }}-${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -15,33 +15,36 @@ jobs: - ubuntu-latest php: - - "8.1" - "8.2" - "8.3" + - "8.4" + - "8.5" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: php-version: "${{ matrix.php }}" + coverage: pcov + ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On tools: composer:v2, cs2pr - coverage: none - name: Determine composer cache directory run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache dependencies installed with composer - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: | - php${{ matrix.php }}-composer- + php${{ matrix.php }}-composer- + - name: Install dependencies with composer run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - name: Run static analysis - run: vendor/bin/psalm --no-cache --output-format=github --show-info=false --threads=4 + - name: Run static analysis with PHPStan + run: vendor/bin/phpstan analyse diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml deleted file mode 100644 index 8f6f990..0000000 --- a/.github/workflows/unit-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: - - push - -name: Run PHPUnit tests - -jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - "8.1" - - "8.2" - - "8.3" - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - tools: composer:v2, cs2pr - coverage: none - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v3 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - name: Install dependencies with composer - run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run PHPUnit tests - run: vendor/bin/phpunit --colors=always diff --git a/.laminas-ci.json b/.laminas-ci.json new file mode 100644 index 0000000..29216fa --- /dev/null +++ b/.laminas-ci.json @@ -0,0 +1,3 @@ +{ + "backwardCompatibilityCheck": true +} diff --git a/README.md b/README.md index 838fa65..9362e65 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ # dot-form -> [!IMPORTANT] +Dotkernel form component extending and customizing [laminas-form](https://github.com/laminas/laminas-form) + > dot-form is a wrapper on top of [laminas/laminas-form](https://github.com/laminas/laminas-form) -> -> ![OSS Lifecycle](https://img.shields.io/osslifecycle/laminas/laminas-form) -> ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Flaminas%2Flaminas-form%2Fproperties%2Fvalues&query=%24%5B%3F(%40.property_name%3D%3D%22maintenance-mode%22)%5D.value&label=Maintenance%20Mode) -DotKernel form component extending and customizing [laminas-form](https://github.com/laminas/laminas-form) +## Documentation + +Documentation is available at: https://docs.dotkernel.org/dot-form/. + +## Badges ![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-form) -![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-form/4.2.3) +![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-form/4.3.0) [![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-form)](https://github.com/dotkernel/dot-form/issues) [![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-form)](https://github.com/dotkernel/dot-form/network) @@ -18,5 +20,4 @@ DotKernel form component extending and customizing [laminas-form](https://github [![Build Static](https://github.com/dotkernel/dot-form/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-form/actions/workflows/static-analysis.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-form/graph/badge.svg?token=0U6DM2J7SG)](https://codecov.io/gh/dotkernel/dot-form) - -[![SymfonyInsight](https://insight.symfony.com/projects/370a5200-2e49-47da-9988-8e1de8f49502/big.svg)](https://insight.symfony.com/projects/370a5200-2e49-47da-9988-8e1de8f49502) +[![PHPStan](https://github.com/dotkernel/dot-form/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-form/actions/workflows/static-analysis.yml) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..0533b74 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,29 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | PHP Version | +|---------|--------------------|----------------------------------------------------------------------------------------------------------| +| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-form/4.3.0) | +| <= 3.x | :x: | | + +## Reporting Potential Security Issues + +If you have encountered a potential security vulnerability in this project, please report it to us at . +We will work with you to verify the vulnerability and patch it. + +When reporting issues, please provide the following information: + +- Component(s) affected +- A description indicating how to reproduce the issue +- A summary of the security vulnerability and impact + +We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure; +this helps protect the project's users and provides them with a chance to upgrade and/or update to protect their applications. + +## Policy + +If we verify a reported security vulnerability, our policy is: + +- We will patch the current release branch, as well as the immediate prior minor release branch. +- After patching the release branches, we will immediately issue new security fix releases for each patched release branch. diff --git a/composer.json b/composer.json index 30264e5..26c21a9 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "dotkernel/dot-form", "type": "library", - "description": "DotKernel form component extending and customizing laminas-form", + "description": "Dotkernel form component extending and customizing laminas-form", "license": "MIT", "homepage": "https://github.com/dotkernel/dot-form", "keywords": [ @@ -13,19 +13,20 @@ ], "authors": [ { - "name": "DotKernel Team", + "name": "Dotkernel Team", "email": "team@dotkernel.com" } ], "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "laminas/laminas-servicemanager": "^3.22.1", - "laminas/laminas-form": "^3.17.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "laminas/laminas-form": "^3.17.0", + "laminas/laminas-servicemanager": "^3.22.1" }, "require-dev": { - "phpunit/phpunit": "^10.4.2", - "laminas/laminas-coding-standard": "^2.5.0", - "vimeo/psalm": "^5.16.0" + "laminas/laminas-coding-standard": "^3.0.0", + "phpstan/phpstan": "^2.1.17", + "phpstan/phpstan-phpunit": "^2.0.6", + "phpunit/phpunit": "^10.4.2" }, "autoload": { "psr-4": { @@ -46,12 +47,12 @@ "scripts": { "check": [ "@cs-check", - "@test" + "@test", + "@static-analysis" ], "cs-check": "phpcs", "cs-fix": "phpcbf", - "test": "phpunit --colors=always", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", - "static-analysis": "psalm --shepherd --stats" + "static-analysis": "phpstan analyse --memory-limit 1G", + "test": "phpunit --colors=always" } } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..25743aa --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,12 @@ +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon +parameters: + level: 5 + paths: + - src + - test + treatPhpDocTypesAsCertain: false + ignoreErrors: + - + message: '#Class Dot\\Form\\FormElementManager extends @final class Laminas\\Form\\FormElementManager.#' + path: src/FormElementManager.php diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 2015b2a..0000000 --- a/psalm.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/src/FormElementManager.php b/src/FormElementManager.php index 0ee7e86..4f9cb55 100644 --- a/src/FormElementManager.php +++ b/src/FormElementManager.php @@ -6,9 +6,6 @@ use Laminas\Form\FormElementManager as LaminasFormElementManager; -/** - * @psalm-suppress InvalidExtendClass - */ class FormElementManager extends LaminasFormElementManager { } diff --git a/test/Factory/FormAbstractServiceFactoryTest.php b/test/Factory/FormAbstractServiceFactoryTest.php index 927a0ff..a05ebb0 100644 --- a/test/Factory/FormAbstractServiceFactoryTest.php +++ b/test/Factory/FormAbstractServiceFactoryTest.php @@ -35,7 +35,7 @@ public function setUp(): void public function testClassImplementsAbstractFactoryInterface(): void { - $this->assertInstanceOf(AbstractFactoryInterface::class, $this->subject); + $this->assertContainsOnlyInstancesOf(AbstractFactoryInterface::class, [$this->subject]); } /** diff --git a/test/Factory/FormElementManagerFactoryTest.php b/test/Factory/FormElementManagerFactoryTest.php index e5482d5..90aea87 100644 --- a/test/Factory/FormElementManagerFactoryTest.php +++ b/test/Factory/FormElementManagerFactoryTest.php @@ -30,6 +30,6 @@ public function testInvoke(): void $formElementManagerFactory = (new FormElementManagerFactory())($container); - $this->assertInstanceOf(FormElementManager::class, $formElementManagerFactory); + $this->assertContainsOnlyInstancesOf(FormElementManager::class, [$formElementManagerFactory]); } }