Fix PHPStan CI by restoring Larastan on the PHPStan 2 / Laravel 12 stack#255
Closed
freekmurze wants to merge 1 commit into
Closed
Fix PHPStan CI by restoring Larastan on the PHPStan 2 / Laravel 12 stack#255freekmurze wants to merge 1 commit into
freekmurze wants to merge 1 commit into
Conversation
main was left mid-upgrade: Larastan was dropped from require-dev (it was incompatible with Laravel 12) but phpstan.neon.dist still referenced its checkOctaneCompatibility and checkModelProperties options, so PHPStan failed to even load its config. Restore Larastan on the modern stack (larastan ^3.0, which supports Laravel 11.44+/12.4+ on PHPStan 2.x) and bump the phpstan extension packages to ^2.0 accordingly. Replace the removed checkMissingIterableValueType option, and point Larastan's noEnvCallsOutsideOfConfig rule at the package's own config directory so the idiomatic env() call in config/webhook-client.php is not flagged. PHPStan and the full test suite pass locally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
|
Closing: this was based on a stale local checkout. The PHPStan config error it addresses was already fixed on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PHPStan CI on
mainis red.mainwas left in a mid-upgrade state: Larastan was dropped fromrequire-dev(it was incompatible with Laravel 12), butphpstan.neon.diststill referenced Larastan-only options:So PHPStan failed to even load its config. Simply removing those options isn't enough either: without Larastan, PHPStan no longer understands Eloquent's magic statics and reports false positives (
Call to an undefined static method ...::create(),::where(), and@mixin \Eloquentunknown class).Fix
Restore Larastan on the modern stack:
larastan/larastan: ^3.0torequire-dev. Larastan 3 supports Laravel 11.44+/12.4+ on PHPStan 2.x (Larastan 2 was the version that couldn't install on Laravel 12, which is why it was dropped).phpstan/phpstan-deprecation-rulesandphpstan/phpstan-phpunitto^2.0to match PHPStan 2.phpstan.neon.dist: dropcheckMissingIterableValueType(removed in PHPStan 2; not needed at level 5) and point Larastan'snoEnvCallsOutsideOfConfigrule at the package's ownconfigdirectory viaconfigDirectories, so the idiomaticenv()call inconfig/webhook-client.phpisn't flagged.Verification
Locally on PHP
Parse error: syntax error, unexpected token "" in Command line code on line 1:
vendor/bin/phpstan analyse→[OK] No errorsvendor/bin/pest→ 28 passedThe matrix (PHP 8.3 to 8.5 x Laravel 11/12) all satisfy Larastan 3's requirements (PHP ^8.2, illuminate ^11.44.2 || ^12.4.1).