diff --git a/CHANGELOG.md b/CHANGELOG.md index aa9bf14..c75262e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to `phpcs-type-sniff` will be documented in this file. Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## 81.6.2 - 2024-05-24 +### Fixed +- Catch `Throwable` when doing reflection, for fatal errors + ## 81.6.1 - 2024-05-23 ### Changed - Limit `IteratorAggregate` item type tag check to direct implementation only, exclude parents for now diff --git a/src/Sniffs/CodeElement/IteratorItemTypeSniff.php b/src/Sniffs/CodeElement/IteratorItemTypeSniff.php index 96f8f42..45e46d0 100644 --- a/src/Sniffs/CodeElement/IteratorItemTypeSniff.php +++ b/src/Sniffs/CodeElement/IteratorItemTypeSniff.php @@ -2,7 +2,6 @@ namespace Gskema\TypeSniff\Sniffs\CodeElement; -use Error; use Gskema\TypeSniff\Core\CodeElement\Element\AbstractFqcnElement; use Gskema\TypeSniff\Core\CodeElement\Element\ClassElement; use Gskema\TypeSniff\Core\CodeElement\Element\CodeElementInterface; @@ -11,6 +10,7 @@ use PHP_CodeSniffer\Files\File; use ReflectionClass; use ReflectionException; +use Throwable; class IteratorItemTypeSniff implements CodeElementSniffInterface { @@ -46,7 +46,7 @@ public function process(File $file, CodeElementInterface $element, CodeElementIn { try { $ref = new ReflectionClass($element->getFqcn()); - } catch (Error | ReflectionException) { + } catch (Throwable | ReflectionException) { return; // give up... }