Skip to content

[TypeDeclarationDocblocks] Limit ClassMethodArrayDocblockParamFromLocalCallsRector to private methods - #8442

Merged
TomasVotruba merged 1 commit into
mainfrom
private-only-array-docblock-param
Sep 2, 2026
Merged

[TypeDeclarationDocblocks] Limit ClassMethodArrayDocblockParamFromLocalCallsRector to private methods#8442
TomasVotruba merged 1 commit into
mainfrom
private-only-array-docblock-param

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Restrict ClassMethodArrayDocblockParamFromLocalCallsRector to private methods only.

Only private methods have a closed set of local callers, so the @param array type inferred from local $this->method(...) calls is safe. Public and protected methods can be called from outside the class (child classes, external callers), where the real argument types are unknown, so inferring a narrow type from local calls alone is unsound.

The parent/interface LSP guard and the public mixed[] special case are now dead and removed. Protected/public fixtures are converted to skip fixtures.

https://claude.ai/code/session_01DCgCmqW1U7rcp5nuhXNtaC

…alCallsRector to private methods

Only private methods have a closed set of local callers, so the inferred @PARAM array type is safe. Public and protected methods can be called from outside the class, where the argument types are unknown.

Claude-Session: https://claude.ai/code/session_01DCgCmqW1U7rcp5nuhXNtaC
@TomasVotruba
TomasVotruba merged commit 9d5556c into main Sep 2, 2026
44 checks passed
@TomasVotruba
TomasVotruba deleted the private-only-array-docblock-param branch September 2, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant