File tree 4 files changed +71
-79
lines changed
4 files changed +71
-79
lines changed Original file line number Diff line number Diff line change 25
25
"doctrine/dbal" : " ^2.13.8 || ^3.3.3" ,
26
26
"doctrine/lexer" : " ^2.0 || ^3.0" ,
27
27
"doctrine/mongodb-odm" : " ^1.3 || ^2.4.3" ,
28
- "doctrine/orm" : " ^2.14 .0" ,
28
+ "doctrine/orm" : " ^2.16 .0" ,
29
29
"doctrine/persistence" : " ^2.2.1 || ^3.2" ,
30
30
"gedmo/doctrine-extensions" : " ^3.8" ,
31
31
"nesbot/carbon" : " ^2.49" ,
Original file line number Diff line number Diff line change @@ -37,3 +37,7 @@ parameters:
37
37
-
38
38
message : ' #^Call to method getProperty\(\) on an unknown class PHPStan\\BetterReflection\\Reflection\\Adapter\\ReflectionEnum\.$#'
39
39
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 12
12
use Doctrine \ORM \Mapping \Driver \AttributeDriver ;
13
13
use function class_exists ;
14
14
use function count ;
15
+ use function method_exists ;
15
16
use const PHP_VERSION_ID ;
16
17
17
18
class ClassMetadataFactory extends \Doctrine \ORM \Mapping \ClassMetadataFactory
@@ -47,7 +48,12 @@ protected function initialize(): void
47
48
'memory ' => true ,
48
49
], $ config );
49
50
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
+
51
57
$ this ->setEntityManager ($ em );
52
58
parent ::initialize ();
53
59
@@ -59,7 +65,7 @@ protected function initialize(): void
59
65
* @param class-string<T> $className
60
66
* @return ClassMetadata<T>
61
67
*/
62
- protected function newClassMetadataInstance ($ className )
68
+ protected function newClassMetadataInstance ($ className ): ClassMetadata
63
69
{
64
70
return new ClassMetadata ($ className );
65
71
}
You can’t perform that action at this time.
0 commit comments