@@ -19,13 +19,11 @@ public function isGreaterThanOrEqual(Role $role): bool
1919 self ::cases ()
2020 );
2121
22- // per-constant-array-item closure reanalysis is not done, so the property
23- // fetch is resolved once over the unioned element type rather than per item.
24- assertType ("array{'ADMIN'|'EDITOR'|'OWNER', 'ADMIN'|'EDITOR'|'OWNER', 'ADMIN'|'EDITOR'|'OWNER'} " , $ map );
22+ assertType ("array{'OWNER', 'ADMIN', 'EDITOR'} " , $ map );
2523
2624 $ hierarchy = array_flip ($ map );
2725
28- assertType ("non-empty- array{ADMIN? : 0|1|2, EDITOR?: 0|1|2, OWNER?: 0|1| 2} " , $ hierarchy );
26+ assertType ("array{OWNER : 0, ADMIN: 1, EDITOR: 2} " , $ hierarchy );
2927
3028 return $ hierarchy [$ this ->value ] <= $ hierarchy [$ role ->value ];
3129 }
@@ -71,16 +69,12 @@ function testIntBackedEnum(): void
7169 static fn (IntEnum $ e ): int => $ e ->value ,
7270 IntEnum::cases ()
7371 );
74- // per-constant-array-item closure reanalysis is not done, so the property
75- // fetch is resolved once over the unioned element type rather than per item.
76- assertType ("array{10|20, 10|20} " , $ result );
72+ assertType ("array{10, 20} " , $ result );
7773}
7874
7975function testClosureWithStringKeys (): void
8076{
8177 $ arr = ['x ' => 1 , 'y ' => 2 ];
8278 $ result = array_map (fn (int $ v ): string => (string )$ v , $ arr );
83- // per-constant-array-item closure reanalysis is not done, so the cast is
84- // resolved once over the unioned element type rather than per item.
85- assertType ("array{x: '1'|'2', y: '1'|'2'} " , $ result );
79+ assertType ("array{x: '1', y: '2'} " , $ result );
8680}
0 commit comments