From fa7eaf56745e0d983386d52a36bba07c62e81dfd Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 10 Jan 2025 08:02:54 -0800 Subject: [PATCH] refactor: add never return type on closure (#1201) --- rector.php | 2 ++ src/Http/tests/HttpTest.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rector.php b/rector.php index 34a9e897e..c89a05ed8 100644 --- a/rector.php +++ b/rector.php @@ -22,6 +22,7 @@ use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; +use Rector\TypeDeclaration\Rector\Closure\AddClosureNeverReturnTypeRector; use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector; @@ -132,4 +133,5 @@ TypedPropertyFromStrictSetUpRector::class, PreferPHPUnitSelfCallRector::class, TypedPropertyFromAssignsRector::class, + AddClosureNeverReturnTypeRector::class, ]); diff --git a/src/Http/tests/HttpTest.php b/src/Http/tests/HttpTest.php index eb6902fb2..5bba4a5be 100644 --- a/src/Http/tests/HttpTest.php +++ b/src/Http/tests/HttpTest.php @@ -215,7 +215,7 @@ public function testPassException(): void $core = $this->getCore(); - $core->setHandler(function ($req, $resp): void { + $core->setHandler(function ($req, $resp): never { throw new \RuntimeException('error'); });