Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type changed to *NEVER* #5896

Closed
lulco opened this issue Nov 2, 2021 · 7 comments · Fixed by phpstan/phpstan-src#1504
Closed

Type changed to *NEVER* #5896

lulco opened this issue Nov 2, 2021 · 7 comments · Fixed by phpstan/phpstan-src#1504
Labels
Milestone

Comments

@lulco
Copy link

lulco commented Nov 2, 2021

Bug report

PHPStan changed type from array (in my case array{default?: int}) to *NEVER*. I discover that this behavior was introduced in version 0.12.60 (0.12.59 is OK).

Code snippet that reproduces the problem

https://phpstan.org/r/8851a26d-ccfc-43e2-95b6-acf531da1d09

Expected output

Do not change type to *NEVER*. Let it be as before.

@herndlm
Copy link
Contributor

herndlm commented Nov 2, 2021

But this is correct behaviour in your example, as the path is never executable because the condition will be always false. I suspect this is making a problem somewhere in your code?

@Kocal
Copy link
Contributor

Kocal commented Nov 2, 2021

How $x !== $y can be true if you have $x = $y = ... just before?

@ondrejmirtes
Copy link
Member

It's at least a bit weird because PHPStan should report "always false" for $x !== $y.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Nov 2, 2021
@lulco
Copy link
Author

lulco commented Nov 2, 2021

I've removed parts which do nothing. Here is added some modification for $y https://phpstan.org/r/66f180f1-4352-49a9-9a3d-081f71ee2665

@phpstan-bot
Copy link
Contributor

@lulco After the latest commit in 1.8.x, PHPStan now reports different result with your code snippet:

@@ @@
 19: Dumped type: array{default?: int}
-21: Dumped type: *NEVER*
+21: Dumped type: array{default?: int}
Full report
Line Error
19 Dumped type: array{default?: int}
21 Dumped type: array{default?: int}

@phpstan-bot
Copy link
Contributor

@lulco After the latest commit in 1.8.x, PHPStan now reports different result with your code snippet:

@@ @@
 22: Dumped type: array{default?: int}
-24: Dumped type: *NEVER*
+24: Dumped type: array{default?: int}
Full report
Line Error
22 Dumped type: array{default?: int}
24 Dumped type: array{default?: int}

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants