Add Docblock Check CI for @param/@return array types - #8469
Open
TomasVotruba wants to merge 1 commit into
Open
Conversation
Runs honestype: instruments src and rules, collects docblock type mismatches while the test suite runs, then lists them PHPStan-style and fails the job when any are found. Also fixes one surfaced mismatch: configure() @PARAM is string[], matching its Assert::allString and list values.
TomasVotruba
force-pushed
the
tv-docblock-check-ci
branch
from
September 8, 2026 16:00
71bc490 to
f3fb844
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.
Adds a CI job that spots inaccurate array docblock types (
Type[],string[], ...) by checking them against real runtime values while the test suite runs.What it does
go installsrcandrules: injects an element-type check for every single-dimension@param T[]/@return T[]fastunitovertests rules-tests utils/phpstan/teststo collect mismatchesInstrumentation is behavior-neutral: calls are guarded with
function_exists, only real arrays are inspected (generators are left untouched), and unresolvable class types (e.g.@templateparams) are skipped. Verified against the full laravel/framework suite with error/failure counts identical to an uninstrumented baseline.Current findings on this codebase
src/PhpParser/NodeTraverser/RectorNodeTraverser.php-@param Node[]/@return Node[]containnullat runtimesrc/PhpParser/Printer/BetterStandardPrinter.php-@param Node[]containsnullsrc/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php-@param Stmt[]contains a nestedarrayThe job reports as warnings and does not fail the build.