fix(phpstan): correct json_decode args and prune stale ignores#8203
Merged
Conversation
…stale ignores - EntrypointAction: drop JSON_ERROR_NONE (wrong constant family for $flags), rely on defaults - ApiTestAssertionsTrait: JSON_THROW_ON_ERROR belongs in $flags, not $depth; use named arg - EloquentResourceCollectionMetadataFactory: filter rules to string-keyed entries before passing to replaceRequiredWithSometimes (Metadata::getRules() returns mixed, is_array narrows to array<int|string, mixed> which loses the expected shape) - ParameterResourceMetadataCollectionFactory: remove obsolete @phpstan-ignore-line - phpstan.neon.dist: drop unmatched getInnermostType ignore pattern
4982a27 to
b83b7d4
Compare
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.
Summary
PHPStan 2.x / Larastan updates surfaced two real arg-position bugs in
json_decodecalls, one type-contract drift on Eloquent rules, and two stale ignores:GraphQl/Action/EntrypointAction:JSON_ERROR_NONE(an error-code constant from thejson_last_error()family, value0) was passed as$flags. Behaviorally a no-op, but semantically wrong. Replaced with default args.Symfony/Bundle/Test/ApiTestAssertionsTrait:JSON_THROW_ON_ERRORwas passed as$depth(3rd positional arg). Used named argflags:to put it in the correct slot while keeping the default$depthof512.Laravel/Eloquent/Metadata/Factory/Resource/EloquentResourceCollectionMetadataFactory:Metadata::getRules()returnsmixed; afteris_array, PHPStan narrows toarray<int|string, mixed>, losing the expectedarray<string, ...>shape required byreplaceRequiredWithSometimes. Filter to string-keyed entries explicitly at the call site so the contract holds for both PHPStan and runtime (Laravel rules with non-string keys would silently break).Metadata/Resource/Factory/ParameterResourceMetadataCollectionFactory: removed an obsolete@phpstan-ignore-linethat no longer matches any reported error.phpstan.neon.dist: dropped one unmatched ignore pattern (getInnermostType).Test plan
vendor/bin/phpstan analyse→[OK] No errorscd src/Laravel && ./vendor/bin/phpstan analyse→[OK] No errors