diff --git a/UPGRADE.md b/UPGRADE.md index 975c567a5bf..18a4bd192ea 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -746,6 +746,12 @@ Progress on this is tracked at https://github.com/doctrine/orm/issues/11624 . Use of the PARTIAL keyword is not deprecated anymore in DQL when used with a hydrator that is not creating entities, such as the ArrayHydrator. +## Deprecate `\Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker()` + +Use the `\Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER` query hint to set the output walker +class instead of setting it through the `\Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker()` method +on the parser instance. + # Upgrade to 2.19 ## Deprecate calling `ClassMetadata::getAssociationMappedByTargetField()` with the owning side of an association diff --git a/src/Cache/CollectionCacheKey.php b/src/Cache/CollectionCacheKey.php index 51b408f3e22..d653fed0dad 100644 --- a/src/Cache/CollectionCacheKey.php +++ b/src/Cache/CollectionCacheKey.php @@ -22,8 +22,8 @@ class CollectionCacheKey extends CacheKey public readonly array $ownerIdentifier; /** + * @param class-string $entityClass The owner entity class. * @param array $ownerIdentifier The identifier of the owning entity. - * @param class-string $entityClass The owner entity class */ public function __construct( public readonly string $entityClass, diff --git a/src/Cache/EntityCacheEntry.php b/src/Cache/EntityCacheEntry.php index 69bc81379d0..c66a1834bec 100644 --- a/src/Cache/EntityCacheEntry.php +++ b/src/Cache/EntityCacheEntry.php @@ -11,8 +11,8 @@ class EntityCacheEntry implements CacheEntry { /** - * @param array $data The entity map data - * @psalm-param class-string $class The entity class name + * @param class-string $class The entity class name + * @param array $data The entity map data */ public function __construct( public readonly string $class, diff --git a/src/Configuration.php b/src/Configuration.php index b30764eb2b9..59ddb214d8a 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -263,8 +263,8 @@ public function getCustomNumericFunction(string $name): string|callable|null * * Any previously added numeric functions are discarded. * - * @psalm-param array $functions The map of custom - * DQL numeric functions. + * @param array $functions The map of custom + * DQL numeric functions. */ public function setCustomNumericFunctions(array $functions): void { @@ -291,7 +291,7 @@ public function addCustomDatetimeFunction(string $name, string|callable $classNa /** * Gets the implementation class name of a registered custom date/time DQL function. * - * @psalm-return class-string|callable|null + * @return class-string|callable|null */ public function getCustomDatetimeFunction(string $name): string|callable|null { @@ -351,7 +351,7 @@ public function setCustomHydrationModes(array $modes): void /** * Gets the hydrator class for the given hydration mode name. * - * @psalm-return class-string|null + * @return class-string|null */ public function getCustomHydrationMode(string $modeName): string|null { @@ -361,7 +361,7 @@ public function getCustomHydrationMode(string $modeName): string|null /** * Adds a custom hydration mode. * - * @psalm-param class-string $hydrator + * @param class-string $hydrator */ public function addCustomHydrationMode(string $modeName, string $hydrator): void { @@ -371,14 +371,14 @@ public function addCustomHydrationMode(string $modeName, string $hydrator): void /** * Sets a class metadata factory. * - * @psalm-param class-string $cmfName + * @param class-string $cmfName */ public function setClassMetadataFactoryName(string $cmfName): void { $this->attributes['classMetadataFactoryName'] = $cmfName; } - /** @psalm-return class-string */ + /** @return class-string */ public function getClassMetadataFactoryName(): string { if (! isset($this->attributes['classMetadataFactoryName'])) { @@ -391,8 +391,7 @@ public function getClassMetadataFactoryName(): string /** * Adds a filter to the list of possible filters. * - * @param string $className The class name of the filter. - * @psalm-param class-string $className + * @param class-string $className The class name of the filter. */ public function addFilter(string $name, string $className): void { @@ -402,9 +401,8 @@ public function addFilter(string $name, string $className): void /** * Gets the class name for a given filter name. * - * @return string|null The class name of the filter, or null if it is not - * defined. - * @psalm-return class-string|null + * @return class-string|null The class name of the filter, + * or null if it is not defined. */ public function getFilterClassName(string $name): string|null { @@ -414,7 +412,7 @@ public function getFilterClassName(string $name): string|null /** * Sets default repository class. * - * @psalm-param class-string $className + * @param class-string $className * * @throws InvalidEntityRepository If $classname is not an ObjectRepository. */ @@ -430,7 +428,7 @@ public function setDefaultRepositoryClassName(string $className): void /** * Get default repository class. * - * @psalm-return class-string + * @return class-string */ public function getDefaultRepositoryClassName(): string { diff --git a/src/EntityManager.php b/src/EntityManager.php index 8045ac2f5e3..4e1dfaf5816 100644 --- a/src/EntityManager.php +++ b/src/EntityManager.php @@ -479,9 +479,9 @@ public function lock(object $entity, LockMode|int $lockMode, DateTimeInterface|i /** * Gets the repository for an entity class. * - * @psalm-param class-string $className + * @param class-string $className The name of the entity. * - * @psalm-return EntityRepository + * @return EntityRepository The repository class. * * @template T of object */ diff --git a/src/EntityManagerInterface.php b/src/EntityManagerInterface.php index cf3102bb41b..d4c64ef06dc 100644 --- a/src/EntityManagerInterface.php +++ b/src/EntityManagerInterface.php @@ -22,9 +22,9 @@ interface EntityManagerInterface extends ObjectManager /** * {@inheritDoc} * - * @psalm-param class-string $className + * @param class-string $className * - * @psalm-return EntityRepository + * @return EntityRepository * * @template T of object */ @@ -151,11 +151,10 @@ public function refresh(object $object, LockMode|int|null $lockMode = null): voi * Gets a reference to the entity identified by the given type and identifier * without actually loading it, if the entity is not yet loaded. * - * @param string $entityName The name of the entity type. - * @param mixed $id The entity identifier. - * @psalm-param class-string $entityName + * @param class-string $entityName The name of the entity type. + * @param mixed $id The entity identifier. * - * @psalm-return T|null + * @return T|null The entity reference. * * @throws ORMException * @@ -232,7 +231,7 @@ public function hasFilters(): bool; /** * {@inheritDoc} * - * @psalm-param string|class-string $className + * @param string|class-string $className * * @psalm-return ($className is class-string ? Mapping\ClassMetadata : Mapping\ClassMetadata) * diff --git a/src/EntityRepository.php b/src/EntityRepository.php index ad472315398..87a264344f7 100644 --- a/src/EntityRepository.php +++ b/src/EntityRepository.php @@ -35,11 +35,11 @@ */ class EntityRepository implements ObjectRepository, Selectable { - /** @psalm-var class-string */ + /** @var class-string */ private readonly string $entityName; private static Inflector|null $inflector = null; - /** @psalm-param ClassMetadata $class */ + /** @param ClassMetadata $class */ public function __construct( private readonly EntityManagerInterface $em, private readonly ClassMetadata $class, @@ -169,7 +169,7 @@ public function __call(string $method, array $arguments): mixed )); } - /** @psalm-return class-string */ + /** @return class-string */ protected function getEntityName(): string { return $this->entityName; diff --git a/src/Internal/Hydration/ObjectHydrator.php b/src/Internal/Hydration/ObjectHydrator.php index f151fb813ca..fe780e8b892 100644 --- a/src/Internal/Hydration/ObjectHydrator.php +++ b/src/Internal/Hydration/ObjectHydrator.php @@ -265,7 +265,7 @@ private function getEntity(array $data, string $dqlAlias): object } /** - * @psalm-param class-string $className + * @param class-string $className * @psalm-param array $data */ private function getEntityFromIdentityMap(string $className, array $data): object|bool diff --git a/src/Mapping/Builder/ClassMetadataBuilder.php b/src/Mapping/Builder/ClassMetadataBuilder.php index b9d3cc81f5e..48f052c86d5 100644 --- a/src/Mapping/Builder/ClassMetadataBuilder.php +++ b/src/Mapping/Builder/ClassMetadataBuilder.php @@ -169,8 +169,8 @@ public function setSingleTableInheritance(): static /** * Sets the discriminator column details. * - * @psalm-param class-string|null $enumType - * @psalm-param array $options + * @param class-string|null $enumType + * @param array $options * * @return $this */ diff --git a/src/Mapping/ClassMetadataFactory.php b/src/Mapping/ClassMetadataFactory.php index a3a47018081..db0a8cf5500 100644 --- a/src/Mapping/ClassMetadataFactory.php +++ b/src/Mapping/ClassMetadataFactory.php @@ -399,7 +399,7 @@ private function peekIfIsMappedSuperclass(string $className): bool /** * Gets the lower-case short name of a class. * - * @psalm-param class-string $className + * @param class-string $className */ private function getShortName(string $className): string { diff --git a/src/Mapping/DefaultEntityListenerResolver.php b/src/Mapping/DefaultEntityListenerResolver.php index 0b3e7a26724..4878fbdd429 100644 --- a/src/Mapping/DefaultEntityListenerResolver.php +++ b/src/Mapping/DefaultEntityListenerResolver.php @@ -11,7 +11,7 @@ */ class DefaultEntityListenerResolver implements EntityListenerResolver { - /** @psalm-var array Map to store entity listener instances. */ + /** @var array Map to store entity listener instances. */ private array $instances = []; public function clear(string|null $className = null): void diff --git a/src/Mapping/Driver/AttributeDriver.php b/src/Mapping/Driver/AttributeDriver.php index 9ba3481e3ba..da125fc394d 100644 --- a/src/Mapping/Driver/AttributeDriver.php +++ b/src/Mapping/Driver/AttributeDriver.php @@ -69,8 +69,8 @@ public function isTransient(string $className): bool /** * {@inheritDoc} * - * @psalm-param class-string $className - * @psalm-param ClassMetadata $metadata + * @param class-string $className + * @param ClassMetadata $metadata * * @template T of object */ diff --git a/src/Mapping/Driver/DatabaseDriver.php b/src/Mapping/Driver/DatabaseDriver.php index 301e44a97e2..d012c0a85bd 100644 --- a/src/Mapping/Driver/DatabaseDriver.php +++ b/src/Mapping/Driver/DatabaseDriver.php @@ -153,8 +153,8 @@ public function setInflector(Inflector $inflector): void /** * {@inheritDoc} * - * @psalm-param class-string $className - * @psalm-param ClassMetadata $metadata + * @param class-string $className + * @param ClassMetadata $metadata * * @template T of object */ @@ -493,7 +493,7 @@ private function getTablePrimaryKeys(Table $table): array /** * Returns the mapped class name for a table if it exists. Otherwise return "classified" version. * - * @psalm-return class-string + * @return class-string */ private function getClassNameForTable(string $tableName): string { diff --git a/src/Mapping/Driver/XmlDriver.php b/src/Mapping/Driver/XmlDriver.php index 49f2d34d941..30e85900e2e 100644 --- a/src/Mapping/Driver/XmlDriver.php +++ b/src/Mapping/Driver/XmlDriver.php @@ -72,8 +72,8 @@ public function __construct( /** * {@inheritDoc} * - * @psalm-param class-string $className - * @psalm-param ClassMetadata $metadata + * @param class-string $className + * @param ClassMetadata $metadata * * @template T of object */ @@ -891,19 +891,19 @@ protected function loadMappingFile($file) if (isset($xmlElement->entity)) { foreach ($xmlElement->entity as $entityElement) { - /** @psalm-var class-string $entityName */ + /** @var class-string $entityName */ $entityName = (string) $entityElement['name']; $result[$entityName] = $entityElement; } } elseif (isset($xmlElement->{'mapped-superclass'})) { foreach ($xmlElement->{'mapped-superclass'} as $mappedSuperClass) { - /** @psalm-var class-string $className */ + /** @var class-string $className */ $className = (string) $mappedSuperClass['name']; $result[$className] = $mappedSuperClass; } } elseif (isset($xmlElement->embeddable)) { foreach ($xmlElement->embeddable as $embeddableElement) { - /** @psalm-var class-string $embeddableName */ + /** @var class-string $embeddableName */ $embeddableName = (string) $embeddableElement['name']; $result[$embeddableName] = $embeddableElement; } diff --git a/src/Mapping/MappedSuperclass.php b/src/Mapping/MappedSuperclass.php index 29475a280b5..de0d4ba0f23 100644 --- a/src/Mapping/MappedSuperclass.php +++ b/src/Mapping/MappedSuperclass.php @@ -10,7 +10,7 @@ #[Attribute(Attribute::TARGET_CLASS)] final class MappedSuperclass implements MappingAttribute { - /** @psalm-param class-string|null $repositoryClass */ + /** @param class-string|null $repositoryClass */ public function __construct( public readonly string|null $repositoryClass = null, ) { diff --git a/src/Query/Parser.php b/src/Query/Parser.php index 875783c87d4..db3a8b8d6e4 100644 --- a/src/Query/Parser.php +++ b/src/Query/Parser.php @@ -5,6 +5,7 @@ namespace Doctrine\ORM\Query; use Doctrine\Common\Lexer\Token; +use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Internal\Hydration\HydrationException; use Doctrine\ORM\Mapping\AssociationMapping; @@ -50,7 +51,7 @@ final class Parser { /** * @readonly Maps BUILT-IN string function names to AST class names. - * @psalm-var array> + * @var array> */ private static array $stringFunctions = [ 'concat' => Functions\ConcatFunction::class, @@ -63,7 +64,7 @@ final class Parser /** * @readonly Maps BUILT-IN numeric function names to AST class names. - * @psalm-var array> + * @var array> */ private static array $numericFunctions = [ 'length' => Functions\LengthFunction::class, @@ -86,7 +87,7 @@ final class Parser /** * @readonly Maps BUILT-IN datetime function names to AST class names. - * @psalm-var array> + * @var array> */ private static array $datetimeFunctions = [ 'current_date' => Functions\CurrentDateFunction::class, @@ -146,7 +147,7 @@ final class Parser /** * Any additional custom tree walkers that modify the AST. * - * @psalm-var list> + * @var list> */ private array $customTreeWalkers = []; @@ -176,17 +177,24 @@ public function __construct(private readonly Query $query) * Sets a custom tree walker that produces output. * This tree walker will be run last over the AST, after any other walkers. * - * @psalm-param class-string $className + * @param class-string $className */ public function setCustomOutputTreeWalker(string $className): void { + Deprecation::trigger( + 'doctrine/orm', + 'https://github.com/doctrine/orm/pull/11641', + '%s is deprecated, set the output walker class with the \Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER query hint instead', + __METHOD__, + ); + $this->customOutputWalker = $className; } /** * Adds a custom tree walker for modifying the AST. * - * @psalm-param class-string $className + * @param class-string $className */ public function addCustomTreeWalker(string $className): void { diff --git a/src/Query/ResultSetMapping.php b/src/Query/ResultSetMapping.php index c95b089a73b..15b095d8482 100644 --- a/src/Query/ResultSetMapping.php +++ b/src/Query/ResultSetMapping.php @@ -39,7 +39,7 @@ class ResultSetMapping * Maps alias names to class names. * * @ignore - * @psalm-var array + * @var array */ public array $aliasMap = []; @@ -135,7 +135,7 @@ class ResultSetMapping * Map from column names to class names that declare the field the column is mapped to. * * @ignore - * @psalm-var array + * @var array */ public array $declaringClasses = []; @@ -177,12 +177,11 @@ class ResultSetMapping /** * Adds an entity result to this ResultSetMapping. * - * @param string $class The class name of the entity. - * @param string $alias The alias for the class. The alias must be unique among all entity - * results or joined entity results within this ResultSetMapping. - * @param string|null $resultAlias The result alias with which the entity result should be - * placed in the result structure. - * @psalm-param class-string $class + * @param class-string $class The class name of the entity. + * @param string $alias The alias for the class. The alias must be unique among all entity + * results or joined entity results within this ResultSetMapping. + * @param string|null $resultAlias The result alias with which the entity result should be + * placed in the result structure. * * @return $this * @@ -310,15 +309,14 @@ public function isFieldResult(string $columnName): bool /** * Adds a field to the result that belongs to an entity or joined entity. * - * @param string $alias The alias of the root entity or joined entity to which the field belongs. - * @param string $columnName The name of the column in the SQL result set. - * @param string $fieldName The name of the field on the declaring class. - * @param string|null $declaringClass The name of the class that declares/owns the specified field. - * When $alias refers to a superclass in a mapped hierarchy but - * the field $fieldName is defined on a subclass, specify that here. - * If not specified, the field is assumed to belong to the class - * designated by $alias. - * @psalm-param class-string|null $declaringClass + * @param string $alias The alias of the root entity or joined entity to which the field belongs. + * @param string $columnName The name of the column in the SQL result set. + * @param string $fieldName The name of the field on the declaring class. + * @param class-string|null $declaringClass The name of the class that declares/owns the specified field. + * When $alias refers to a superclass in a mapped hierarchy but + * the field $fieldName is defined on a subclass, specify that here. + * If not specified, the field is assumed to belong to the class + * designated by $alias. * * @return $this * @@ -343,12 +341,11 @@ public function addFieldResult(string $alias, string $columnName, string $fieldN /** * Adds a joined entity result. * - * @param string $class The class name of the joined entity. - * @param string $alias The unique alias to use for the joined entity. - * @param string $parentAlias The alias of the entity result that is the parent of this joined result. - * @param string $relation The association field that connects the parent entity result - * with the joined entity result. - * @psalm-param class-string $class + * @param class-string $class The class name of the joined entity. + * @param string $alias The unique alias to use for the joined entity. + * @param string $parentAlias The alias of the entity result that is the parent of this joined result. + * @param string $relation The association field that connects the parent entity result + * with the joined entity result. * * @return $this * @@ -492,7 +489,7 @@ public function getFieldName(string $columnName): string return $this->fieldMappings[$columnName]; } - /** @psalm-return array */ + /** @return array */ public function getAliasMap(): array { return $this->aliasMap; diff --git a/src/Query/ResultSetMappingBuilder.php b/src/Query/ResultSetMappingBuilder.php index f28f3a9c005..f74763c138a 100644 --- a/src/Query/ResultSetMappingBuilder.php +++ b/src/Query/ResultSetMappingBuilder.php @@ -56,11 +56,9 @@ public function __construct( /** * Adds a root entity and all of its fields to the result set. * - * @param string $class The class name of the root entity. - * @param string $alias The unique alias to use for the root entity. - * @param string[] $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). - * @psalm-param class-string $class - * @psalm-param array $renamedColumns + * @param class-string $class The class name of the root entity. + * @param string $alias The unique alias to use for the root entity. + * @param array $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). * @psalm-param self::COLUMN_RENAMING_*|null $renameMode */ public function addRootEntityFromClassMetadata( @@ -79,14 +77,12 @@ public function addRootEntityFromClassMetadata( /** * Adds a joined entity and all of its fields to the result set. * - * @param string $class The class name of the joined entity. - * @param string $alias The unique alias to use for the joined entity. - * @param string $parentAlias The alias of the entity result that is the parent of this joined result. - * @param string $relation The association field that connects the parent entity result - * with the joined entity result. - * @param string[] $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). - * @psalm-param class-string $class - * @psalm-param array $renamedColumns + * @param class-string $class The class name of the joined entity. + * @param string $alias The unique alias to use for the joined entity. + * @param string $parentAlias The alias of the entity result that is the parent of this joined result. + * @param string $relation The association field that connects the parent entity result + * with the joined entity result. + * @param array $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). * @psalm-param self::COLUMN_RENAMING_*|null $renameMode */ public function addJoinedEntityFromClassMetadata( @@ -197,12 +193,11 @@ private function getColumnAlias(string $columnName, int $mode, array $customRena * * This depends on the renaming mode selected by the user. * - * @psalm-param class-string $className + * @param class-string $className * @psalm-param self::COLUMN_RENAMING_* $mode * @psalm-param array $customRenameColumns * * @return string[] - * @psalm-return array */ private function getColumnAliasMap( string $className, diff --git a/src/Query/TreeWalkerChain.php b/src/Query/TreeWalkerChain.php index 7bb30511de0..7b40ea17788 100644 --- a/src/Query/TreeWalkerChain.php +++ b/src/Query/TreeWalkerChain.php @@ -19,8 +19,7 @@ class TreeWalkerChain implements TreeWalker /** * The tree walkers. * - * @var string[] - * @psalm-var list> + * @var list> */ private array $walkers = []; @@ -47,8 +46,7 @@ public function getQueryComponents(): array /** * Adds a tree walker to the chain. * - * @param string $walkerClass The class of the walker to instantiate. - * @psalm-param class-string $walkerClass + * @param class-string $walkerClass The class of the walker to instantiate. */ public function addTreeWalker(string $walkerClass): void { diff --git a/src/Tools/Console/Command/MappingDescribeCommand.php b/src/Tools/Console/Command/MappingDescribeCommand.php index 41a177d9186..26b9b4f382b 100644 --- a/src/Tools/Console/Command/MappingDescribeCommand.php +++ b/src/Tools/Console/Command/MappingDescribeCommand.php @@ -127,8 +127,7 @@ private function displayEntity( /** * Return all mapped entity class names * - * @return string[] - * @psalm-return class-string[] + * @return class-string[] */ private function getMappedEntities(EntityManagerInterface $entityManager): array { diff --git a/src/Tools/Pagination/Paginator.php b/src/Tools/Pagination/Paginator.php index db1b34db715..1bbb72972d4 100644 --- a/src/Tools/Pagination/Paginator.php +++ b/src/Tools/Pagination/Paginator.php @@ -183,7 +183,7 @@ private function useOutputWalker(Query $query): bool /** * Appends a custom tree walker to the tree walkers hint. * - * @psalm-param class-string $walkerClass + * @param class-string $walkerClass */ private function appendTreeWalker(Query $query, string $walkerClass): void { diff --git a/src/UnitOfWork.php b/src/UnitOfWork.php index 85a33620aa8..e26602ef92a 100644 --- a/src/UnitOfWork.php +++ b/src/UnitOfWork.php @@ -121,7 +121,7 @@ class UnitOfWork implements PropertyChangedListener * Since all classes in a hierarchy must share the same identifier set, * we always take the root class name of the hierarchy. * - * @psalm-var array> + * @var array> */ private array $identityMap = []; @@ -167,7 +167,7 @@ class UnitOfWork implements PropertyChangedListener * This is only used for entities with a change tracking policy of DEFERRED_EXPLICIT. * Keys are object ids (spl_object_id). * - * @psalm-var array> + * @var array> */ private array $scheduledForSynchronization = []; @@ -292,7 +292,7 @@ class UnitOfWork implements PropertyChangedListener /** * Map of Entity Class-Names and corresponding IDs that should eager loaded when requested. * - * @psalm-var array> + * @var array> */ private array $eagerLoadingEntities = []; @@ -2342,11 +2342,9 @@ public function isCollectionScheduledForDeletion(PersistentCollection $coll): bo * * Internal note: Highly performance-sensitive method. * - * @param string $className The name of the entity class. - * @param mixed[] $data The data for the entity. - * @param mixed[] $hints Any hints to account for during reconstitution/lookup of the entity. - * @psalm-param class-string $className - * @psalm-param array $hints + * @param class-string $className The name of the entity class. + * @param mixed[] $data The data for the entity. + * @param array $hints Any hints to account for during reconstitution/lookup of the entity. * * @return object The managed entity instance. * @@ -2749,7 +2747,7 @@ private function scheduleCollectionForBatchLoading(PersistentCollection $collect /** * Gets the identity map of the UnitOfWork. * - * @psalm-return array> + * @return array> */ public function getIdentityMap(): array { @@ -2830,9 +2828,8 @@ public function getSingleIdentifierValue(object $entity): mixed * Tries to find an entity with the given identifier in the identity map of * this UnitOfWork. * - * @param mixed $id The entity identifier to look for. - * @param string $rootClassName The name of the root class of the mapped entity hierarchy. - * @psalm-param class-string $rootClassName + * @param mixed $id The entity identifier to look for. + * @param class-string $rootClassName The name of the root class of the mapped entity hierarchy. * * @return object|false Returns the entity with the specified identifier if it exists in * this UnitOfWork, FALSE otherwise. @@ -2876,7 +2873,7 @@ public function size(): int /** * Gets the EntityPersister for an Entity. * - * @psalm-param class-string $entityName + * @param class-string $entityName The name of the Entity. */ public function getEntityPersister(string $entityName): EntityPersister { diff --git a/tests/StaticAnalysis/Mapping/class-metadata-constructor.php b/tests/StaticAnalysis/Mapping/class-metadata-constructor.php index 0d5da396903..684d69f43d3 100644 --- a/tests/StaticAnalysis/Mapping/class-metadata-constructor.php +++ b/tests/StaticAnalysis/Mapping/class-metadata-constructor.php @@ -10,9 +10,9 @@ class MetadataGenerator { /** - * @psalm-param class-string $entityName + * @param class-string $entityName * - * @psalm-return ClassMetadata + * @return ClassMetadata */ public function createMetadata(string $entityName): ClassMetadata { diff --git a/tests/StaticAnalysis/get-metadata.php b/tests/StaticAnalysis/get-metadata.php index 1442efd4af6..a67d34fe459 100644 --- a/tests/StaticAnalysis/get-metadata.php +++ b/tests/StaticAnalysis/get-metadata.php @@ -15,15 +15,15 @@ */ abstract class GetMetadata { - /** @psalm-param class-string|object $class */ + /** @param class-string|object $class */ abstract public function getEntityManager(string|object $class): EntityManagerInterface; /** - * @psalm-param class-string $class + * @param class-string $class * - * @psalm-return ClassMetadata + * @return ClassMetadata * - * @psalm-template TObject of object + * @template TObject of object */ public function __invoke(string $class): ClassMetadata { diff --git a/tests/Tests/ORM/Functional/DatabaseDriverTestCase.php b/tests/Tests/ORM/Functional/DatabaseDriverTestCase.php index 7a9039cfe11..abbf26c3ed6 100644 --- a/tests/Tests/ORM/Functional/DatabaseDriverTestCase.php +++ b/tests/Tests/ORM/Functional/DatabaseDriverTestCase.php @@ -40,7 +40,7 @@ protected function convertToClassMetadata(array $entityTables, array $manyTables /** * @param string[] $classNames * - * @psalm-return array + * @return array */ protected function extractClassMetadata(array $classNames): array { diff --git a/tests/Tests/ORM/Functional/PostLoadEventTest.php b/tests/Tests/ORM/Functional/PostLoadEventTest.php index 839a8313983..cb7a98ab1a4 100644 --- a/tests/Tests/ORM/Functional/PostLoadEventTest.php +++ b/tests/Tests/ORM/Functional/PostLoadEventTest.php @@ -275,7 +275,7 @@ public function postLoad(PostLoadEventArgs $event): void class PostLoadListenerLoadEntityInEventHandler { - /** @psalm-var array */ + /** @var array */ private array $firedByClasses = []; public function postLoad(PostLoadEventArgs $event): void diff --git a/tests/Tests/ORM/Functional/Ticket/DDC1884Test.php b/tests/Tests/ORM/Functional/Ticket/DDC1884Test.php index dc5d17591d7..360ac2bf519 100644 --- a/tests/Tests/ORM/Functional/Ticket/DDC1884Test.php +++ b/tests/Tests/ORM/Functional/Ticket/DDC1884Test.php @@ -57,7 +57,7 @@ protected function setUp(): void /** * @psalm-return array{Car, Car, Car, Car} * - * @psalm-var class-string $class + * @var class-string $class */ private function createCars(string $class): array { @@ -88,7 +88,7 @@ private function createCars(string $class): array /** * @psalm-return array{Driver, Driver} * - * @psalm-var class-string $class + * @var class-string $class */ private function createDrivers(string $class): array { diff --git a/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index 23054d4899e..1bef18a908b 100644 --- a/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -479,7 +479,7 @@ final class Cube extends Shape /* Test subject class with overridden factory method for mocking purposes */ class ClassMetadataFactoryTestSubject extends ClassMetadataFactory { - /** @psalm-var array, ClassMetadata> */ + /** @var array, ClassMetadata> */ private array $mockMetadata = []; protected function newClassMetadataInstance(string $className): ClassMetadata @@ -494,7 +494,7 @@ protected function newClassMetadataInstance(string $className): ClassMetadata return $this->mockMetadata[$className]; } - /** @psalm-param class-string $className */ + /** @param class-string $className */ public function setMetadataForClass(string $className, ClassMetadata $metadata): void { $this->mockMetadata[$className] = $metadata; diff --git a/tests/Tests/ORM/Mapping/MappingDriverTestCase.php b/tests/Tests/ORM/Mapping/MappingDriverTestCase.php index 09bddea9859..10d9d4ba965 100644 --- a/tests/Tests/ORM/Mapping/MappingDriverTestCase.php +++ b/tests/Tests/ORM/Mapping/MappingDriverTestCase.php @@ -77,7 +77,7 @@ abstract class MappingDriverTestCase extends OrmTestCase { abstract protected function loadDriver(): MappingDriver; - /** @psalm-param class-string $entityClassName */ + /** @param class-string $entityClassName */ public function createClassMetadata( string $entityClassName, NamingStrategy|null $namingStrategy = null, diff --git a/tests/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Tests/ORM/Query/LanguageRecognitionTest.php index ec57b1f1382..448b425b64e 100644 --- a/tests/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Tests/ORM/Query/LanguageRecognitionTest.php @@ -11,6 +11,7 @@ use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping\Id; use Doctrine\ORM\Mapping\OneToOne; +use Doctrine\ORM\Query; use Doctrine\ORM\Query\AST\Functions\ConcatFunction; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\ParserResult; @@ -56,7 +57,7 @@ public function parseDql(string $dql, array $hints = []): ParserResult $parser = new Parser($query); // We do NOT test SQL output here. That only unnecessarily slows down the tests! - $parser->setCustomOutputTreeWalker(NullSqlWalker::class); + $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, NullSqlWalker::class); return $parser->parse(); } diff --git a/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php b/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php index 31abca36f83..a9b71ef9571 100644 --- a/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php +++ b/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php @@ -102,9 +102,9 @@ public function testCachesDistinctRepositoriesPerDistinctEntityManager(): void } /** - * @psalm-param class-string $className + * @param class-string $className * - * @psalm-return ClassMetadata&MockObject + * @return ClassMetadata&MockObject * * @template TEntity of object */ diff --git a/tests/Tests/TestUtil.php b/tests/Tests/TestUtil.php index eb4d3edf59a..7c75fcff991 100644 --- a/tests/Tests/TestUtil.php +++ b/tests/Tests/TestUtil.php @@ -140,14 +140,14 @@ private static function addDbEventSubscribers(Connection $conn): void } $evm = $conn->getEventManager(); - /** @psalm-var class-string $subscriberClass */ + /** @var class-string $subscriberClass */ foreach (explode(',', $GLOBALS['db_event_subscribers']) as $subscriberClass) { $subscriberInstance = new $subscriberClass(); $evm->addEventSubscriber($subscriberInstance); } } - /** @psalm-return array */ + /** @return array */ private static function getPrivilegedConnectionParameters(): array { if (isset($GLOBALS['privileged_db_driver'])) {