From 0f4a99d52a56bc85258ec72b71a3f4a51a82ba33 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 8 Dec 2021 04:00:08 +0100 Subject: [PATCH] catch Exception -> Throwable --- src/CodeCoverage/Generators/AbstractGenerator.php | 2 +- src/Framework/Assert.php | 2 +- src/Framework/TestCase.php | 4 ++-- src/Runner/TestHandler.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CodeCoverage/Generators/AbstractGenerator.php b/src/CodeCoverage/Generators/AbstractGenerator.php index 1fab0663..2f9d53fb 100644 --- a/src/CodeCoverage/Generators/AbstractGenerator.php +++ b/src/CodeCoverage/Generators/AbstractGenerator.php @@ -82,7 +82,7 @@ public function render(string $file = null): void ob_start(function (string $buffer) use ($handle) { fwrite($handle, $buffer); }, 4096); try { $this->renderSelf(); - } catch (\Exception $e) { + } catch (\Throwable $e) { } ob_end_flush(); fclose($handle); diff --git a/src/Framework/Assert.php b/src/Framework/Assert.php index c16a8070..46d517dc 100644 --- a/src/Framework/Assert.php +++ b/src/Framework/Assert.php @@ -413,7 +413,7 @@ public static function error(callable $function, $expectedType, string $expected try { $function(); restore_error_handler(); - } catch (\Exception $e) { + } catch (\Throwable $e) { restore_error_handler(); throw $e; } diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 1ffaddd7..570d4f56 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -127,7 +127,7 @@ public function runTest(string $method, array $args = null): void } else { [$this, $method->getName()](...$params); } - } catch (\Exception $e) { + } catch (\Throwable $e) { $this->handleErrors = false; $this->silentTearDown(); throw $e; @@ -187,7 +187,7 @@ private function silentTearDown(): void set_error_handler(function () {}); try { $this->tearDown(); - } catch (\Exception $e) { + } catch (\Throwable $e) { } restore_error_handler(); } diff --git a/src/Runner/TestHandler.php b/src/Runner/TestHandler.php index bb344578..e012a9d5 100644 --- a/src/Runner/TestHandler.php +++ b/src/Runner/TestHandler.php @@ -150,7 +150,7 @@ private function initiateDataProvider(Test $test, string $provider) throw new \Exception("No records in data provider file '{$test->getFile()}'" . ($query ? " for query '$query'" : '') . '.'); } - } catch (\Exception $e) { + } catch (\Throwable $e) { return $test->withResult(empty($optional) ? Test::FAILED : Test::SKIPPED, $e->getMessage()); }