From b116ec44352a7a054273a01317e2f76751ce6493 Mon Sep 17 00:00:00 2001 From: Maarten Paauw Date: Wed, 26 Feb 2025 11:10:59 +0100 Subject: [PATCH 1/5] feat: add support for Laravel 12 and deprecate PHP 8.1 --- .github/ISSUE_TEMPLATE/bug.yml | 6 ++--- .github/workflows/code-coverage.yml | 2 +- .github/workflows/phpstan.yml | 2 +- .github/workflows/run-tests.yml | 11 ++++----- composer.json | 28 +++++++++++------------ phpstan.neon.dist | 9 +++++--- src/Commands/MakeSpecificationCommand.php | 6 ++--- tests/CollectionTest.php | 1 + 8 files changed, 32 insertions(+), 33 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index e5a9a46..4038887 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -28,7 +28,7 @@ body: attributes: label: Package Version description: What version of our Package are you running? Please be as specific as possible - placeholder: 2.0.0 + placeholder: 3.0.0 validations: required: true - type: input @@ -36,7 +36,7 @@ body: attributes: label: PHP Version description: What version of PHP are you running? Please be as specific as possible - placeholder: 8.3.0 + placeholder: 8.4.0 validations: required: true - type: input @@ -44,7 +44,7 @@ body: attributes: label: Laravel Version description: What version of Laravel are you running? Please be as specific as possible - placeholder: 10.0.0 + placeholder: 12.0.0 validations: required: true - type: dropdown diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index c4f301d..ccab7a3 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo coverage: xdebug diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index f495e76..d5db2f1 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 08d0ab7..952139f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,17 +13,14 @@ jobs: strategy: fail-fast: true matrix: - php: [8.3, 8.2, 8.1] - laravel: [11.*, 10.*] + php: [8.4, 8.3, 8.2] + laravel: [12.*, 11.*] stability: [prefer-lowest, prefer-stable] include: + - laravel: 12.* + testbench: 10.* - laravel: 11.* testbench: 9.* - - laravel: 10.* - testbench: ^8.14 - exclude: - - laravel: 11.* - php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} diff --git a/composer.json b/composer.json index 015ff0c..00f523a 100644 --- a/composer.json +++ b/composer.json @@ -16,26 +16,26 @@ } ], "require": { - "php": "^8.1", - "illuminate/console": "^10.0|^11.0", - "illuminate/support": "^10.0|^11.0", + "php": "^8.2", + "illuminate/console": "^11.0|^12.0", + "illuminate/support": "^11.0|^12.0", "spatie/laravel-package-tools": "^1.16.2", "symfony/polyfill-php83": "^1.30", "webmozart/assert": "^1.11" }, "require-dev": { - "illuminate/testing": "^10.0|^11.0", - "larastan/larastan": "^2.8", + "illuminate/testing": "^11.0|^12.0", + "larastan/larastan": "^2.9|^3.0", "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.8|^8.1", - "orchestra/testbench": "^8.8|^9.0", - "pestphp/pest": "^2.20", - "pestphp/pest-plugin-arch": "^2.5", - "pestphp/pest-plugin-laravel": "^2.2", - "pestphp/pest-plugin-type-coverage": "^2.8", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", + "nunomaduro/collision": "^v7.11|^8.1", + "orchestra/testbench": "^v9.11|^10.0", + "pestphp/pest": "^3.0", + "pestphp/pest-plugin-arch": "^v3.0", + "pestphp/pest-plugin-laravel": "^v2.4|^v3.0", + "pestphp/pest-plugin-type-coverage": "^3.0", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", "spatie/laravel-ray": "^1.35", "spatie/phpunit-snapshot-assertions": "^5.1" }, diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d17561a..7ef1f52 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -8,7 +8,10 @@ parameters: - src - tests tmpDir: build/phpstan - checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false - + checkOctaneCompatibility: true + treatPhpDocTypesAsCertain: false + ignoreErrors: + - + identifier: trait.unused + path: src/HasSpecifications.php diff --git a/src/Commands/MakeSpecificationCommand.php b/src/Commands/MakeSpecificationCommand.php index e19d01d..fcd3939 100644 --- a/src/Commands/MakeSpecificationCommand.php +++ b/src/Commands/MakeSpecificationCommand.php @@ -15,9 +15,6 @@ )] final class MakeSpecificationCommand extends GeneratorCommand { - /** - * @var string - */ protected $type = 'Specification'; #[Override] @@ -40,7 +37,7 @@ protected function getStub(): string #[Override] protected function getDefaultNamespace(mixed $rootNamespace): string { - return sprintf('%s\Specifications', $rootNamespace); + return \sprintf('%s\Specifications', $rootNamespace); } /** @@ -49,6 +46,7 @@ protected function getDefaultNamespace(mixed $rootNamespace): string #[Override] protected function buildClass(mixed $name): string { + /** @var array $replacements */ $replacements = [ '{{ candidate }}' => $this->option('candidate'), ]; diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index bc59f76..f0f08f0 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -27,6 +27,7 @@ public function test_it_should_filter_the_collection_based_on_the_given_specific $result = $collection->matching(new UppercaseSpecification()); // Assert + $this->assertInstanceOf(Collection::class, $result); $this->assertCount(1, $result); } } From c33b4a319a3eab55a7ff3c3fc54d9faddc84844e Mon Sep 17 00:00:00 2001 From: Maarten Paauw Date: Wed, 26 Feb 2025 11:11:34 +0100 Subject: [PATCH 2/5] fix: typo in issue template --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 430bf66..256726d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -11,4 +11,4 @@ contact_links: about: Learn how to notify us for sensitive bugs - name: Report a bug url: https://github.com/maartenpaauw/laravel-specification-pattern/issues/new - about: Report a reproducable bug + about: Report a reproducible bug From 434259412a34e3e236e0149313f8f1f7ba633240 Mon Sep 17 00:00:00 2001 From: Maarten Paauw Date: Wed, 26 Feb 2025 11:12:18 +0100 Subject: [PATCH 3/5] feat!: remove deprecated meets method --- src/HasSpecifications.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/HasSpecifications.php b/src/HasSpecifications.php index 3023f30..7edf1bc 100644 --- a/src/HasSpecifications.php +++ b/src/HasSpecifications.php @@ -21,14 +21,4 @@ public function dissatisfies(Specification $specification): bool { return (new NotSpecification($specification))->isSatisfiedBy($this); } - - /** - * @deprecated use `satisfies()` instead - * - * @param Specification $specification - */ - public function meets(Specification $specification): bool - { - return $this->satisfies($specification); - } } From 2502f09ab305d237d2e35d190a7a7861e2e0ef1d Mon Sep 17 00:00:00 2001 From: Maarten Paauw Date: Wed, 26 Feb 2025 11:12:49 +0100 Subject: [PATCH 4/5] style: align docblock --- src/HasSpecifications.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/HasSpecifications.php b/src/HasSpecifications.php index 7edf1bc..4f71f34 100644 --- a/src/HasSpecifications.php +++ b/src/HasSpecifications.php @@ -7,7 +7,7 @@ trait HasSpecifications { /** - * @param Specification $specification + * @param Specification $specification */ public function satisfies(Specification $specification): bool { @@ -15,7 +15,7 @@ public function satisfies(Specification $specification): bool } /** - * @param Specification $specification + * @param Specification $specification */ public function dissatisfies(Specification $specification): bool { From 8f6e274fe53ddaa13c1cd3ac85713b8095ad9d5d Mon Sep 17 00:00:00 2001 From: Maarten Paauw Date: Wed, 26 Feb 2025 11:15:53 +0100 Subject: [PATCH 5/5] docs: update changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4376e9..12c29d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to `laravel-specification-pattern` will be documented in this file. +## [v3.0.0] - 2025-02-26 + +### Added + +- Support for Laravel 12. + +### Removed + +- Deprecated `meets` method. +- Support for Laravel 10. +- Support for PHP 8.1. + ## [v2.8.0] - 2024-11-21 ### Added @@ -88,6 +100,7 @@ All notable changes to `laravel-specification-pattern` will be documented in thi - initial release +[v3.0.0]: https://github.com/maartenpaauw/laravel-specification-pattern/compare/v2.8.0...v3.0.0 [v2.8.0]: https://github.com/maartenpaauw/laravel-specification-pattern/compare/v2.7.0...v2.8.0 [v2.7.0]: https://github.com/maartenpaauw/laravel-specification-pattern/compare/v2.6.0...v2.7.0 [v2.6.0]: https://github.com/maartenpaauw/laravel-specification-pattern/compare/v2.5.0...v2.6.0