[ ' [ ' [ 'barBar();', ], 'staticInvocation' => [ ' [ ' [ ' [ 'sub(new DateInterval("P1D")); $b = (new DateTimeImmutable())->modify("+3 hours");', 'assertions' => [ '$yesterday' => 'MyDate', '$b' => 'DateTimeImmutable', ], ], 'magicCall' => [ 'bar();', ], 'canBeCalledOnMagic' => [ 'maybeUndefinedMethod();', 'assertions' => [], 'error_levels' => ['PossiblyUndefinedMethod'], ], 'invokeCorrectType' => [ ' [ 'createElement("foo"); $newnode = $doc->appendChild($node); $newnode->setAttribute("bar", "baz");', ], 'nonStaticSelfCall' => [ 'call());', ], ]; } /** * @return array */ public function providerFileCheckerInvalidCodeParse() { return [ 'staticInvocation' => [ ' 'InvalidStaticInvocation', ], 'parentStaticCall' => [ ' 'InvalidStaticInvocation', ], 'mixedMethodCall' => [ 'barBar();', 'error_message' => 'MixedMethodCall', 'error_levels' => [ 'MissingPropertyType', 'MixedAssignment', ], ], 'invalidMethodCall' => [ 'someMethod();', 'error_message' => 'InvalidMethodCall', ], 'possiblyInvalidMethodCall' => [ 'methodOfA(); } }', 'error_message' => 'PossiblyInvalidMethodCall', ], 'selfNonStaticInvocation' => [ ' 'NonStaticSelfCall', ], 'noParent' => [ ' 'ParentNotFound', ], 'coercedClass' => [ ' 'LessSpecificReturnStatement', 'error_levels' => ['MixedInferredReturnType', 'MixedReturnStatement'], ], 'undefinedVariableStaticCall' => [ ' 'UndefinedGlobalVariable', ], 'staticCallOnString' => [ ' 'MixedAssignment', ], 'possiblyNullFunctionCall' => [ 'foo();', 'error_message' => 'InvalidScope', ], 'possiblyFalseReference' => [ 'bar();', 'error_message' => 'PossiblyFalseReference', ], 'undefinedParentClass' => [ ' 'MissingDependency - src' . DIRECTORY_SEPARATOR . 'somefile.php:7', ], 'variableMethodCallOnArray' => [ '$b();', 'error_message' => 'InvalidMethodCall', ], 'intVarStaticCall' => [ ' 'UndefinedClass', ], 'intVarNewCall' => [ ' 'UndefinedClass', ], 'invokeTypeMismatch' => [ ' 'InvalidScalarArgument', ], 'explicitInvokeTypeMismatch' => [ '__invoke(1);', 'error_message' => 'InvalidScalarArgument', ], ]; } }