Skip to content

Commit 1fdf562

Browse files
Use never return type declaration instead of never-return type annotation
1 parent 65d3dc4 commit 1fdf562

File tree

10 files changed

+12
-34
lines changed

10 files changed

+12
-34
lines changed

src/Framework/Assert.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,10 +2353,8 @@ final public static function objectEquals(object $object, string $method = 'equa
23532353
* Fails a test with the given message.
23542354
*
23552355
* @throws AssertionFailedError
2356-
*
2357-
* @psalm-return never-return
23582356
*/
2359-
final public static function fail(string $message = ''): void
2357+
final public static function fail(string $message = ''): never
23602358
{
23612359
self::$count++;
23622360

@@ -2367,10 +2365,8 @@ final public static function fail(string $message = ''): void
23672365
* Mark the test as incomplete.
23682366
*
23692367
* @throws IncompleteTestError
2370-
*
2371-
* @psalm-return never-return
23722368
*/
2373-
final public static function markTestIncomplete(string $message = ''): void
2369+
final public static function markTestIncomplete(string $message = ''): never
23742370
{
23752371
throw new IncompleteTestError($message);
23762372
}
@@ -2380,10 +2376,8 @@ final public static function markTestIncomplete(string $message = ''): void
23802376
*
23812377
* @throws SkippedWithMessageException
23822378
* @throws SyntheticSkippedError
2383-
*
2384-
* @psalm-return never-return
23852379
*/
2386-
final public static function markTestSkipped(string $message = ''): void
2380+
final public static function markTestSkipped(string $message = ''): never
23872381
{
23882382
if ($hint = self::detectLocationHint($message)) {
23892383
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);

src/Framework/Constraint/Constraint.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@ protected function matches(mixed $other): bool
8888
* Throws an exception for the given compared value and test description.
8989
*
9090
* @throws ExpectationFailedException
91-
*
92-
* @psalm-return never-return
9391
*/
94-
protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): void
92+
protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): never
9593
{
9694
$failureDescription = sprintf(
9795
'Failed asserting that %s.',

src/Framework/Constraint/JsonMatches.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ protected function matches(mixed $other): bool
6666
*
6767
* @throws \PHPUnit\Framework\Exception
6868
* @throws ExpectationFailedException
69-
*
70-
* @psalm-return never-return
7169
*/
72-
protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): void
70+
protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): never
7371
{
7472
if ($comparisonFailure === null) {
7573
[$error, $recodedOther] = Json::canonicalize($other);

src/Framework/ErrorTestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ public function toString(): string
6767

6868
/**
6969
* @throws Exception
70-
*
71-
* @psalm-return never-return
7270
*/
73-
protected function runTest(): mixed
71+
protected function runTest(): never
7472
{
7573
throw new Error($this->message);
7674
}

src/Framework/IncompleteTestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ public function toString(): string
6666

6767
/**
6868
* @throws Exception
69-
*
70-
* @psalm-return never-return
7169
*/
72-
protected function runTest(): mixed
70+
protected function runTest(): never
7371
{
7472
$this->markTestIncomplete($this->message);
7573
}

src/Framework/MockObject/Stub/Exception.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ public function __construct(Throwable $exception)
2828

2929
/**
3030
* @throws Throwable
31-
*
32-
* @psalm-return never-return
3331
*/
34-
public function invoke(Invocation $invocation): mixed
32+
public function invoke(Invocation $invocation): never
3533
{
3634
throw $this->exception;
3735
}

src/Framework/SkippedTestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ public function toString(): string
6666

6767
/**
6868
* @throws Exception
69-
*
70-
* @psalm-return never-return
7169
*/
72-
protected function runTest(): mixed
70+
protected function runTest(): never
7371
{
7472
$this->markTestSkipped($this->message);
7573
}

src/Framework/TestSuite.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,8 @@ public function setTests(array $tests): void
573573
* Mark the test suite as skipped.
574574
*
575575
* @throws SkippedTestSuiteError
576-
*
577-
* @psalm-return never-return
578576
*/
579-
public function markTestSuiteSkipped(string $message = ''): void
577+
public function markTestSuiteSkipped(string $message = ''): never
580578
{
581579
throw new SkippedTestSuiteError($message);
582580
}

src/Framework/WarningTestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ public function toString(): string
6666

6767
/**
6868
* @throws Exception
69-
*
70-
* @psalm-return never-return
7169
*/
72-
protected function runTest(): mixed
70+
protected function runTest(): never
7371
{
7472
throw new Warning($this->message);
7573
}

tests/unit/Framework/Constraint/ConstraintTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final protected function reduce(): Constraint
4242
return parent::reduce();
4343
}
4444

45-
final protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): void
45+
final protected function fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null): never
4646
{
4747
parent::fail($other, $description, $comparisonFailure);
4848
}

0 commit comments

Comments
 (0)