diff --git a/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php b/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php index 3af7f3036da..4647bebab3c 100644 --- a/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php +++ b/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php @@ -4,11 +4,7 @@ namespace Doctrine\ORM\Mapping\Builder; -use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; - -use function get_class; /** * Builder Object for ClassMetadata @@ -17,29 +13,15 @@ */ class ClassMetadataBuilder { - /** @var ClassMetadataInfo */ + /** @var ClassMetadata */ private $cm; - public function __construct(ClassMetadataInfo $cm) + public function __construct(ClassMetadata $cm) { - if (! $cm instanceof ClassMetadata) { - Deprecation::trigger( - 'doctrine/orm', - 'https://github.com/doctrine/orm/pull/249', - 'Passing an instance of %s to %s is deprecated, please pass a ClassMetadata instance instead.', - get_class($cm), - __METHOD__, - ClassMetadata::class - ); - } - $this->cm = $cm; } - /** - * @return ClassMetadataInfo - */ - public function getClassMetadata() + public function getClassMetadata(): ClassMetadata { return $this->cm; } diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index 11c156ba7b0..17077acdd88 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -249,7 +249,7 @@ protected function validateRuntimeMetadata(ClassMetadata $class, ?ClassMetadataI } } } else { - assert($parent instanceof ClassMetadataInfo); // https://github.com/doctrine/orm/issues/8746 + assert($parent instanceof ClassMetadata); // https://github.com/doctrine/orm/issues/8746 if ( ! $class->reflClass->isAbstract() && ! in_array($class->name, $class->discriminatorMap, true) @@ -477,7 +477,7 @@ private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, Class * * @throws ORMException */ - private function completeIdGeneratorMapping(ClassMetadataInfo $class): void + private function completeIdGeneratorMapping(ClassMetadata $class): void { $idGenType = $class->generatorType; if ($idGenType === ClassMetadata::GENERATOR_TYPE_AUTO) { @@ -612,7 +612,7 @@ private function truncateSequenceName(string $schemaElementName): string /** * Inherits the ID generator mapping from a parent class. */ - private function inheritIdGeneratorMapping(ClassMetadataInfo $class, ClassMetadataInfo $parent): void + private function inheritIdGeneratorMapping(ClassMetadata $class, ClassMetadata $parent): void { if ($parent->isIdGeneratorSequence()) { $class->setSequenceGeneratorDefinition($parent->sequenceGeneratorDefinition); diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index 9b9799dc448..e6c3232f2b1 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -14,7 +14,6 @@ use Doctrine\Inflector\Inflector; use Doctrine\Inflector\InflectorFactory; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\MappingException; use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata; use Doctrine\Persistence\Mapping\Driver\MappingDriver; @@ -319,7 +318,7 @@ private function reverseEngineerMappingFromDatabase(): void /** * Build indexes from a class metadata. */ - private function buildIndexes(ClassMetadataInfo $metadata): void + private function buildIndexes(ClassMetadata $metadata): void { $tableName = $metadata->table['name']; $indexes = $this->tables[$tableName]->getIndexes(); @@ -342,7 +341,7 @@ private function buildIndexes(ClassMetadataInfo $metadata): void /** * Build field mapping from class metadata. */ - private function buildFieldMappings(ClassMetadataInfo $metadata): void + private function buildFieldMappings(ClassMetadata $metadata): void { $tableName = $metadata->table['name']; $columns = $this->tables[$tableName]->getColumns(); @@ -457,7 +456,7 @@ private function buildFieldMapping(string $tableName, Column $column): array * * @return void */ - private function buildToOneAssociationMappings(ClassMetadataInfo $metadata) + private function buildToOneAssociationMappings(ClassMetadata $metadata) { $tableName = $metadata->table['name']; $primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]); diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index aa8cb92b65a..8b3db0a7c9a 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -131,10 +131,7 @@ public function getOwner() return $this->owner; } - /** - * @return Mapping\ClassMetadata - */ - public function getTypeClass(): Mapping\ClassMetadataInfo + public function getTypeClass(): Mapping\ClassMetadata { return $this->typeClass; } diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index 23231e4eaa7..1cc79e5d2a0 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -5,10 +5,8 @@ namespace Doctrine\ORM\Tools; use Doctrine\DBAL\Types\Type; -use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataInfo; use function array_diff; use function array_key_exists; @@ -17,7 +15,6 @@ use function class_exists; use function class_parents; use function count; -use function get_class; use function implode; use function in_array; @@ -70,19 +67,8 @@ public function validateMapping() * @return string[] * @psalm-return list */ - public function validateClass(ClassMetadataInfo $class) + public function validateClass(ClassMetadata $class) { - if (! $class instanceof ClassMetadata) { - Deprecation::trigger( - 'doctrine/orm', - 'https://github.com/doctrine/orm/pull/249', - 'Passing an instance of %s to %s is deprecated, please pass a ClassMetadata instance instead.', - get_class($class), - __METHOD__, - ClassMetadata::class - ); - } - $ce = []; $cmf = $this->em->getMetadataFactory(); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1248b7147e5..35527c844e9 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -140,11 +140,6 @@ parameters: count: 1 path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - - - message: "#^Parameter \\#2 \\$class of method Doctrine\\\\ORM\\\\Mapping\\\\QuoteStrategy\\:\\:getSequenceName\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo given\\.$#" - count: 2 - path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - - message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\NamingStrategy\\:\\:joinColumnName\\(\\) invoked with 2 parameters, 1 required\\.$#" count: 2