Skip to content

Laravel 12 support #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 26, 2025
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
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ 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
id: php-version
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
id: laravel-version
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
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
9 changes: 6 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions src/Commands/MakeSpecificationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
)]
final class MakeSpecificationCommand extends GeneratorCommand
{
/**
* @var string
*/
protected $type = 'Specification';

#[Override]
Expand All @@ -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);
}

/**
Expand All @@ -49,6 +46,7 @@ protected function getDefaultNamespace(mixed $rootNamespace): string
#[Override]
protected function buildClass(mixed $name): string
{
/** @var array<string, string> $replacements */
$replacements = [
'{{ candidate }}' => $this->option('candidate'),
];
Expand Down
14 changes: 2 additions & 12 deletions src/HasSpecifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,18 @@
trait HasSpecifications
{
/**
* @param Specification<self> $specification
* @param Specification<self> $specification
*/
public function satisfies(Specification $specification): bool
{
return $specification->isSatisfiedBy($this);
}

/**
* @param Specification<self> $specification
* @param Specification<self> $specification
*/
public function dissatisfies(Specification $specification): bool
{
return (new NotSpecification($specification))->isSatisfiedBy($this);
}

/**
* @deprecated use `satisfies()` instead
*
* @param Specification<self> $specification
*/
public function meets(Specification $specification): bool
{
return $this->satisfies($specification);
}
}
1 change: 1 addition & 0 deletions tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}