Skip to content

Don't record non-Variable exprs as conditionally undefined - #6787

Open
vojtech-dobes wants to merge 1 commit into
phpstan:2.3.xfrom
vojtech-dobes:fix-narrowing
Open

vojtech-dobes wants to merge 1 commit into
phpstan:2.3.xfrom
vojtech-dobes:fix-narrowing

Conversation

@vojtech-dobes

@vojtech-dobes vojtech-dobes commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

This is attempt to fix phpstan/phpstan#15525. If I get the cause right, PHPStan reverted anything not defined locally to its original type. But property obviously isn't defined locally (it's defined on class). So the narrowing of that logic to Variable is hopefully correct solution.

I will be glad for guidance, but the buggy report is nasty :).

@staabm

staabm commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

please report a new issue and describe whatever you experienced and expectations

@vojtech-dobes

Copy link
Copy Markdown
Contributor Author

please report a new issue and describe whatever you experienced and expectations

@staabm I opened issue and referenced it here with small comment.

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.

Non-negative property reported as possibly null within if

2 participants