Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jul 15, 2024

@staabm staabm changed the title Ignore non-explicit NEVER in purity check when treatPhpDocTypesAsCertain=false Ignore non-explicit NEVER in purity check Jul 15, 2024
Copy link
Contributor Author

@staabm staabm Jul 15, 2024

Choose a reason for hiding this comment

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

a different way to fix this would be to make NeverType return a different acceptor on getCallableParametersAcceptors when non-explicit

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that would make more sense to me. It's basically never going to be called so a special class instead of TrivialParametersAcceptor would be welcome. It's pure, and probably also returns NeverType?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that would make more sense to me. It's basically never going to be called so a special class instead of TrivialParametersAcceptor would be welcome. It's pure, and probably also returns NeverType?

@ondrejmirtes
Copy link
Member

Well, or NeverType doesn't have to return yes for isCallable, I'm not sure why it does.

@staabm staabm marked this pull request as ready for review July 15, 2024 20:58
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

public function testBug11207b(): void
{
$this->treatPhpDocTypesAsCertain = true;
$this->analyse([__DIR__ . '/data/bug-11207.php'], []);
Copy link
Member

Choose a reason for hiding this comment

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

This kind of pattern is usually done via a dataProvider.

@ondrejmirtes ondrejmirtes merged commit e1f64f2 into phpstan:1.11.x Jul 16, 2024
@ondrejmirtes
Copy link
Member

Thank you.

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

Labels

None yet

3 participants