diff --git a/phpstan-dbal2.neon b/phpstan-dbal2.neon
index 31f0f2823ab..98cba7badc1 100644
--- a/phpstan-dbal2.neon
+++ b/phpstan-dbal2.neon
@@ -74,3 +74,9 @@ parameters:
-
message: '#^Call to method injectObjectManager\(\) on an unknown class Doctrine\\Persistence\\ObjectManagerAware\.$#'
path: src/UnitOfWork.php
+
+ -
+ message: '#contains generic type.*but class.*is not generic#'
+ paths:
+ - src/Mapping/Driver/XmlDriver.php
+ - src/Mapping/Driver/YamlDriver.php
diff --git a/phpstan-persistence2.neon b/phpstan-persistence2.neon
index dfa68ac9ec8..931876129c3 100644
--- a/phpstan-persistence2.neon
+++ b/phpstan-persistence2.neon
@@ -64,3 +64,9 @@ parameters:
# Symfony cache supports passing a key prefix to the clear method.
- '/^Method Psr\\Cache\\CacheItemPoolInterface\:\:clear\(\) invoked with 1 parameter, 0 required\.$/'
+
+ -
+ message: '#contains generic type.*but class.*is not generic#'
+ paths:
+ - src/Mapping/Driver/XmlDriver.php
+ - src/Mapping/Driver/YamlDriver.php
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 2be2ff0b8c3..b9473bebb66 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -932,13 +932,8 @@
table]]>
-
- {'discriminator-column'}]]>
- {'discriminator-map'}]]>
-
-
$usage,
'region' => $region,
@@ -962,7 +957,6 @@
* options?: array
* }]]>
-
@@ -971,15 +965,6 @@
-
- {'discriminator-column'}]]>
- {'discriminator-map'}]]>
-
-
- getName() === 'embeddable']]>
- getName() === 'entity']]>
- getName() === 'mapped-superclass']]>
-
@@ -1011,38 +996,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Mapping/Driver/XmlDriver.php b/src/Mapping/Driver/XmlDriver.php
index 60223020dc9..c993a2ba794 100644
--- a/src/Mapping/Driver/XmlDriver.php
+++ b/src/Mapping/Driver/XmlDriver.php
@@ -37,6 +37,8 @@
* XmlDriver is a metadata driver that enables mapping through XML files.
*
* @link www.doctrine-project.org
+ *
+ * @template-extends FileDriver
*/
class XmlDriver extends FileDriver
{
@@ -79,7 +81,6 @@ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENS
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata)
{
$xmlRoot = $this->getElement($className);
- assert($xmlRoot instanceof SimpleXMLElement);
if ($xmlRoot->getName() === 'entity') {
if (isset($xmlRoot['repository-class'])) {
@@ -203,6 +204,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
];
if (isset($discrColumn['options'])) {
+ assert($discrColumn['options'] instanceof SimpleXMLElement);
$columnDef['options'] = $this->parseOptions($discrColumn['options']->children());
}
@@ -214,6 +216,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
// Evaluate
if (isset($xmlRoot->{'discriminator-map'})) {
$map = [];
+ assert($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} instanceof SimpleXMLElement);
foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} as $discrMapElement) {
$map[(string) $discrMapElement['value']] = (string) $discrMapElement['class'];
}
diff --git a/src/Mapping/Driver/YamlDriver.php b/src/Mapping/Driver/YamlDriver.php
index c6ff83e0f17..5e24b0b3a45 100644
--- a/src/Mapping/Driver/YamlDriver.php
+++ b/src/Mapping/Driver/YamlDriver.php
@@ -31,6 +31,8 @@
* The YamlDriver reads the mapping metadata from yaml schema files.
*
* @deprecated 2.7 This class is being removed from the ORM and won't have any replacement
+ *
+ * @template-extends FileDriver>
*/
class YamlDriver extends FileDriver
{