File tree 3 files changed +517
-1
lines changed 3 files changed +517
-1
lines changed Original file line number Diff line number Diff line change 3
3
namespace PHPStan \Doctrine \Mapping ;
4
4
5
5
use Doctrine \Common \Annotations \AnnotationReader ;
6
+ use Doctrine \Common \Annotations \DocParser ;
6
7
use Doctrine \Common \EventManager ;
7
8
use Doctrine \DBAL \Platforms \MySqlPlatform ;
8
9
use Doctrine \ORM \Mapping \ClassMetadata ;
@@ -24,7 +25,9 @@ protected function initialize(): void
24
25
25
26
$ drivers = [];
26
27
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 ));
28
31
}
29
32
if (class_exists (AttributeDriver::class) && PHP_VERSION_ID >= 80000 ) {
30
33
$ drivers [] = new AttributeDriver ([]);
Original file line number Diff line number Diff line change @@ -364,4 +364,14 @@ public function testEnumType(?string $objectManagerLoader): void
364
364
]);
365
365
}
366
366
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
+
367
377
}
You can’t perform that action at this time.
0 commit comments