[ ' [ ' [ ' [ '$a' => 'int', ], ], 'varCallableParamReturnType' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ '$a' => 'array{0:string, 1:string}', '$b' => 'array{0:string, 1:string}', '$c' => 'array{0:string, 1:string}', '$d' => 'array{0:string, 1:string}', '$e' => 'array{0:string, 1:string}', '$f' => 'array{0:string, 1:string}', ], ], 'arrayCallableMethod' => [ ' [ ' [ ' $b ? 1 : 0; } $arr = [5, 4, 3, 1, 2]; usort($arr, "fooBar"); } }', ], 'closureSelf' => [ 'subitems = array_map( function(self $i): self { return $i; }, $in ); } } new A([new A, new A]);', ], 'possiblyUndefinedFunction' => [ ' [ ' [ ' [ 'callMeMaybe("foo");', ], 'isCallableString' => [ ' [ ' [ ' [ ' [ '$a' => 'A', ], ], 'returnsTypedClosureWithSubclassParam' => [ ' [ '$a' => 'A', ], ], 'returnsTypedClosureWithParentReturn' => [ ' [ '$a' => 'A', ], ], 'returnsTypedCallableFromClosure' => [ ' [ '$a' => 'A', ], ], 'inferClosureTypeWithTypehint' => [ ' [ '$adder1' => 'Closure(int):Closure(int):int', '$adder2' => 'Closure(int):Closure(int):int', ], 'error_levels' => ['MissingClosureReturnType'], ], 'inferArrayMapReturnTypeWithoutTypehints' => [ ' [], 'error_levels' => ['MissingClosureReturnType'], ], 'inferArrayMapReturnTypeWithTypehints' => [ ' [ ' [ 'callable = $callable; } public function callTheCallableDirectly(): bool { return ($this->callable)(); } public function callTheCallableIndirectly(): bool { $r = $this->callable; return $r(); } }', ], 'invokableProperties' => [ 'invokable = $invokable; } public function callTheInvokableDirectly(): bool { return ($this->invokable)(); } public function callTheInvokableIndirectly(): bool { $r = $this->invokable; return $r(); } }', ] ]; } /** * @return array */ public function providerFileCheckerInvalidCodeParse() { return [ 'wrongArg' => [ ' 'InvalidScalarArgument', ], 'noReturn' => [ ' 'InvalidReturnType', ], 'undefinedCallableClass' => [ 'getFoo()($argOne, $argTwo); } }', 'error_message' => 'InvalidFunctionCall', 'error_levels' => ['UndefinedClass'], ], 'undefinedCallableMethod' => [ ' 'UndefinedMethod', ], 'undefinedCallableMethodClass' => [ ' 'UndefinedClass', ], 'undefinedCallableFunction' => [ ' 'UndefinedFunction', ], 'possiblyNullFunctionCall' => [ ' 'MixedReturnStatement', ], 'stringFunctionCall' => [ ' 'MixedAssignment', ], 'wrongParamType' => [ ' 'InvalidScalarArgument', ], 'missingClosureReturnType' => [ ' 'MissingClosureReturnType', ], 'wrongCallableReturnType' => [ ' 'InvalidReturnStatement', ], 'returnsTypedClosureWithBadReturnType' => [ ' 'InvalidReturnStatement', ], 'returnsTypedCallableWithBadReturnType' => [ ' 'InvalidReturnStatement', ], 'returnsTypedClosureWithBadParamType' => [ ' 'InvalidReturnStatement', ], 'returnsTypedCallableWithBadParamType' => [ ' 'InvalidReturnStatement', ], 'returnsTypedClosureWithBadCall' => [ ' 'InvalidArgument', ], 'returnsTypedClosureWithSubclassParam' => [ ' 'LessSpecificReturnStatement', ], 'returnsTypedClosureWithSubclassReturn' => [ ' 'LessSpecificReturnStatement', ], 'returnsTypedClosureFromCallable' => [ ' 'LessSpecificReturnStatement', ], 'undefinedVariable' => [ ' 'UndefinedVariable', ], ]; } }