diff --git a/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php b/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php index 971f593bfc8..da3cc191234 100644 --- a/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateIntervalConstructorThrowTypeExtension.php @@ -13,6 +13,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; +use Throwable; use function count; #[AutowiredService] @@ -40,7 +41,7 @@ public function getThrowTypeFromStaticMethodCall(MethodReflection $methodReflect foreach ($constantStrings as $constantString) { try { new DateInterval($constantString->getValue()); - } catch (\Exception $e) { // phpcs:ignore + } catch (Throwable) { return $this->exceptionType(); } diff --git a/src/Type/Php/DateTimeConstructorThrowTypeExtension.php b/src/Type/Php/DateTimeConstructorThrowTypeExtension.php index 2facd039453..45cdb606a3a 100644 --- a/src/Type/Php/DateTimeConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateTimeConstructorThrowTypeExtension.php @@ -14,6 +14,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; +use Throwable; use function count; use function in_array; @@ -42,7 +43,7 @@ public function getThrowTypeFromStaticMethodCall(MethodReflection $methodReflect foreach ($constantStrings as $constantString) { try { new DateTime($constantString->getValue()); - } catch (\Exception $e) { // phpcs:ignore + } catch (Throwable) { return $this->exceptionType(); } diff --git a/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php b/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php index 02c0099c4ee..f3b91b8b358 100644 --- a/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php +++ b/src/Type/Php/DateTimeModifyMethodThrowTypeExtension.php @@ -14,6 +14,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; +use Throwable; use function count; use function in_array; @@ -47,7 +48,7 @@ public function getThrowTypeFromMethodCall(MethodReflection $methodReflection, M try { $dateTime = new DateTime(); $dateTime->modify($constantString->getValue()); - } catch (\Exception $e) { // phpcs:ignore + } catch (Throwable) { return $this->exceptionType(); } diff --git a/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php b/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php index 0c4c0bd9dd9..d58e183886a 100644 --- a/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php +++ b/src/Type/Php/DateTimeZoneConstructorThrowTypeExtension.php @@ -13,6 +13,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; +use Throwable; use function count; #[AutowiredService] @@ -40,7 +41,7 @@ public function getThrowTypeFromStaticMethodCall(MethodReflection $methodReflect foreach ($constantStrings as $constantString) { try { new DateTimeZone($constantString->getValue()); - } catch (\Exception $e) { // phpcs:ignore + } catch (Throwable) { return $this->exceptionType(); } diff --git a/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php b/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php index 78faf2d1d33..018f9be27ca 100644 --- a/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php +++ b/src/Type/Php/SimpleXMLElementConstructorThrowTypeExtension.php @@ -11,6 +11,7 @@ use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; use SimpleXMLElement; +use Throwable; use function count; use function extension_loaded; use function libxml_use_internal_errors; @@ -41,7 +42,7 @@ public function getThrowTypeFromStaticMethodCall(MethodReflection $methodReflect foreach ($constantStrings as $constantString) { try { new SimpleXMLElement($constantString->getValue()); - } catch (\Exception $e) { // phpcs:ignore + } catch (Throwable) { return $methodReflection->getThrowType(); }