Skip to content

Commit

Permalink
Remove ClassMetadataInfo
Browse files Browse the repository at this point in the history
It has been deprecated for a long, long time.
  • Loading branch information
greg0ire committed May 2, 2022
1 parent 7cd0951 commit 4c5ca9d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 52 deletions.
24 changes: 3 additions & 21 deletions lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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]);
Expand Down
5 changes: 1 addition & 4 deletions lib/Doctrine/ORM/PersistentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 1 addition & 15 deletions lib/Doctrine/ORM/Tools/SchemaValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -70,19 +67,8 @@ public function validateMapping()
* @return string[]
* @psalm-return list<string>
*/
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();

Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c5ca9d

Please sign in to comment.