Skip to content

Commit

Permalink
ClassMetadataInfo -> ClassMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 8, 2024
1 parent 2f86657 commit 5a61257
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Rules/Doctrine/ORM/EntityColumnRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function processNode(Node $node, Scope $scope): array
}

$identifiers = [];
if ($metadata->generatorType !== 5) { // ClassMetadataInfo::GENERATOR_TYPE_NONE
if ($metadata->generatorType !== 5) { // ClassMetadata::GENERATOR_TYPE_NONE
try {
$identifiers = $metadata->getIdentifierFieldNames();
} catch (Throwable $e) {
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/Doctrine/ORM/EntityRelationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function processNode(Node $node, Scope $scope): array

$columnType = null;
$toMany = false;
if ((bool) ($associationMapping['type'] & 3)) { // ClassMetadataInfo::TO_ONE
if ((bool) ($associationMapping['type'] & 3)) { // ClassMetadata::TO_ONE
$columnType = new ObjectType($associationMapping['targetEntity']);
if (in_array($propertyName, $identifiers, true)) {
$nullable = false;
Expand All @@ -98,7 +98,7 @@ public function processNode(Node $node, Scope $scope): array
if ($nullable) {
$columnType = TypeCombinator::addNull($columnType);
}
} elseif ((bool) ($associationMapping['type'] & 12)) { // ClassMetadataInfo::TO_MANY
} elseif ((bool) ($associationMapping['type'] & 12)) { // ClassMetadata::TO_MANY
$toMany = true;
$columnType = TypeCombinator::intersect(
new ObjectType('Doctrine\Common\Collections\Collection'),
Expand Down
8 changes: 4 additions & 4 deletions src/Rules/Doctrine/ORM/PropertiesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PHPStan\Rules\Doctrine\ORM;

use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\Rules\Properties\ReadWritePropertiesExtension;
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
Expand Down Expand Up @@ -47,7 +47,7 @@ public function isAlwaysWritten(PropertyReflection $property, string $propertyNa

if (isset($metadata->fieldMappings[$propertyName])) {
$mapping = $metadata->fieldMappings[$propertyName];
if (array_key_exists('generated', $mapping) && $mapping['generated'] !== ClassMetadataInfo::GENERATED_NEVER) {
if (array_key_exists('generated', $mapping) && $mapping['generated'] !== ClassMetadata::GENERATED_NEVER) {
return true;
}
}
Expand Down Expand Up @@ -84,9 +84,9 @@ public function isInitialized(PropertyReflection $property, string $propertyName
}

/**
* @param ClassMetadataInfo<object> $metadata
* @param ClassMetadata<object> $metadata
*/
private function isGeneratedIdentifier(ClassMetadataInfo $metadata, string $propertyName): bool
private function isGeneratedIdentifier(ClassMetadata $metadata, string $propertyName): bool
{
if ($metadata->isIdentifierNatural()) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/Type/Doctrine/ObjectMetadataResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace PHPStan\Type\Doctrine;

use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\ObjectManager;
use PHPStan\Doctrine\Mapping\ClassMetadataFactory;
Expand Down Expand Up @@ -108,9 +108,9 @@ private function getMetadataFactory(): ?ClassMetadataFactory
/**
* @template T of object
* @param class-string<T> $className
* @return ClassMetadataInfo<T>|null
* @return ClassMetadata<T>|null
*/
public function getClassMetadata(string $className): ?ClassMetadataInfo
public function getClassMetadata(string $className): ?ClassMetadata
{
if ($this->isTransient($className)) {
return null;
Expand All @@ -135,11 +135,11 @@ public function getClassMetadata(string $className): ?ClassMetadataInfo
return null;
}

if (!$metadata instanceof ClassMetadataInfo) {
if (!$metadata instanceof ClassMetadata) {
return null;
}

/** @var ClassMetadataInfo<T> $ormMetadata */
/** @var ClassMetadata<T> $ormMetadata */
$ormMetadata = $metadata;

return $ormMetadata;
Expand Down
6 changes: 3 additions & 3 deletions src/Type/Doctrine/Query/QueryResultTypeWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use BackedEnum;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\AST;
use Doctrine\ORM\Query\AST\TypedExpression;
Expand Down Expand Up @@ -1285,10 +1285,10 @@ private function isQueryComponentNullable(string $dqlAlias): bool
}

/**
* @param ClassMetadataInfo<object> $class
* @param ClassMetadata<object> $class
* @return array{string, ?class-string<BackedEnum>} Doctrine type name and enum type of field
*/
private function getTypeOfField(ClassMetadataInfo $class, string $fieldName): array
private function getTypeOfField(ClassMetadata $class, string $fieldName): array
{
assert(isset($class->fieldMappings[$fieldName]));

Expand Down

0 comments on commit 5a61257

Please sign in to comment.