From 60508ece647659851c4af1e68c27a7d377f9df41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 15 Nov 2024 14:16:57 +0100 Subject: [PATCH] Fix exception handle It's not allowed to modify Error --- src/Console/Application.php | 8 +++++--- tools/release/castor.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Console/Application.php b/src/Console/Application.php index 4f3eb20b..3146d9eb 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -122,8 +122,12 @@ protected function getDefaultInputDefinition(): InputDefinition return $definition; } - private function enhanceException(\Throwable $exception): \Throwable + private function enhanceException(\Throwable $exception): void { + if ($exception instanceof \Error) { + return; + } + $castorDirs = [ \dirname(__DIR__, 1), \dirname(__DIR__, 2) . \DIRECTORY_SEPARATOR . 'vendor', @@ -148,8 +152,6 @@ private function enhanceException(\Throwable $exception): \Throwable break; } - - return $exception; } private function getLogo(): string diff --git a/tools/release/castor.php b/tools/release/castor.php index 8729c190..fb6e56d0 100644 --- a/tools/release/castor.php +++ b/tools/release/castor.php @@ -106,7 +106,7 @@ function release(): int check( 'Check the number of artifacts', 'There are not enough files in the artifacts directory.', - fn () => EXPECTED_ARTIFACTS === count($files), + fn () => EXPECTED_ARTIFACTS === \count($files), ); check(