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

Assert on var of nullsafe expr #10575

Draft
wants to merge 1 commit into
base: 5.x
Choose a base branch
from
Draft

Assert on var of nullsafe expr #10575

wants to merge 1 commit into from

Conversation

danog
Copy link
Collaborator

@danog danog commented Jan 19, 2024

Fixes #10554

$foo = null;

if ($foo?->check() === null) {
/** @psalm-check-type-exact $foo = null */
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would be curious to see the same test but with check that returns "?bool". Because then you can't infer anything from the nullsafe call

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep my exact thoughts, I still need to finish this PR

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.

If a null-safe method call does not return null, it implies that the object is definitely not null
2 participants