5858
5959 ['testNull ' , 'null ' , true , true , '8.2 ' ],
6060
61- ['testClassEntry ' , 'class_name ' , false , true , '8.0 ' ],
62- ['testClassEntryOptional ' , 'class_name ' , false , false , '8.0 ' ],
63- ['testClassEntryNullable ' , 'class_name ' , true , true , '8.0 ' ],
61+ ['testClassEntry ' , 'IntegrationTest \\ TypeHints \\ IFoo ' , false , true , '8.0 ' ],
62+ ['testClassEntryOptional ' , 'IntegrationTest \\ TypeHints \\ IFoo ' , false , false , '8.0 ' ],
63+ ['testClassEntryNullable ' , 'IntegrationTest \\ TypeHints \\ IFoo ' , true , true , '8.0 ' ],
6464];
6565
6666// typehints
113113 ['returnMixed ' , 'mixed ' , true , '8.0 ' ],
114114 ['returnNever ' , 'never ' , false , '8.1 ' ],
115115 ['returnVoid ' , 'void ' , false ],
116- ['returnClassEntry ' , 'class_name ' , false , '8.0 ' ],
117- ['returnClassEntryNullable ' , 'class_name ' , true , '8.0 ' ],
116+ ['returnClassEntry ' , 'IntegrationTest \\ TypeHints \\ IFoo ' , false , '8.0 ' ],
117+ ['returnClassEntryNullable ' , 'IntegrationTest \\ TypeHints \\ IFoo ' , true , '8.0 ' ],
118118];
119119echo PHP_EOL . 'Testing return typehints ' . PHP_EOL ;
120120$ cls = new \IntegrationTest \TypeHints \ReturnTypeHintTest ();
@@ -186,13 +186,14 @@ public function setValue($value): void {
186186}
187187
188188$ expectedArgs = [
189+ // <arg name>, <type>, <default value>
189190 ['s ' , 'string ' , 'foobarbaz ' ],
190191 ['i ' , 'int ' , 42 ],
191192 ['f ' , 'float ' , 7.89 ],
192193 ['b ' , 'bool ' , true ],
193194 ['a ' , 'array ' , ['a ' =>'b ' ]],
194195 ['m ' , 'mixed ' , 1.23 ],
195-
196+ [ ' ce ' , ' Stringable ' ], //default value not supported for ClassEntry
196197];
197198if (PHP_VERSION_ID >= 80000 ) {
198199 echo PHP_EOL . 'Testing function typehints ' . PHP_EOL ;
@@ -202,7 +203,9 @@ public function setValue($value): void {
202203 echo (sprintf ("argument %d.. " , $ i ));
203204 assert_eq ($ input [0 ], $ params [$ i ]->getName (), sprintf ('argument %d has correct name ' , $ i ));
204205 assert_eq ($ input [1 ], $ params [$ i ]->getType ()->getName (), sprintf ('argument %d has correct type ' , $ i ));
205- assert_eq ($ input [2 ], $ params [$ i ]->getDefaultValue (), sprintf ('argument %d has correct default value ' , $ i ));
206+ if (array_key_exists (2 , $ input )) {
207+ assert_eq ($ input [2 ], $ params [$ i ]->getDefaultValue (), sprintf ('argument %d has correct default value ' , $ i ));
208+ }
206209 echo "PASS " . PHP_EOL ;
207210 }
208211 assert_eq ('void ' , $ reflection ->getReturnType ()->getName (), 'integration_function_typehints return type is void ' );
0 commit comments