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

Bug: DataList return types do not respect possible null return type #10

Open
mleutenegger opened this issue Jul 19, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@mleutenegger
Copy link
Member

consider the following:

$result = SomeObject::get()->byID(3);

if ($result) { ... }

In this situation, phpstan will fail with an always true boolean expression.

@mleutenegger mleutenegger added the bug Something isn't working label Jul 19, 2022
@JamesDPC
Copy link

@mleutenegger
Copy link
Member Author

mleutenegger commented Apr 29, 2023

@JamesDPC Not sure about that, the mentioned function only tells phpstan that the method is supported, it does not change the type returned. When writing the issue, PHPStan assumed that the return type is always DataObject and not DataObject|null as it should be. I'm unsure wether this issue still persists, will have to recheck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants