File tree Expand file tree Collapse file tree 3 files changed +517
-1
lines changed Expand file tree Collapse file tree 3 files changed +517
-1
lines changed Original file line number Diff line number Diff line change 33namespace PHPStan \Doctrine \Mapping ;
44
55use Doctrine \Common \Annotations \AnnotationReader ;
6+ use Doctrine \Common \Annotations \DocParser ;
67use Doctrine \Common \EventManager ;
78use Doctrine \DBAL \Platforms \MySqlPlatform ;
89use Doctrine \ORM \Mapping \ClassMetadata ;
@@ -24,7 +25,9 @@ protected function initialize(): void
2425
2526 $ drivers = [];
2627 if (class_exists (AnnotationReader::class)) {
27- $ drivers [] = new AnnotationDriver (new AnnotationReader ());
28+ $ docParser = new DocParser ();
29+ $ docParser ->setIgnoreNotImportedAnnotations (true );
30+ $ drivers [] = new AnnotationDriver (new AnnotationReader ($ docParser ));
2831 }
2932 if (class_exists (AttributeDriver::class) && PHP_VERSION_ID >= 80000 ) {
3033 $ drivers [] = new AttributeDriver ([]);
Original file line number Diff line number Diff line change @@ -364,4 +364,14 @@ public function testEnumType(?string $objectManagerLoader): void
364364 ]);
365365 }
366366
367+ /**
368+ * @dataProvider dataObjectManagerLoader
369+ */
370+ public function testPhpStanBug6445 (?string $ objectManagerLoader ): void
371+ {
372+ $ this ->allowNullablePropertyForRequiredField = false ;
373+ $ this ->objectManagerLoader = $ objectManagerLoader ;
374+ $ this ->analyse ([__DIR__ . '/data/phpstan-bug-6445.php ' ], []);
375+ }
376+
367377}
You can’t perform that action at this time.
0 commit comments