Skip to content

Commit 111caee

Browse files
phpstan-botclaude
andcommitted
Remove native return type from __toString() test to avoid lint failure
The native `never` return type on `__toString()` causes a lint error since PHP requires `__toString()` to declare `string` as its return type. Use a `@return never` PHPDoc instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9dc46fd commit 111caee

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ public function testBug13806(): void
739739
$this->analyse([__DIR__ . '/data/bug-13806.php'], [
740740
[
741741
'Dead catch - Throwable is never thrown in the try block.',
742-
27,
742+
28,
743743
],
744744
]);
745745
}

tests/PHPStan/Rules/Exceptions/data/bug-13806.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ function castToString(\Stringable|string $variable): string {
1414
}
1515

1616
class MyString {
17-
public function __toString(): never {
17+
/** @return never */
18+
public function __toString() {
1819
throw new \Exception();
1920
}
2021
}

0 commit comments

Comments
 (0)