|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace AdapterReflectionEnumReturnTypes; |
| 4 | + |
| 5 | +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum; |
| 6 | +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnumBackedCase; |
| 7 | +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnumUnitCase; |
| 8 | +use function PHPStan\Testing\assertType; |
| 9 | + |
| 10 | +function (ReflectionEnum $r, string $s): void { |
| 11 | + assertType('non-empty-string|false', $r->getFileName()); |
| 12 | + assertType('int|false', $r->getStartLine()); |
| 13 | + assertType('int|false', $r->getEndLine()); |
| 14 | + assertType('string|false', $r->getDocComment()); |
| 15 | + assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionClassConstant|false', $r->getReflectionConstant($s)); |
| 16 | + assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass|false', $r->getParentClass()); |
| 17 | + assertType('non-empty-string|false', $r->getExtensionName()); |
| 18 | + assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType|null', $r->getBackingType()); |
| 19 | +}; |
| 20 | + |
| 21 | +function (ReflectionEnumBackedCase $r): void { |
| 22 | + assertType('string|false', $r->getDocComment()); |
| 23 | + assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionIntersectionType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionUnionType|null', $r->getType()); |
| 24 | +}; |
| 25 | + |
| 26 | +function (ReflectionEnumUnitCase $r): void { |
| 27 | + assertType('string|false', $r->getDocComment()); |
| 28 | + assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionIntersectionType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionUnionType|null', $r->getType()); |
| 29 | +}; |
0 commit comments