diff --git a/rector.php b/rector.php index 95bde681..d17ce91c 100644 --- a/rector.php +++ b/rector.php @@ -25,5 +25,6 @@ $rectorConfig->skip([ ClosureToArrowFunctionRector::class, JsonThrowOnErrorRector::class, + __DIR__ . '/tests/SynchronizerTest.php', ]); }; diff --git a/tests/SynchronizerTest.php b/tests/SynchronizerTest.php index 90a009ff..34258f6b 100644 --- a/tests/SynchronizerTest.php +++ b/tests/SynchronizerTest.php @@ -57,20 +57,21 @@ public function testExecuteWithErrorCapture(): void { $result = false; + $exceptionMessage = null; try { $this->synchronizer->execute('testExecuteExceptionThrown', function () use (&$result) { - $undefined = null; $result = file_exists($this->mutex->getFile()); return $undefined; }); } catch (ErrorException $e) { - $this->assertSame( - PHP_VERSION_ID >= 80000 ? 'Undefined variable $undefined' : 'Undefined variable: undefined', - $e->getMessage(), - ); - } finally { - $this->assertTrue($result); - $this->assertFileDoesNotExist($this->mutex->getFile()); + $exceptionMessage = $e->getMessage(); } + + $this->assertSame( + PHP_VERSION_ID >= 80000 ? 'Undefined variable $undefined' : 'Undefined variable: undefined', + $exceptionMessage, + ); + $this->assertTrue($result); + $this->assertFileDoesNotExist($this->mutex->getFile()); } }