phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

PHP version rules do not catch that type unions are not supported in php 7 on class properties

Open SpencerMalone opened this issue 5 months ago • 1 comments
trafficstars

Bug report

I would expect 2 errors here: One for native union types on the property, and one for native union types on the parameter. Instead I only have one.

Code snippet that reproduces the problem

http://phpstan.org/r/0f708c06-44fe-4efd-ad8f-d53f8d39f065

Expected output

Line 5: Property HelloWorld::$prop uses native union types but they're supported only on PHP 8.0 and later.

Did PHPStan help you today? Did it make you happy in any way?

Yes, I use it all the time and love it!

SpencerMalone avatar Jun 05 '25 14:06 SpencerMalone

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

mergeable[bot] avatar Jun 05 '25 14:06 mergeable[bot]