58
58
59
59
['testNull ' , 'null ' , true , true , '8.2 ' ],
60
60
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 ' ],
64
64
];
65
65
66
66
// typehints
113
113
['returnMixed ' , 'mixed ' , true , '8.0 ' ],
114
114
['returnNever ' , 'never ' , false , '8.1 ' ],
115
115
['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 ' ],
118
118
];
119
119
echo PHP_EOL . 'Testing return typehints ' . PHP_EOL ;
120
120
$ cls = new \IntegrationTest \TypeHints \ReturnTypeHintTest ();
@@ -186,13 +186,14 @@ public function setValue($value): void {
186
186
}
187
187
188
188
$ expectedArgs = [
189
+ // <arg name>, <type>, <default value>
189
190
['s ' , 'string ' , 'foobarbaz ' ],
190
191
['i ' , 'int ' , 42 ],
191
192
['f ' , 'float ' , 7.89 ],
192
193
['b ' , 'bool ' , true ],
193
194
['a ' , 'array ' , ['a ' =>'b ' ]],
194
195
['m ' , 'mixed ' , 1.23 ],
195
-
196
+ [ ' ce ' , ' Stringable ' ], //default value not supported for ClassEntry
196
197
];
197
198
if (PHP_VERSION_ID >= 80000 ) {
198
199
echo PHP_EOL . 'Testing function typehints ' . PHP_EOL ;
@@ -202,7 +203,9 @@ public function setValue($value): void {
202
203
echo (sprintf ("argument %d.. " , $ i ));
203
204
assert_eq ($ input [0 ], $ params [$ i ]->getName (), sprintf ('argument %d has correct name ' , $ i ));
204
205
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
+ }
206
209
echo "PASS " . PHP_EOL ;
207
210
}
208
211
assert_eq ('void ' , $ reflection ->getReturnType ()->getName (), 'integration_function_typehints return type is void ' );
0 commit comments