|
18 | 18 | use PHPStan\Type\Doctrine\Descriptors\DateTimeType;
|
19 | 19 | use PHPStan\Type\Doctrine\Descriptors\DateType;
|
20 | 20 | use PHPStan\Type\Doctrine\Descriptors\DecimalType;
|
| 21 | +use PHPStan\Type\Doctrine\Descriptors\EnumType; |
21 | 22 | use PHPStan\Type\Doctrine\Descriptors\IntegerType;
|
22 | 23 | use PHPStan\Type\Doctrine\Descriptors\JsonType;
|
23 | 24 | use PHPStan\Type\Doctrine\Descriptors\Ramsey\UuidTypeDescriptor;
|
|
26 | 27 | use PHPStan\Type\Doctrine\Descriptors\StringType;
|
27 | 28 | use PHPStan\Type\Doctrine\ObjectMetadataResolver;
|
28 | 29 | use function array_unshift;
|
| 30 | +use function defined; |
29 | 31 | use function strpos;
|
30 | 32 | use const PHP_VERSION_ID;
|
31 | 33 |
|
@@ -74,6 +76,7 @@ protected function getRule(): Rule
|
74 | 76 | new IntegerType(),
|
75 | 77 | new StringType(),
|
76 | 78 | new SimpleArrayType(),
|
| 79 | + new EnumType(), |
77 | 80 | new UuidTypeDescriptor(FakeTestingUuidType::class),
|
78 | 81 | new ReflectionDescriptor(CarbonImmutableType::class, $this->createReflectionProvider(), self::getContainer()),
|
79 | 82 | new ReflectionDescriptor(CarbonType::class, $this->createReflectionProvider(), self::getContainer()),
|
@@ -413,6 +416,20 @@ public function testEnumType(?string $objectManagerLoader): void
|
413 | 416 | ]);
|
414 | 417 | }
|
415 | 418 |
|
| 419 | + /** |
| 420 | + * @dataProvider dataObjectManagerLoader |
| 421 | + */ |
| 422 | + public function testEnumValues(?string $objectManagerLoader): void |
| 423 | + { |
| 424 | + if (!defined('\Doctrine\DBAL\Types\Types::ENUM')) { |
| 425 | + self::markTestSkipped('Test requires ENUM type.'); |
| 426 | + } |
| 427 | + |
| 428 | + $this->allowNullablePropertyForRequiredField = false; |
| 429 | + $this->objectManagerLoader = $objectManagerLoader; |
| 430 | + $this->analyse([__DIR__ . '/data-attributes/enum-values.php'], []); |
| 431 | + } |
| 432 | + |
416 | 433 | /**
|
417 | 434 | * @dataProvider dataObjectManagerLoader
|
418 | 435 | */
|
|
0 commit comments