diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index d1605f3434..f16ef8453e 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -10,6 +10,7 @@ use Doctrine\ORM\Events; use Doctrine\ORM\Mapping; use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder; +use Doctrine\ORM\Mapping\ClassMetadata as Metadata; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\MappingException; use Doctrine\Persistence\Mapping\ClassMetadata; @@ -69,10 +70,14 @@ public function __construct($reader, $paths = null) /** * {@inheritDoc} + * + * @psalm-param class-string $className + * @psalm-param Metadata $metadata + * + * @template T of object */ public function loadMetadataForClass($className, ClassMetadata $metadata) { - assert($metadata instanceof Mapping\ClassMetadata); $class = $metadata->getReflectionClass() // this happens when running annotation driver in combination with // static reflection services. This is not the nicest fix diff --git a/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php index b318474d93..88224261e1 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php @@ -8,6 +8,7 @@ use Doctrine\ORM\Events; use Doctrine\ORM\Mapping; use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder; +use Doctrine\ORM\Mapping\ClassMetadata as Metadata; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\MappingException; use Doctrine\Persistence\Mapping\ClassMetadata; @@ -98,10 +99,16 @@ public function isTransient($className) return true; } + /** + * {@inheritDoc} + * + * @psalm-param class-string $className + * @psalm-param Metadata $metadata + * + * @template T of object + */ public function loadMetadataForClass($className, ClassMetadata $metadata): void { - assert($metadata instanceof ClassMetadataInfo); - $reflectionClass = $metadata->getReflectionClass(); $classAttributes = $this->reader->getClassAnnotations($reflectionClass); diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index bef8e1fe8e..202c83a9ab 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -12,6 +12,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\Inflector\Inflector; use Doctrine\Inflector\InflectorFactory; +use Doctrine\ORM\Mapping\ClassMetadata as Metadata; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\MappingException; use Doctrine\Persistence\Mapping\ClassMetadata; @@ -21,6 +22,7 @@ use function array_diff; use function array_keys; use function array_merge; +use function assert; use function count; use function current; use function in_array; @@ -166,6 +168,11 @@ public function setInflector(Inflector $inflector): void /** * {@inheritDoc} + * + * @psalm-param class-string $className + * @psalm-param Metadata $metadata + * + * @template T of object */ public function loadMetadataForClass($className, ClassMetadata $metadata) { diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index 03c599480f..9a8a8e14aa 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -53,6 +53,11 @@ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENS /** * {@inheritDoc} + * + * @psalm-param class-string $className + * @psalm-param Metadata $metadata + * + * @template T of object */ public function loadMetadataForClass($className, ClassMetadata $metadata) { diff --git a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index 693555af1a..c79ecd246c 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -15,6 +15,7 @@ use Symfony\Component\Yaml\Yaml; use function array_map; +use function assert; use function class_exists; use function constant; use function defined; @@ -60,6 +61,11 @@ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENS /** * {@inheritDoc} + * + * @psalm-param class-string $className + * @psalm-param Metadata $metadata + * + * @template T of object */ public function loadMetadataForClass($className, ClassMetadata $metadata) { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index bb7e666e89..a68039ee83 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -260,186 +260,6 @@ parameters: count: 1 path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$name\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$table\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapManyToMany\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php - - - - message: "#^Parameter \\#1 \\$metadata of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\DatabaseDriver\\:\\:buildFieldMappings\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\ given\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php - - - - message: "#^Parameter \\#1 \\$metadata of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\DatabaseDriver\\:\\:buildIndexes\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\ given\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php - - - - message: "#^Parameter \\#1 \\$metadata of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\DatabaseDriver\\:\\:buildToOneAssociationMappings\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\ given\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$inheritanceType\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$isEmbeddedClass\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$isMappedSuperclass\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$table\\.$#" - count: 3 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addEntityListener\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addLifecycleCallback\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addNamedNativeQuery\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addNamedQuery\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addSqlResultSetMapping\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:enableCache\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:getAssociationCacheDefaults\\(\\)\\.$#" - count: 4 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapEmbedded\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapField\\(\\)\\.$#" - count: 3 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapManyToMany\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapManyToOne\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapOneToMany\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapOneToOne\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:markReadOnly\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setAssociationOverride\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setAttributeOverride\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setChangeTrackingPolicy\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setCustomGeneratorDefinition\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setCustomRepositoryClass\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setDiscriminatorColumn\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setDiscriminatorMap\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setIdGeneratorType\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setInheritanceType\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setPrimaryTable\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setSequenceGeneratorDefinition\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setVersionMapping\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - message: "#^Empty array passed to foreach\\.$#" count: 1 @@ -450,171 +270,11 @@ parameters: count: 1 path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - message: "#^Parameter \\#1 \\$metadata of static method Doctrine\\\\ORM\\\\Mapping\\\\Builder\\\\EntityListenerBuilder\\:\\:bindEntityListener\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\ given\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$inheritanceType\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$isEmbeddedClass\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$isMappedSuperclass\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$table\\.$#" - count: 3 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addEntityListener\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addLifecycleCallback\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addNamedNativeQuery\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addNamedQuery\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:addSqlResultSetMapping\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:enableCache\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:getAssociationCacheDefaults\\(\\)\\.$#" - count: 4 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapEmbedded\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapField\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapManyToMany\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapManyToOne\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapOneToMany\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:mapOneToOne\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:markReadOnly\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setAssociationOverride\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setAttributeOverride\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setChangeTrackingPolicy\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setCustomGeneratorDefinition\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setCustomRepositoryClass\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setDiscriminatorColumn\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setDiscriminatorMap\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setIdGeneratorType\\(\\)\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setInheritanceType\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setPrimaryTable\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setSequenceGeneratorDefinition\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:setVersionMapping\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - message: "#^Offset 'usage' on array\\{usage\\: string, region\\?\\: string\\} in isset\\(\\) always exists and is not nullable\\.$#" count: 1 path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - - message: "#^Parameter \\#1 \\$metadata of static method Doctrine\\\\ORM\\\\Mapping\\\\Builder\\\\EntityListenerBuilder\\:\\:bindEntityListener\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\ given\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php - - message: "#^Call to function is_int\\(\\) with string will always evaluate to false\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index ad5b01db83..7923a0c1a7 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -729,6 +729,9 @@ $mapping + + $metadata + $listenerClassName @@ -749,9 +752,6 @@ - - $metadata - $value[0] $value[0] @@ -761,6 +761,9 @@ $mapping + + $metadata + $listenerClassName @@ -775,22 +778,16 @@ - - $metadata - $metadata - $metadata - $this->namespace . $this->classNamesForTables[$tableName] $this->namespace . $this->inflector->classify(strtolower($tableName)) + + $metadata + class-string - - $metadata->name - $metadata->table - $this->tables[$tableName] $this->tables[$tableName] @@ -806,9 +803,9 @@ getColumns getIndexes - - mapManyToMany - + + $metadata->table + @@ -828,34 +825,42 @@ - - $metadata + + $map + (string) $xmlRoot['repository-class'] + isset($xmlRoot['repository-class']) ? (string) $xmlRoot['repository-class'] : null + + addNamedNativeQuery + addNamedQuery + $xmlRoot->getName() === 'embeddable' $xmlRoot->getName() === 'entity' $xmlRoot->getName() === 'mapped-superclass' + + $this->cacheToArray($manyToManyElement->cache) + $this->cacheToArray($manyToOneElement->cache) + $this->cacheToArray($oneToManyElement->cache) + $this->cacheToArray($oneToOneElement->cache) + + + $metadata->table + $fileExtension $locator + + $metadata + array{usage: int|null, region?: string} - + $indexXml->options - $metadata->inheritanceType - $metadata->isEmbeddedClass - $metadata->isMappedSuperclass - $metadata->table - $metadata->table - $metadata->table - $metadata->table - $metadata->table - $metadata->table - $metadata->table $uniqueXml->options @@ -883,47 +888,12 @@ isset($xmlRoot->{'sql-result-set-mappings'}) isset($xmlRoot->{'unique-constraints'}) - - addEntityListener - addLifecycleCallback - addNamedNativeQuery - addNamedQuery - addSqlResultSetMapping - enableCache - getAssociationCacheDefaults - getAssociationCacheDefaults - getAssociationCacheDefaults - getAssociationCacheDefaults - mapEmbedded - mapField - mapField - mapField - mapManyToMany - mapManyToOne - mapOneToMany - mapOneToOne - markReadOnly - setAssociationOverride - setAttributeOverride - setChangeTrackingPolicy - setCustomGeneratorDefinition - setCustomRepositoryClass - setCustomRepositoryClass - setDiscriminatorColumn - setDiscriminatorColumn - setDiscriminatorMap - setIdGeneratorType - setInheritanceType - setPrimaryTable - setSequenceGeneratorDefinition - setVersionMapping - setVersionMapping - - - $metadata - + + addNamedNativeQuery + addNamedQuery + private function cacheToArray(array $cacheMapping): array @@ -931,14 +901,9 @@ $fileExtension $locator - - $metadata->inheritanceType - $metadata->isEmbeddedClass - $metadata->isMappedSuperclass - $metadata->table - $metadata->table - $metadata->table - + + $metadata + $element $element @@ -959,7 +924,10 @@ $element $element - + + $metadata->table + + $element $element $element @@ -970,39 +938,6 @@ $element $element $element - addEntityListener - addLifecycleCallback - addNamedNativeQuery - addNamedQuery - addSqlResultSetMapping - enableCache - getAssociationCacheDefaults - getAssociationCacheDefaults - getAssociationCacheDefaults - getAssociationCacheDefaults - mapEmbedded - mapField - mapField - mapManyToMany - mapManyToOne - mapOneToMany - mapOneToOne - markReadOnly - setAssociationOverride - setAttributeOverride - setChangeTrackingPolicy - setCustomGeneratorDefinition - setCustomRepositoryClass - setCustomRepositoryClass - setDiscriminatorColumn - setDiscriminatorColumn - setDiscriminatorMap - setIdGeneratorType - setIdGeneratorType - setInheritanceType - setPrimaryTable - setSequenceGeneratorDefinition - setVersionMapping diff --git a/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php b/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php index d2b7d67ea7..a7e580646d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php +++ b/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTestCase.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Driver\DatabaseDriver; use Doctrine\Tests\OrmFunctionalTestCase; @@ -31,7 +31,7 @@ protected function convertToClassMetadata(array $entityTables, array $manyTables $metadatas = []; foreach ($driver->getAllClassNames() as $className) { - $class = new ClassMetadataInfo($className); + $class = new ClassMetadata($className); $driver->loadMetadataForClass($className, $class); $metadatas[$className] = $class; } @@ -57,7 +57,7 @@ protected function extractClassMetadata(array $classNames): array continue; } - $class = new ClassMetadataInfo($className); + $class = new ClassMetadata($className); $driver->loadMetadataForClass($className, $class); $metadatas[$className] = $class; }