diff --git a/src/Psalm/Internal/Stubs/CoreImmutableClasses.phpstub b/src/Psalm/Internal/Stubs/CoreImmutableClasses.phpstub index ce8821fc664..98968b7227f 100644 --- a/src/Psalm/Internal/Stubs/CoreImmutableClasses.phpstub +++ b/src/Psalm/Internal/Stubs/CoreImmutableClasses.phpstub @@ -60,9 +60,10 @@ interface Throwable public function getTraceAsString() : string; /** + * @return string * @psalm-taint-source input */ - public function __toString() : string; + public function __toString(); } /** @@ -137,9 +138,10 @@ class Exception implements Throwable public final function getTraceAsString() : string {} /** + * @return string * @psalm-taint-source input */ - public function __toString() : string {} + public function __toString() {} } /** @@ -212,7 +214,8 @@ class Error implements Throwable public final function getTraceAsString() : string {} /** + * @return string * @psalm-taint-source input */ - public function __toString() : string {} + public function __toString() {} } diff --git a/tests/MethodSignatureTest.php b/tests/MethodSignatureTest.php index dcc8296cde1..8a4d1f5d4c2 100644 --- a/tests/MethodSignatureTest.php +++ b/tests/MethodSignatureTest.php @@ -791,6 +791,25 @@ public function getTrace(): array; public function getPrevious(): ?\Throwable; public function getTraceAsString(): string; }' + ], + 'allowExecptionToStringWithNoType' => [ + ' [ + '