@@ -9,14 +9,43 @@ class MyClass
99 public const MY_KEY = 'key ' ;
1010
1111 /**
12- * @param array{static::MY_KEY: string} $items
12+ * @param array{static::MY_KEY: string} $items1
13+ * @param array{self::MY_KEY: string} $items2
14+ * @param array{MyClass::MY_KEY: string} $items3
1315 *
1416 * @return string
1517 */
16- public function myMethod (array $ items ): array
18+ public function myMethod (array $ items1 , array $ items2 , array $ items3 ): array
1719 {
18- assertType ('array{key: string} ' , $ items );
20+ assertType ('array{key: string} ' , $ items1 );
21+ assertType ('array{key: string} ' , $ items2 );
22+ assertType ('array{key: string} ' , $ items3 );
1923
20- return $ items [static ::MY_KEY ];
24+ return $ items1 [static ::MY_KEY ];
25+ }
26+ }
27+
28+ class ParentClass extends MyClass
29+ {
30+ public const MY_KEY = 'different_key ' ;
31+
32+ /**
33+ * @param array{static::MY_KEY: string} $items1
34+ * @param array{self::MY_KEY: string} $items2
35+ * @param array{MyClass::MY_KEY: string} $items3
36+ * @param array{ParentClass::MY_KEY: string} $items4
37+ * @param array{parent::MY_KEY: string} $items5
38+ *
39+ * @return string
40+ */
41+ public function myMethod2 (array $ items1 , array $ items2 , array $ items3 , array $ items4 , array $ items5 ): array
42+ {
43+ assertType ('array{different_key: string} ' , $ items1 );
44+ assertType ('array{different_key: string} ' , $ items2 );
45+ assertType ('array{key: string} ' , $ items3 );
46+ assertType ('array{different_key: string} ' , $ items4 );
47+ assertType ('array{key: string} ' , $ items5 );
48+
49+ return $ items1 [static ::MY_KEY ];
2150 }
2251}
0 commit comments