,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'validToString' => [ ' [ ' [ ' [ ' [ ' [ ' $_) {} echo (string) $i; }', ], 'allowToStringAfterMethodExistsCheck' => [ ' [ '__toString(); } class A { /** @psalm-return non-empty-string */ function __toString(): string { return "ha"; } }' ], 'intersectionCanBeString' => [ ' [ ' [ ' */ public function providerInvalidCodeParse(): iterable { return [ 'echoClass' => [ ' 'InvalidArgument', ], 'echoCastClass' => [ ' 'InvalidCast', ], 'invalidToStringReturnType' => [ ' 'InvalidToString', ], 'invalidInferredToStringReturnType' => [ ' 'InvalidToString', ], 'invalidInferredToStringReturnTypeWithTruePhp8' => [ ' 'InvalidToString', [], false, '8.0' ], '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', ], 'alwaysEvaluateToStringVar' => [ ' 'UndefinedGlobalVariable', ], 'implicitStringableDisallowed' => [ ' 'InvalidArgument', [], false, '7.4', ], 'implicitCastInArray' => [ ' */ function f(S $s): array { return [$s]; } ', 'error_message' => 'ImplicitToStringCast' ], 'implicitCastInList' => [ ' */ function f(S $s): array { return [$s]; } ', 'error_message' => 'ImplicitToStringCast' ], 'implicitCastInTuple' => [ ' 'ImplicitToStringCast' ], 'implicitCastInShape' => [ ' 'ImplicitToStringCast' ], 'implicitCastInIterable' => [ ' */ function f(S $s) { return [$s]; } ', 'error_message' => 'ImplicitToStringCast' ], ]; } }