Skip to content

Conversation

arnaud-lb
Copy link
Contributor

This adds rules to check passing variant template types in incompatible positions. Specifically, this is checked in parameter types, return types, and @extends/@implements types.

A template-covariant template type can only be used in a covariant position: As return type, or where a template type parameter is covariant itself, with some twists.

@arnaud-lb arnaud-lb force-pushed the variance-rules branch 3 times, most recently from d29845f to d0f31f7 Compare November 21, 2019 08:49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't a test for this message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistence in/of:

in extended type %%s in class %s. 

vs.

in implemented type %%s of class %s. 
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there's no test for this message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is missing a unit test: FunctionSignatureVarianceRuleTest

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not unit test for this rule: MethodSignatureVarianceRuleTest

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing . at the end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this method does? Also, is there any advantage in iterable over array? Other methods use arrays mainly...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found yield very handy in this case, as I didn't had to array_merge everything. I'm rewriting to use arrays instead, for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also changed the name and added some doc

@ondrejmirtes ondrejmirtes merged commit db5ab57 into phpstan:master Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants