Skip to content

Fix containsNull() for union with (null&T of mixed) - #6390

Open
vojtech-dobes wants to merge 1 commit into
phpstan:2.2.xfrom
vojtech-dobes:fix-593c71fe
Open

Fix containsNull() for union with (null&T of mixed)#6390
vojtech-dobes wants to merge 1 commit into
phpstan:2.2.xfrom
vojtech-dobes:fix-593c71fe

Conversation

@vojtech-dobes

@vojtech-dobes vojtech-dobes commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

When $var is union with null, but that null is part of intersection, TypeCombinator::containsNull currently doesn't detect this null, leading to false negative.

Fixes for example https://phpstan.org/r/1e3fa9bb-efec-4ba4-aec5-8d189e82c990.

@phpstan-bot

Copy link
Copy Markdown
Collaborator

You've opened the pull request against the latest branch 2.3.x. PHPStan 2.3 is not going to be released for months. If your code is relevant on 2.2.x and you want it to be released sooner, please rebase your pull request and change its target to 2.2.x.

@vojtech-dobes
vojtech-dobes changed the base branch from 2.3.x to 2.2.x September 7, 2026 07:49
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.

2 participants