Skip to content

class-string|string type is not simplified to string #5607

@mvorisek

Description

@mvorisek

Bug report

Starting with the latest phpstan release the following fix is needed: https://github.com/atk4/ui/pull/1657/files

But I belive it is wrong as class-string|string type should be simplified to string as before.

Also, as shown in the code snippet below, it is still/correctly simplified when declared as phpdoc.

Code snippet that reproduces the problem

https://phpstan.org/r/7757dd83-d27f-4978-88fc-ff5dea43fcc8

https://github.com/atk4/ui/actions

Expected output

 Line | Error
 -- | --
- 8 | Property Cl::$u (A\|null) does not accept default value of type array<int\|string, class-string\|string>.
+ 8 | Property Cl::$u (A\|null) does not accept default value of type array<int\|string, string>.
 20 | Parameter #1 $x of method Cl::mm() expects array<int\|string, string>, null given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions