| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Type; |
| 4: | |
| 5: | use PHPStan\Turbo\ShadowedByTurboExtension; |
| 6: | use PHPStan\Type\Generic\TemplateType; |
| 7: | |
| 8: | |
| 9: | #[ShadowedByTurboExtension(implementation: __DIR__ . '/../../turbo-ext/src/NonAcceptingNeverType.cpp')] |
| 10: | class NonAcceptingNeverType extends NeverType |
| 11: | { |
| 12: | |
| 13: | |
| 14: | public function __construct() |
| 15: | { |
| 16: | parent::__construct(true); |
| 17: | } |
| 18: | |
| 19: | public function isSuperTypeOf(Type $type): IsSuperTypeOfResult |
| 20: | { |
| 21: | if ($type instanceof self) { |
| 22: | return IsSuperTypeOfResult::createYes(); |
| 23: | } |
| 24: | if ($type instanceof parent) { |
| 25: | return IsSuperTypeOfResult::createMaybe(); |
| 26: | } |
| 27: | |
| 28: | if ($type instanceof TemplateType) { |
| 29: | return IsSuperTypeOfResult::createMaybe(); |
| 30: | } |
| 31: | |
| 32: | return IsSuperTypeOfResult::createNo(); |
| 33: | } |
| 34: | |
| 35: | public function accepts(Type $type, bool $strictTypes): AcceptsResult |
| 36: | { |
| 37: | if ($type instanceof NeverType) { |
| 38: | return AcceptsResult::createYes(); |
| 39: | } |
| 40: | |
| 41: | return AcceptsResult::createNo(); |
| 42: | } |
| 43: | |
| 44: | public function describe(VerbosityLevel $level): string |
| 45: | { |
| 46: | return 'never'; |
| 47: | } |
| 48: | |
| 49: | } |
| 50: | |