File tree Expand file tree Collapse file tree 4 files changed +71
-79
lines changed Expand file tree Collapse file tree 4 files changed +71
-79
lines changed Original file line number Diff line number Diff line change 2525 "doctrine/dbal" : " ^2.13.8 || ^3.3.3" ,
2626 "doctrine/lexer" : " ^2.0 || ^3.0" ,
2727 "doctrine/mongodb-odm" : " ^1.3 || ^2.4.3" ,
28- "doctrine/orm" : " ^2.14 .0" ,
28+ "doctrine/orm" : " ^2.16 .0" ,
2929 "doctrine/persistence" : " ^2.2.1 || ^3.2" ,
3030 "gedmo/doctrine-extensions" : " ^3.8" ,
3131 "nesbot/carbon" : " ^2.49" ,
Original file line number Diff line number Diff line change @@ -37,3 +37,7 @@ parameters:
3737 -
3838 message : ' #^Call to method getProperty\(\) on an unknown class PHPStan\\BetterReflection\\Reflection\\Adapter\\ReflectionEnum\.$#'
3939 path : src/Rules/Gedmo/PropertiesExtension.php
40+ -
41+ message : ' #^Call to function method_exists\(\) with ' ' Doctrine\\\\ORM\\\\EntityManager' ' and ' ' create' ' will always evaluate to true\.$#'
42+ path : src/Doctrine/Mapping/ClassMetadataFactory.php
43+ reportUnmatched : false
Original file line number Diff line number Diff line change 1212use Doctrine \ORM \Mapping \Driver \AttributeDriver ;
1313use function class_exists ;
1414use function count ;
15+ use function method_exists ;
1516use const PHP_VERSION_ID ;
1617
1718class ClassMetadataFactory extends \Doctrine \ORM \Mapping \ClassMetadataFactory
@@ -47,7 +48,12 @@ protected function initialize(): void
4748 'memory ' => true ,
4849 ], $ config );
4950
50- $ em = EntityManager::create ($ connection , $ config );
51+ if (!method_exists (EntityManager::class, 'create ' )) {
52+ $ em = new EntityManager ($ connection , $ config );
53+ } else {
54+ $ em = EntityManager::create ($ connection , $ config );
55+ }
56+
5157 $ this ->setEntityManager ($ em );
5258 parent ::initialize ();
5359
@@ -59,7 +65,7 @@ protected function initialize(): void
5965 * @param class-string<T> $className
6066 * @return ClassMetadata<T>
6167 */
62- protected function newClassMetadataInstance ($ className )
68+ protected function newClassMetadataInstance ($ className ): ClassMetadata
6369 {
6470 return new ClassMetadata ($ className );
6571 }
You can’t perform that action at this time.
0 commit comments