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

no good prediction on whetter a variable can not be null #4733

Closed
thepercival opened this issue Mar 22, 2021 · 4 comments
Closed

no good prediction on whetter a variable can not be null #4733

thepercival opened this issue Mar 22, 2021 · 4 comments

Comments

@thepercival
Copy link

thepercival commented Mar 22, 2021

Bug report

The code snippets of psalm and phpstan latest version with php 8

Code snippet that reproduces the problem

https://phpstan.org/r/0d833a50-4967-4faf-941f-007bd8e6736e
in psalm no problem
https://psalm.dev/r/aec4bc6fc7

Expected output

OK

@phpstan-bot
Copy link
Contributor

@thepercival After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-PHP 8.0 (1 error)
+PHP 8.0
 ==========
 
-14: Cannot call method __toString() on Stringable|null.
+No errors
 
 PHP 7.1 – 7.4 (3 errors)
 ==========
Full report

PHP 8.0

No errors

PHP 7.1 – 7.4 (3 errors)

Line Error
5 Method HelloWorld::getDescription() uses native union types but they're supported only on PHP 8.0 and later.
5 Parameter $someObject of method HelloWorld::getDescription() has invalid typehint type stringable.
14 Call to method __toString() on an unknown class stringable.

@thepercival
Copy link
Author

Great! Thanks a lot. Also for making this great tool available

@ondrejmirtes
Copy link
Member

Thanks :) Fixed: phpstan/phpstan-src@2c42ef1

@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 Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants