Merged
Conversation
step-25 requires docblock element-type inference to work on the nine callable-, member-, and constant-shaped expression node kinds the same way it works on $this->items(). The data provider names each kind so the next commit's refactor is verified against a fixed list. Currently red for StaticCall, StaticPropertyFetch, ClassConstFetch, and ConstFetch; the other five already resolve. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
php-parser attaches doc comments to the outer statement — Stmt\Const_ for a const declarator, Stmt\Expression for a define() call — so a declarator or expression asked directly for its own comment reads null. Every global constant built through fromGlobalDeclaration lost its docblock silently because of this. Consulting the parent first, then the node itself, is what lets @var docblock inference resolve foreach over a global constant. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Description-only stripping loses the @var, @return, and @phpstan-* tags that arrayElementType — the next commit's foreach inference — reads. The raw docblock is what every ResolvedSymbol consumer that infers types needs, so getDocumentation is the raw text now. Description-stripping for display is where the step-30 presenter lands; the disallow rule on this method already anticipates that landing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
docblockForExpression branched on MethodCall/PropertyFetch/FuncCall by hand — five node kinds covered, four (StaticCall, StaticPropertyFetch, ClassConstFetch, ConstFetch) silently absent. Every ResolvedSymbol now answers the raw docblock through getDocumentation(), so foreachElementType routes through one resolve() call and every node kind resolve() answers participates uniformly. The wrapper is deleted; the disallow on ResolvedSymbol::getDocumentation() gains one src entry — the inference caller — with the display presenter tracked by step-30 still to come. The fixture's ConstFetch case names the constant with a leading backslash because resolveConstFetch does not yet apply PHP's namespaced-first, global-fallback rule (build-manifest step-28); the bare name would look up FOREACH_USER_CONSTANT rather than Fixtures\Hover\FOREACH_USER_CONSTANT. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #480 +/- ##
============================================
+ Coverage 99.35% 99.39% +0.03%
+ Complexity 1873 1863 -10
============================================
Files 132 132
Lines 4805 4789 -16
============================================
- Hits 4774 4760 -14
+ Misses 31 29 -2 ☔ View full report in Codecov by Harness. |
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.
step-25 acceptance
resolve()?->getDocumentation(). Proof:grep docblockForExpression src testsreturns nothing;src/Resolution/ExpressionResolver.phpline ~238.@return list<T>and@vardocblock inference works onFuncCall,MethodCall,NullsafeMethodCall,StaticCall,PropertyFetch,NullsafePropertyFetch,StaticPropertyFetch,ClassConstFetch, andConstFetchthe same way it works on$this->items(). Proof:HoverHandlerTest::testForeachElementTypeIsResolvedFromEveryNodeKind— data-provider with one row per node kind.Design notes
ResolvedSymbol::getDocumentation()returns the raw docblock now. The tag-stripping used to sit inHasSymbolLocation; foreach element-type inference needs@var/@return/@phpstan-*tags intact. Description-only formatting for hover, signature help, and completion detail is where the step-30 presenter lands — the existing disallow ongetDocumentation()already points at it. Between now and then, hover markup will include@taglines verbatim.getDocumentationallowIn:src/Resolution/ExpressionResolver.php— the inference call this step introduces. Authorized loosen.ConstantInfo::fromGlobalDeclarationwas silently reading a null docblock for everyconstdeclarator anddefine()call. php-parser attaches the doc comment to the outerStmt, not to the declarator/expression. Fixed to consult the parent first — required for theConstFetchcase of the acceptance clause above.ConstFetchuses a leading-backslash reference becauseresolveConstFetchdoes not yet apply PHP's namespaced-first, global-fallback rule (that's step-28).🤖 Written by AI, reviewed by human.