Skip to content

Add generic template to same param-return union method - #1077

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-generic-template-methods
Oct 12, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-generic-template-methods

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Satisfies the new PreferGenericTemplateOnSameUnionTypeRule (symplify/phpstan-rules).

MessengerHelper::addAttribute() takes a Class_|ClassMethod param and returns the same union - it returns the passed node, so a @template generic now narrows the return type to the passed one. Docblock only, no behavior change.

… and return union

The method returns the passed node, so a @template generic narrows the return type to the passed one. Satisfies the new PreferGenericTemplateOnSameUnionTypeRule from symplify/phpstan-rules.
@TomasVotruba
TomasVotruba merged commit f96aa01 into main Oct 12, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the tv-generic-template-methods branch October 12, 2026 10:58
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