@@ -18,7 +18,7 @@ public static function staticMethodValid(): array
1818 return MyInheritedEnum::getValues ();
1919 }
2020
21- /** @return array<int, bool > */
21+ /** @return array<int, null > */
2222 public static function staticMethodFail (): array
2323 {
2424 return MyInheritedEnum::getValues ();
@@ -30,7 +30,7 @@ public static function objectMethodValid(): array
3030 return MyInheritedEnum::STR ()->getValues ();
3131 }
3232
33- /** @return array<int, bool > */
33+ /** @return array<int, null > */
3434 public static function objectMethodFail (): array
3535 {
3636 return MyInheritedEnum::STR ()->getValues ();
@@ -41,9 +41,45 @@ class MyEnum extends Enum
4141{
4242 const STR = 'str ' ;
4343 const INT = 1 ;
44+
45+ /** @return array<int, int|string> */
46+ public static function selfGetValuesValid (): array
47+ {
48+ return self ::getValues ();
49+ }
50+
51+ /** @return array<int, null> */
52+ public static function selfGetValuesFail (): array
53+ {
54+ return self ::getValues ();
55+ }
56+
57+ /** @return array<int, null> */
58+ public static function staticGetValuesFail (): array
59+ {
60+ return static ::getValues ();
61+ }
4462}
4563
4664class MyInheritedEnum extends MyEnum
4765{
4866 const FLOAT = 1.1 ;
67+
68+ /** @return array<int, float|int|string> */
69+ public static function inheritSelfGetValuesValid (): array
70+ {
71+ return self ::getValues ();
72+ }
73+
74+ /** @return array<int, null> */
75+ public static function inheritSelfGetValuesFail (): array
76+ {
77+ return self ::getValues ();
78+ }
79+
80+ /** @return array<int, null> */
81+ public static function inheritStaticGetValuesFail (): array
82+ {
83+ return static ::getValues ();
84+ }
4985}
0 commit comments