You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phpdeclare(strict_types = 1);
interfaceX {}
interfaceY {}
// Fatal error: Type Y&X is redundant with type X&Y in// https://3v4l.org/gpAXAfunctiona(): (X&Y)|(Y&X) {
returnnewclass() implementsX, Y {};
}
// Fatal error: Type X&Y is redundant as it is more restrictive than type X // https://3v4l.org/0jneSfunction b(): (X&Y)|X {
returnnewclass() implementsX {};
}
Fatal error: Type Y&X is redundant with type X&Y in
Fatal error: Type X&Y is redundant as it is more restrictive than type X
Did PHPStan help you today? Did it make you happy in any way?
Yep, helps a lot to move types intersections from phpdoc to code.
The text was updated successfully, but these errors were encountered:
LastDragon-ru
changed the title
PHPStan not follow DNF Type Declaration Constraints (PHP 8.2)
PHPStan not follow DNF Type Declaration Constraints (PHP 8.2+)
Apr 20, 2024
Bug report
The code is good for phpstan, but it is not valid for PHP :) (see https://wiki.php.net/rfc/dnf_types and https://php.watch/versions/8.2/dnf-types)
Code snippet that reproduces the problem
https://phpstan.org/r/75ab1049-8ffd-41bb-93ad-3082124ff2ec
Expected output
Did PHPStan help you today? Did it make you happy in any way?
Yep, helps a lot to move types intersections from phpdoc to code.
The text was updated successfully, but these errors were encountered: