Skip to content

Commit bac0f7f

Browse files
authored
Fix Psalm and PHPStan errors for Doctrine Cache 2 (#176)
1 parent 385f2e6 commit bac0f7f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

phpstan-baseline.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ parameters:
22
ignoreErrors:
33
- "#^Call to an undefined method Doctrine\\\\Tests\\\\Persistence\\\\TestObject\\:\\:.+\\(\\)\\.$#"
44

5+
- "#^Instantiated class Doctrine\\\\Common\\\\Cache\\\\ArrayCache not found\\.$#"
6+
57
-
68
message: "#^Parameter \\#3 \\$nsSeparator of class Doctrine\\\\Persistence\\\\Mapping\\\\Driver\\\\SymfonyFileLocator constructor expects string, null given\\.$#"
79
count: 1

psalm.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,11 @@
3939
<file name="tests/Doctrine/Tests/Persistence/Mapping/SymfonyFileLocatorTest.php"/>
4040
</errorLevel>
4141
</NullArgument>
42+
<UndefinedClass>
43+
<errorLevel type="suppress">
44+
<!-- This test references ArrayCache which has been removed from Doctrine Cache -->
45+
<file name="tests/Doctrine/Tests/Persistence/Mapping/ClassMetadataFactoryTest.php"/>
46+
</errorLevel>
47+
</UndefinedClass>
4248
</issueHandlers>
4349
</psalm>

tests/Doctrine/Tests/Persistence/Mapping/ClassMetadataFactoryTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,12 @@ public function testWillIgnoreCacheEntriesThatAreNotMetadataInstances(): void
156156

157157
private function getArrayCache(): Cache
158158
{
159-
return class_exists(DoctrineProvider::class)
159+
$cache = class_exists(DoctrineProvider::class)
160160
? DoctrineProvider::wrap(new ArrayAdapter())
161161
: new ArrayCache();
162+
assert($cache instanceof Cache);
163+
164+
return $cache;
162165
}
163166
}
164167

0 commit comments

Comments
 (0)