diff --git a/src/Type/Generic/TemplateBenevolentUnionType.php b/src/Type/Generic/TemplateBenevolentUnionType.php index d9e1a100267..c8c2caaefdf 100644 --- a/src/Type/Generic/TemplateBenevolentUnionType.php +++ b/src/Type/Generic/TemplateBenevolentUnionType.php @@ -3,7 +3,6 @@ namespace PHPStan\Type\Generic; use PHPStan\Type\BenevolentUnionType; -use PHPStan\Type\NeverType; use PHPStan\Type\Type; /** @api */ @@ -51,9 +50,6 @@ public function withTypes(array $types): self public function filterTypes(callable $filterCb): Type { $result = parent::filterTypes($filterCb); - if ($result instanceof NeverType) { - return $result; - } if (!$result instanceof TemplateType) { return TemplateTypeFactory::create( $this->getScope(), diff --git a/src/Type/Generic/TemplateUnionType.php b/src/Type/Generic/TemplateUnionType.php index 6a9e7f49477..dc58af565aa 100644 --- a/src/Type/Generic/TemplateUnionType.php +++ b/src/Type/Generic/TemplateUnionType.php @@ -2,7 +2,6 @@ namespace PHPStan\Type\Generic; -use PHPStan\Type\NeverType; use PHPStan\Type\Type; use PHPStan\Type\UnionType; @@ -38,9 +37,6 @@ public function __construct( public function filterTypes(callable $filterCb): Type { $result = parent::filterTypes($filterCb); - if ($result instanceof NeverType) { - return $result; - } if (!$result instanceof TemplateType) { return TemplateTypeFactory::create( $this->getScope(),