Bug Report
| Subject |
Details |
| Rector version |
2.2 |
| Installed as |
composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/3c26e61f-a1ad-4c23-8c99-9c2d9f69ba6c
<?php
namespace App\Foo {
class A {}
}
namespace App\Bar {
class B {}
}
namespace App {
use App\Foo\A;
use App\Bar\B;
class Foo
{
protected array $dependencies = [
A::class,
B::class,
];
}
}
Responsible rules
DocblockVarArrayFromPropertyDefaultsRector
Expected Behavior
Currently Rector creates the type class-string<App\Foo\A>[]|class-string<App\Bar\B>[] But I think it should be array<int, class-string<App\Bar\A>|class-string<App\Bar\B>> One array with unioned classes as the value instead of union of arrays.
Maybe this was intentional, but I think the suggested type suits here better.