Skip to content

Add Laravel 13 support and migrate to PHPStan 2#5

Merged
soymgomez merged 1 commit into
mainfrom
feature/laravel-13-support
May 27, 2026
Merged

Add Laravel 13 support and migrate to PHPStan 2#5
soymgomez merged 1 commit into
mainfrom
feature/laravel-13-support

Conversation

@soymgomez
Copy link
Copy Markdown
Member

Summary

Adds Laravel 13 compatibility, ensures the package works on PHP 8.3 and 8.4, and migrates static analysis to PHPStan 2.

Dependencies (composer.json)

  • illuminate/macroable: ^11.0|^12.0^11.0|^12.0|^13.0 (Laravel 13)
  • phpunit/phpunit: ^10.0|^11.0^10.0|^11.0|^12.0 (Laravel 13 projects commonly use PHPUnit 12)
  • phpstan/phpstan: ^1.8^2.0
  • php kept at ^8.2; symfony/dom-crawler kept at ^6.1|^7.0

CI

  • Added 12.* to the PHPUnit matrix in run-tests.yml, excluding PHP 8.2 + PHPUnit 12 (PHPUnit 12 requires PHP ≥ 8.3).

PHPStan 2 migration

Fixed the two stricter findings in code (no baseline added):

  • Robots.php — the array<Robots::*> PHPDoc claimed no falsy values, flagging array_filter as a no-op. The real type from explode() is array<string> (empty strings the filter legitimately removes).
  • HTMLParser.php — removed a now-unnecessary @phpstan-ignore; tightening the param PHPDoc to string|array<string>|null lets the template resolve cleanly.

Decisions

  • PHP min stays ^8.2: the package only depends on illuminate/macroable (not the full framework), so it keeps Laravel 11/12 + PHP 8.2 compatibility. Laravel 13 already enforces PHP 8.3 via its own constraint.
  • symfony/dom-crawler not bumped to ^8.0: v8 is beta and requires PHP ≥ 8.4.1, which would break PHP 8.3. ^7.0 already works with Laravel 13.
  • Larastan not added: the code uses no Laravel-specific features (Eloquent, facades, container) — only DomCrawler and the Macroable trait — so it would add no value while pulling in heavy dependencies.

Verification

Locally on PHP 8.3: PHPStan 2 reports no errors, Pint passes, and all 32 tests (118 assertions) pass against illuminate/macroable v13 + PHPUnit 12.

Add illuminate/macroable ^13 and PHPUnit ^12 to supported ranges, and
extend the CI matrix accordingly (PHP 8.2 excluded from PHPUnit 12).
Migrate to PHPStan 2.0, fixing two stricter findings in Robots and
HTMLParser and removing a now-unnecessary inline ignore.

Changelog: added
@soymgomez soymgomez merged commit 5d89900 into main May 27, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant