Support "true" pseudotypes in native unions#1539
Support "true" pseudotypes in native unions#1539ondrejmirtes merged 13 commits intophpstan:1.8.xfrom
Conversation
staabm
left a comment
There was a problem hiding this comment.
requires integration of Roave/BetterReflection#1152 into ondrejmirtes/BetterReflection to proceed
There was a problem hiding this comment.
initially I had the idea to make the new type only available on php 8.2+, but it seems atm we cannot do it in a version dependent way.
maybe this would even be more like a linter task.. leave it like this for now, as I realized thats the way we implemented such types in the past
There was a problem hiding this comment.
Allegedly this is gonna be solved in PHP-Parser 5.0 which is gonna make a thick line between Name and Identifier dependent on PHP version.
|
BetterReflection is updated in 1.8.x. |
|
did some local debugging. the last remainig part is a new PhpParser release, because in the current stable release the on the master branch the necessary stuff is already implemented though |
|
php-parser was updated with #1690 |
| { | ||
| } | ||
|
|
||
| function trueUnionReturn(): true|null |
There was a problem hiding this comment.
How are the other two methods tested? I'd expect more assertType calls here.
|
Thank you! |
|
@staabm Can you please also write some tests for these? Thank you! https://php.watch/versions/8.2/null-false-types |
https://phpstan.org/r/1401ac97-4f3d-4209-a6bf-e3e24e621738 do you mean creating new rules which emit errors in |
|
No, just type inference tests to see that these standalone types work. |
https://wiki.php.net/rfc/true-type
fixes https://phpstan.org/r/ae4ac09d-f2b0-46c0-ac4b-f8fdbd2a8c96
Prerequisites
truetype asReflectionNamedType#isBuiltIn()value Roave/BetterReflection#1152