,error_levels?:string[]}> */ public function providerValidCodeParse() { return [ 'validToString' => [ ' [ ' [ ' [ ' [ ' [ ' $_) {} echo (string) $i; }', ], 'allowToStringAfterMethodExistsCheck' => [ ' [ '__toString(); } class A { /** @psalm-return non-empty-string */ function __toString(): string { return "ha"; } }' ], ]; } /** * @return iterable */ public function providerInvalidCodeParse() { return [ 'echoClass' => [ ' 'InvalidArgument', ], 'echoCastClass' => [ ' 'InvalidCast', ], 'invalidToStringReturnType' => [ ' 'InvalidToString', ], 'invalidInferredToStringReturnType' => [ ' 'InvalidToString', ], 'implicitCastWithStrictTypes' => [ ' 'InvalidArgument', ], 'implicitCastWithStrictTypesToEchoOrSprintf' => [ ' 'ImplicitToStringCast', ], 'implicitCast' => [ ' 'ImplicitToStringCast', ], 'implicitCastToUnion' => [ ' 'ImplicitToStringCast', ], 'implicitCastFromInterface' => [ ' 'ImplicitToStringCast', ], 'implicitConcatenation' => [ ' 'ImplicitToStringCast', [], true, ], 'resourceCannotBeCoercedToString' => [ ' 'InvalidArgument', ], 'resourceOrFalseToString' => [ ' 'PossiblyInvalidCast', ], 'cannotCastInsideString' => [ ' 'InvalidCast', ], 'warnAboutNullableCast' => [ ' 'ImplicitToStringCast', ], 'possiblyInvalidCastOnIsSubclassOf' => [ ' 'PossiblyInvalidOperand', ], 'allowToStringAfterMethodExistsCheckWithTypo' => [ ' 'InvalidCast', ], ]; } }