Skip to content

Conversation

@rvanvelzen
Copy link
Contributor

Seems to fix phpstan/phpstan#6301. Inferring template types on intersection types is problematic because the bound type may not necessarily be a super type of all sub types of the passed intersection type.

Seems to fix #6301. Inferring template types on intersection types is problematic because the bound type may not necessarily be a super type of all sub types of the passed intersection type
Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

Otherwise 👍

require_once __DIR__ . '/../Rules/Generics/data/bug-3769.php';
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Generics/data/bug-3769.php');

require_once __DIR__ . '/../Rules/Generics/data/bug-6301.php';
Copy link
Member

Choose a reason for hiding this comment

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

No need to require it. If it failed locally for you, you forgot to run composer dump before running the tests :)

@ondrejmirtes ondrejmirtes merged commit c877ec1 into phpstan:1.5.x Mar 22, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@rvanvelzen rvanvelzen deleted the accessory-string-template branch March 22, 2022 07:56
@ondrejmirtes
Copy link
Member

ondrejmirtes commented Mar 22, 2022

BTW @rvanvelzen Can you please send a regression test for phpstan/phpstan#3951 ?

NodeScopeResolverTest case that checks the type of $subject before return is fine. And of course make sure it fails when your fix is reverted :) Thanks.

@ondrejmirtes
Copy link
Member

Sorry, correct link phpstan/phpstan#3951

@ondrejmirtes
Copy link
Member

Oh, there are even more: phpstan/phpstan#6845 and phpstan/phpstan#5336

@staabm
Copy link
Contributor

staabm commented Mar 22, 2022

Fyi, A regression test for phpstan/phpstan#5336
Was already submitted in #1100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

string-accessory types in generics

3 participants