From 896c65504d8bfba1cdcf58ee9a9946f171400baa Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 9 Oct 2024 16:12:41 +0200 Subject: [PATCH 1/2] Deprecate the `\Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker()` method (#11641) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use this method only from within one of our own test cases, and I don't see how it would be useful to anybody else outside – it has to be called on the `Parser` instance which exists internally in the `Query` only. Deprecating and removing it in 3.x allows for a slight simplification in the `Parser` there, since we do no longer need the field (it can be a local variable). --- UPGRADE.md | 6 ++++++ src/Query/Parser.php | 7 +++++++ tests/Tests/ORM/Query/LanguageRecognitionTest.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 9ffc7d0f3e4..a42be6a4378 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -13,6 +13,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/Query/Parser.php b/src/Query/Parser.php index 8852c8eef82..7d0a0176f4e 100644 --- a/src/Query/Parser.php +++ b/src/Query/Parser.php @@ -200,6 +200,13 @@ public function __construct(Query $query) */ public function setCustomOutputTreeWalker($className) { + 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; } diff --git a/tests/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Tests/ORM/Query/LanguageRecognitionTest.php index a2e0e600969..37aac27f260 100644 --- a/tests/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Tests/ORM/Query/LanguageRecognitionTest.php @@ -51,7 +51,7 @@ public function parseDql(string $dql, array $hints = []): ParserResult $parser = new Query\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(); } From 488a5dd3bf53be0531e6db2093cfe9e937455946 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 9 Oct 2024 21:58:37 +0200 Subject: [PATCH 2/2] Remove vendor prefix of PHPDoc referencing class-string (#11643) --- psalm-baseline.xml | 2 +- src/Cache/AssociationCacheEntry.php | 6 +-- src/Cache/CollectionCacheKey.php | 6 +-- src/Cache/EntityCacheEntry.php | 6 +-- src/Cache/EntityCacheKey.php | 6 +-- .../AbstractCollectionPersister.php | 5 +-- src/Configuration.php | 40 ++++++----------- src/Decorator/EntityManagerDecorator.php | 2 +- src/EntityManager.php | 27 +++++------ src/EntityManagerInterface.php | 22 ++++----- src/EntityRepository.php | 8 +--- src/Internal/Hydration/ObjectHydrator.php | 2 +- src/Mapping/Builder/ClassMetadataBuilder.php | 10 ++--- src/Mapping/ClassMetadataFactory.php | 8 ++-- src/Mapping/ClassMetadataInfo.php | 30 +++++-------- src/Mapping/DefaultEntityListenerResolver.php | 2 +- src/Mapping/Driver/AnnotationDriver.php | 9 ++-- src/Mapping/Driver/AttributeDriver.php | 4 +- src/Mapping/Driver/DatabaseDriver.php | 6 +-- src/Mapping/Driver/XmlDriver.php | 10 ++--- src/Mapping/Driver/YamlDriver.php | 4 +- src/Mapping/Entity.php | 3 +- src/Mapping/MappedSuperclass.php | 5 +-- .../Reflection/ReflectionPropertiesGetter.php | 5 +-- src/Query/Parser.php | 14 +++--- src/Query/ResultSetMapping.php | 45 +++++++++---------- src/Query/ResultSetMappingBuilder.php | 29 +++++------- src/Query/TreeWalkerChain.php | 6 +-- src/Query/TreeWalkerChainIterator.php | 5 +-- .../Command/MappingDescribeCommand.php | 3 +- src/Tools/ConvertDoctrine1Schema.php | 4 +- src/Tools/EntityRepositoryGenerator.php | 8 ++-- src/Tools/Pagination/Paginator.php | 2 +- src/UnitOfWork.php | 25 +++++------ .../Mapping/class-metadata-constructor.php | 4 +- tests/StaticAnalysis/get-metadata.php | 11 ++--- .../ORM/Functional/DatabaseDriverTestCase.php | 2 +- .../ORM/Functional/PostLoadEventTest.php | 2 +- .../ORM/Functional/Ticket/DDC1884Test.php | 4 +- .../ORM/Mapping/AnnotationDriverTest.php | 4 +- .../ORM/Mapping/ClassMetadataFactoryTest.php | 8 ++-- .../ORM/Mapping/MappingDriverTestCase.php | 2 +- .../DefaultRepositoryFactoryTest.php | 5 +-- .../MockBuilderCompatibilityTools.php | 6 +-- tests/Tests/TestUtil.php | 4 +- 45 files changed, 175 insertions(+), 246 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0d2d23f6ae7..2d96702abe2 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -305,7 +305,7 @@ loadById($sortedId)]]> - + diff --git a/src/Cache/AssociationCacheEntry.php b/src/Cache/AssociationCacheEntry.php index f10618fb2b9..2e4fc61491b 100644 --- a/src/Cache/AssociationCacheEntry.php +++ b/src/Cache/AssociationCacheEntry.php @@ -21,15 +21,13 @@ class AssociationCacheEntry implements CacheEntry * The entity class name * * @readonly Public only for performance reasons, it should be considered immutable. - * @var string - * @psalm-var class-string + * @var class-string */ public $class; /** - * @param string $class The entity class. + * @param class-string $class The entity class. * @param array $identifier The entity identifier. - * @psalm-param class-string $class */ public function __construct($class, array $identifier) { diff --git a/src/Cache/CollectionCacheKey.php b/src/Cache/CollectionCacheKey.php index 4475bfd3939..56bf8df722c 100644 --- a/src/Cache/CollectionCacheKey.php +++ b/src/Cache/CollectionCacheKey.php @@ -26,8 +26,7 @@ class CollectionCacheKey extends CacheKey * The owner entity class * * @readonly Public only for performance reasons, it should be considered immutable. - * @var string - * @psalm-var class-string + * @var class-string */ public $entityClass; @@ -40,10 +39,9 @@ class CollectionCacheKey extends CacheKey public $association; /** - * @param string $entityClass The entity class. + * @param class-string $entityClass The entity class. * @param string $association The field name that represents the association. * @param array $ownerIdentifier The identifier of the owning entity. - * @psalm-param class-string $entityClass */ public function __construct($entityClass, $association, array $ownerIdentifier) { diff --git a/src/Cache/EntityCacheEntry.php b/src/Cache/EntityCacheEntry.php index 6a769111c48..40382270559 100644 --- a/src/Cache/EntityCacheEntry.php +++ b/src/Cache/EntityCacheEntry.php @@ -25,15 +25,13 @@ class EntityCacheEntry implements CacheEntry * The entity class name * * @readonly Public only for performance reasons, it should be considered immutable. - * @var string - * @psalm-var class-string + * @var class-string */ public $class; /** - * @param string $class The entity class. + * @param class-string $class The entity class. * @param array $data The entity data. - * @psalm-param class-string $class */ public function __construct($class, array $data) { diff --git a/src/Cache/EntityCacheKey.php b/src/Cache/EntityCacheKey.php index 3f22f4b3912..30872864010 100644 --- a/src/Cache/EntityCacheKey.php +++ b/src/Cache/EntityCacheKey.php @@ -26,15 +26,13 @@ class EntityCacheKey extends CacheKey * The entity class name * * @readonly Public only for performance reasons, it should be considered immutable. - * @var string - * @psalm-var class-string + * @var class-string */ public $entityClass; /** - * @param string $entityClass The entity class name. In a inheritance hierarchy it should always be the root entity class. + * @param class-string $entityClass The entity class name. In a inheritance hierarchy it should always be the root entity class. * @param array $identifier The entity identifier - * @psalm-param class-string $entityClass */ public function __construct($entityClass, array $identifier) { diff --git a/src/Cache/Persister/Collection/AbstractCollectionPersister.php b/src/Cache/Persister/Collection/AbstractCollectionPersister.php index ad81823b84c..4eb1895bbca 100644 --- a/src/Cache/Persister/Collection/AbstractCollectionPersister.php +++ b/src/Cache/Persister/Collection/AbstractCollectionPersister.php @@ -254,9 +254,8 @@ protected function evictCollectionCache(PersistentCollection $collection) /** * @deprecated This method is not used anymore. * - * @param string $targetEntity - * @param object $element - * @psalm-param class-string $targetEntity + * @param class-string $targetEntity + * @param object $element * * @return void */ diff --git a/src/Configuration.php b/src/Configuration.php index 32adbd16bd3..7e05c461d8f 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -687,8 +687,7 @@ public function addCustomNumericFunction($name, $className) * * @param string $name * - * @return string|callable|null - * @psalm-return class-string|callable|null + * @return class-string|callable|null */ public function getCustomNumericFunction($name) { @@ -705,7 +704,7 @@ public function getCustomNumericFunction($name) * * Any previously added numeric functions are discarded. * - * @psalm-param array $functions The map of custom + * @param array $functions The map of custom * DQL numeric functions. * * @return void @@ -740,8 +739,7 @@ public function addCustomDatetimeFunction($name, $className) * * @param string $name * - * @return string|callable|null - * @psalm-return class-string|callable|null + * @return class-string|callable|null */ public function getCustomDatetimeFunction($name) { @@ -807,8 +805,7 @@ public function setCustomHydrationModes($modes) * * @param string $modeName The hydration mode name. * - * @return string|null The hydrator class name. - * @psalm-return class-string|null + * @return class-string|null The hydrator class name. */ public function getCustomHydrationMode($modeName) { @@ -818,9 +815,8 @@ public function getCustomHydrationMode($modeName) /** * Adds a custom hydration mode. * - * @param string $modeName The hydration mode name. - * @param string $hydrator The hydrator class name. - * @psalm-param class-string $hydrator + * @param string $modeName The hydration mode name. + * @param class-string $hydrator The hydrator class name. * * @return void */ @@ -832,8 +828,7 @@ public function addCustomHydrationMode($modeName, $hydrator) /** * Sets a class metadata factory. * - * @param string $cmfName - * @psalm-param class-string $cmfName + * @param class-string $cmfName * * @return void */ @@ -842,10 +837,7 @@ public function setClassMetadataFactoryName($cmfName) $this->_attributes['classMetadataFactoryName'] = $cmfName; } - /** - * @return string - * @psalm-return class-string - */ + /** @return class-string */ public function getClassMetadataFactoryName() { if (! isset($this->_attributes['classMetadataFactoryName'])) { @@ -858,9 +850,8 @@ public function getClassMetadataFactoryName() /** * Adds a filter to the list of possible filters. * - * @param string $name The name of the filter. - * @param string $className The class name of the filter. - * @psalm-param class-string $className + * @param string $name The name of the filter. + * @param class-string $className The class name of the filter. * * @return void */ @@ -874,9 +865,8 @@ public function addFilter($name, $className) * * @param string $name The name of the filter. * - * @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($name) { @@ -886,8 +876,7 @@ public function getFilterClassName($name) /** * Sets default repository class. * - * @param string $className - * @psalm-param class-string $className + * @param class-string $className * * @return void * @@ -915,8 +904,7 @@ public function setDefaultRepositoryClassName($className) /** * Get default repository class. * - * @return string - * @psalm-return class-string + * @return class-string */ public function getDefaultRepositoryClassName() { diff --git a/src/Decorator/EntityManagerDecorator.php b/src/Decorator/EntityManagerDecorator.php index 889479aa32a..179d5386dd9 100644 --- a/src/Decorator/EntityManagerDecorator.php +++ b/src/Decorator/EntityManagerDecorator.php @@ -50,7 +50,7 @@ public function getExpressionBuilder() /** * {@inheritDoc} * - * @psalm-param class-string $className + * @param class-string $className * * @psalm-return EntityRepository * diff --git a/src/EntityManager.php b/src/EntityManager.php index 0e52f1934e2..38b2ee3ce1f 100644 --- a/src/EntityManager.php +++ b/src/EntityManager.php @@ -30,7 +30,6 @@ use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Repository\RepositoryFactory; use Doctrine\Persistence\Mapping\MappingException; -use Doctrine\Persistence\ObjectRepository; use InvalidArgumentException; use Throwable; @@ -407,25 +406,23 @@ public function flush($entity = null) /** * Finds an Entity by its identifier. * - * @param string $className The class name of the entity to find. - * @param mixed $id The identity of the entity to find. - * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants - * or NULL if no specific lock mode should be used - * during the search. - * @param int|null $lockVersion The version of the entity to find when using - * optimistic locking. - * @psalm-param class-string $className + * @param class-string $className The class name of the entity to find. + * @param mixed $id The identity of the entity to find. + * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants + * or NULL if no specific lock mode should be used + * during the search. + * @param int|null $lockVersion The version of the entity to find when using + * optimistic locking. * @psalm-param LockMode::*|null $lockMode * - * @return object|null The entity instance or NULL if the entity can not be found. - * @psalm-return ?T + * @return T|null The entity instance or NULL if the entity can not be found. * * @throws OptimisticLockException * @throws ORMInvalidArgumentException * @throws TransactionRequiredException * @throws ORMException * - * @template T + * @template T of object */ public function find($className, $id, $lockMode = null, $lockVersion = null) { @@ -803,11 +800,9 @@ public function lock($entity, $lockMode, $lockVersion = null) /** * Gets the repository for an entity class. * - * @param string $entityName The name of the entity. - * @psalm-param class-string $entityName + * @param class-string $entityName The name of the entity. * - * @return ObjectRepository|EntityRepository The repository class. - * @psalm-return EntityRepository + * @return EntityRepository The repository class. * * @template T of object */ diff --git a/src/EntityManagerInterface.php b/src/EntityManagerInterface.php index b3b5ddf9e13..5155d1a2a06 100644 --- a/src/EntityManagerInterface.php +++ b/src/EntityManagerInterface.php @@ -29,9 +29,9 @@ interface EntityManagerInterface extends ObjectManager /** * {@inheritDoc} * - * @psalm-param class-string $className + * @param class-string $className * - * @psalm-return EntityRepository + * @return EntityRepository * * @template T of object */ @@ -172,12 +172,10 @@ public function createQueryBuilder(); * 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. * - * @return object|null The entity reference. - * @psalm-return T|null + * @return T|null The entity reference. * * @throws ORMException * @@ -202,12 +200,10 @@ public function getReference($entityName, $id); * * @deprecated 2.7 This method is being removed from the ORM and won't have any replacement * - * @param string $entityName The name of the entity type. - * @param mixed $identifier The entity identifier. - * @psalm-param class-string $entityName + * @param class-string $entityName The name of the entity type. + * @param mixed $identifier The entity identifier. * - * @return object|null The (partial) entity reference - * @psalm-return T|null + * @return T|null The (partial) entity reference * * @template T */ @@ -337,7 +333,7 @@ public function hasFilters(); /** * {@inheritDoc} * - * @psalm-param string|class-string $className + * @param string|class-string $className * * @return Mapping\ClassMetadata * @psalm-return ($className is class-string ? Mapping\ClassMetadata : Mapping\ClassMetadata) diff --git a/src/EntityRepository.php b/src/EntityRepository.php index 5889b5285e9..b6db64f22d7 100644 --- a/src/EntityRepository.php +++ b/src/EntityRepository.php @@ -42,8 +42,7 @@ class EntityRepository implements ObjectRepository, Selectable /** * @internal This property will be private in 3.0, call {@see getEntityName()} instead. * - * @var string - * @psalm-var class-string + * @var class-string */ protected $_entityName; @@ -287,10 +286,7 @@ public function __call($method, $arguments) )); } - /** - * @return string - * @psalm-return class-string - */ + /** @return class-string */ protected function getEntityName() { return $this->_entityName; diff --git a/src/Internal/Hydration/ObjectHydrator.php b/src/Internal/Hydration/ObjectHydrator.php index c01496a5ca8..6c3a6594cf8 100644 --- a/src/Internal/Hydration/ObjectHydrator.php +++ b/src/Internal/Hydration/ObjectHydrator.php @@ -273,7 +273,7 @@ private function getEntity(array $data, string $dqlAlias) } /** - * @psalm-param class-string $className + * @param class-string $className * @psalm-param array $data * * @return mixed diff --git a/src/Mapping/Builder/ClassMetadataBuilder.php b/src/Mapping/Builder/ClassMetadataBuilder.php index cce88a15887..182a106bda3 100644 --- a/src/Mapping/Builder/ClassMetadataBuilder.php +++ b/src/Mapping/Builder/ClassMetadataBuilder.php @@ -218,11 +218,11 @@ public function setSingleTableInheritance() /** * Sets the discriminator column details. * - * @param string $name - * @param string $type - * @param int $length - * @psalm-param class-string|null $enumType - * @psalm-param array $options + * @param string $name + * @param string $type + * @param int $length + * @param class-string|null $enumType + * @param array $options * * @return $this */ diff --git a/src/Mapping/ClassMetadataFactory.php b/src/Mapping/ClassMetadataFactory.php index 63bcecec7ae..d739fc7b227 100644 --- a/src/Mapping/ClassMetadataFactory.php +++ b/src/Mapping/ClassMetadataFactory.php @@ -420,7 +420,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 { @@ -850,8 +850,10 @@ protected function initializeReflection(ClassMetadataInterface $class, Reflectio */ protected function getFqcnFromAlias($namespaceAlias, $simpleClassName) { - /** @psalm-var class-string */ - return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; + /** @var class-string $classString */ + $classString = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; + + return $classString; } /** diff --git a/src/Mapping/ClassMetadataInfo.php b/src/Mapping/ClassMetadataInfo.php index b0da6e31f49..cb17b8983d4 100644 --- a/src/Mapping/ClassMetadataInfo.php +++ b/src/Mapping/ClassMetadataInfo.php @@ -257,8 +257,7 @@ class ClassMetadataInfo implements ClassMetadata /** * READ-ONLY: The name of the entity class. * - * @var string - * @psalm-var class-string + * @var class-string */ public $name; @@ -275,8 +274,7 @@ class ClassMetadataInfo implements ClassMetadata * hierarchy. If the entity is not part of a mapped inheritance hierarchy this is the same * as {@link $name}. * - * @var string - * @psalm-var class-string + * @var class-string */ public $rootEntityName; @@ -300,8 +298,7 @@ class ClassMetadataInfo implements ClassMetadata * The name of the custom repository class used for the entity class. * (Optional). * - * @var string|null - * @psalm-var ?class-string + * @var class-string|null */ public $customRepositoryClassName; @@ -323,7 +320,7 @@ class ClassMetadataInfo implements ClassMetadata * READ-ONLY: The names of the parent entity classes (ancestors), starting with the * nearest one and ending with the root entity class. * - * @psalm-var list + * @var list */ public $parentClasses = []; @@ -350,7 +347,7 @@ class ClassMetadataInfo implements ClassMetadata * For subclasses of such root entities, the list can be reused/passed downwards, it only needs to * be filtered accordingly (only keep remaining subclasses) * - * @psalm-var list + * @var list */ public $subClasses = []; @@ -548,9 +545,7 @@ class ClassMetadataInfo implements ClassMetadata * * @see discriminatorColumn * - * @var array - * - * @psalm-var array + * @var array */ public $discriminatorMap = []; @@ -811,8 +806,7 @@ class ClassMetadataInfo implements ClassMetadata * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. * - * @param string $entityName The name of the entity class the new instance is used for. - * @psalm-param class-string $entityName + * @param class-string $entityName The name of the entity class the new instance is used for. */ public function __construct($entityName, ?NamingStrategy $namingStrategy = null, ?TypedFieldMapper $typedFieldMapper = null) { @@ -2426,7 +2420,7 @@ public function setSubclasses(array $subclasses) * Assumes that the class names in the passed array are in the order: * directParent -> directParentParent -> directParentParentParent ... -> root. * - * @psalm-param list $classNames + * @param list $classNames * * @return void */ @@ -3024,8 +3018,7 @@ protected function _storeAssociationMapping(array $assocMapping) /** * Registers a custom repository class for the entity class. * - * @param string|null $repositoryClassName The class name of the custom mapper. - * @psalm-param class-string|null $repositoryClassName + * @param class-string|null $repositoryClassName The class name of the custom mapper. * * @return void */ @@ -3562,8 +3555,7 @@ public function getAssociationNames() * * @param string $assocName * - * @return string - * @psalm-return class-string + * @return class-string * * @throws InvalidArgumentException */ @@ -3883,7 +3875,7 @@ private function assertMappingOrderBy(array $mapping): void } } - /** @psalm-param class-string $class */ + /** @param class-string $class */ private function getAccessibleProperty(ReflectionService $reflService, string $class, string $field): ?ReflectionProperty { $reflectionProperty = $reflService->getAccessibleProperty($class, $field); diff --git a/src/Mapping/DefaultEntityListenerResolver.php b/src/Mapping/DefaultEntityListenerResolver.php index 8f3b4098042..2658637a535 100644 --- a/src/Mapping/DefaultEntityListenerResolver.php +++ b/src/Mapping/DefaultEntityListenerResolver.php @@ -17,7 +17,7 @@ */ class DefaultEntityListenerResolver implements EntityListenerResolver { - /** @psalm-var array Map to store entity listener instances. */ + /** @var array Map to store entity listener instances. */ private $instances = []; /** diff --git a/src/Mapping/Driver/AnnotationDriver.php b/src/Mapping/Driver/AnnotationDriver.php index 5e3049f61af..26e9130be72 100644 --- a/src/Mapping/Driver/AnnotationDriver.php +++ b/src/Mapping/Driver/AnnotationDriver.php @@ -47,10 +47,7 @@ class AnnotationDriver extends CompatibilityAnnotationDriver */ protected $reader; - /** - * @var int[] - * @psalm-var array - */ + /** @var array */ protected $entityAnnotationClasses = [ Mapping\Entity::class => 1, Mapping\MappedSuperclass::class => 2, @@ -89,8 +86,8 @@ public function __construct($reader, $paths = null, bool $reportFieldsWhereDecla /** * {@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/AttributeDriver.php b/src/Mapping/Driver/AttributeDriver.php index f1537522e84..e747eab146a 100644 --- a/src/Mapping/Driver/AttributeDriver.php +++ b/src/Mapping/Driver/AttributeDriver.php @@ -127,8 +127,8 @@ public function isTransient($className) /** * {@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 66fadea3870..70f4dd1a156 100644 --- a/src/Mapping/Driver/DatabaseDriver.php +++ b/src/Mapping/Driver/DatabaseDriver.php @@ -185,8 +185,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 */ @@ -533,7 +533,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 036b2f35d05..8a607676e2d 100644 --- a/src/Mapping/Driver/XmlDriver.php +++ b/src/Mapping/Driver/XmlDriver.php @@ -73,8 +73,8 @@ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENS /** * {@inheritDoc} * - * @psalm-param class-string $className - * @psalm-param ClassMetadata $metadata + * @param class-string $className + * @param ClassMetadata $metadata * * @template T of object */ @@ -971,19 +971,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/Driver/YamlDriver.php b/src/Mapping/Driver/YamlDriver.php index 5e24b0b3a45..97aacb2d1c5 100644 --- a/src/Mapping/Driver/YamlDriver.php +++ b/src/Mapping/Driver/YamlDriver.php @@ -63,8 +63,8 @@ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENS /** * {@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/Entity.php b/src/Mapping/Entity.php index 30f9394bfa1..8f3617a4278 100644 --- a/src/Mapping/Entity.php +++ b/src/Mapping/Entity.php @@ -18,8 +18,7 @@ final class Entity implements MappingAttribute { /** - * @var string|null - * @psalm-var class-string>|null + * @var class-string>|null * @readonly */ public $repositoryClass; diff --git a/src/Mapping/MappedSuperclass.php b/src/Mapping/MappedSuperclass.php index 6f3f7b30207..3a96913dc4c 100644 --- a/src/Mapping/MappedSuperclass.php +++ b/src/Mapping/MappedSuperclass.php @@ -17,13 +17,12 @@ final class MappedSuperclass implements MappingAttribute { /** - * @var string|null - * @psalm-var class-string|null + * @var class-string|null * @readonly */ public $repositoryClass; - /** @psalm-param class-string|null $repositoryClass */ + /** @param class-string|null $repositoryClass */ public function __construct(?string $repositoryClass = null) { $this->repositoryClass = $repositoryClass; diff --git a/src/Mapping/Reflection/ReflectionPropertiesGetter.php b/src/Mapping/Reflection/ReflectionPropertiesGetter.php index b6a289d5e79..d787030637b 100644 --- a/src/Mapping/Reflection/ReflectionPropertiesGetter.php +++ b/src/Mapping/Reflection/ReflectionPropertiesGetter.php @@ -33,8 +33,7 @@ public function __construct(ReflectionService $reflectionService) } /** - * @param string $className - * @psalm-param class-string $className + * @param class-string $className * * @return ReflectionProperty[] indexed by property internal name */ @@ -57,7 +56,7 @@ public function getProperties($className): array } /** - * @psalm-param class-string $className + * @param class-string $className * * @return ReflectionClass[] * @psalm-return list> diff --git a/src/Query/Parser.php b/src/Query/Parser.php index 7d0a0176f4e..2a95297efd9 100644 --- a/src/Query/Parser.php +++ b/src/Query/Parser.php @@ -51,7 +51,7 @@ class Parser { /** * @readonly Maps BUILT-IN string function names to AST class names. - * @psalm-var array> + * @var array> */ private static $stringFunctions = [ 'concat' => Functions\ConcatFunction::class, @@ -64,7 +64,7 @@ class Parser /** * @readonly Maps BUILT-IN numeric function names to AST class names. - * @psalm-var array> + * @var array> */ private static $numericFunctions = [ 'length' => Functions\LengthFunction::class, @@ -87,7 +87,7 @@ class Parser /** * @readonly Maps BUILT-IN datetime function names to AST class names. - * @psalm-var array> + * @var array> */ private static $datetimeFunctions = [ 'current_date' => Functions\CurrentDateFunction::class, @@ -162,7 +162,7 @@ class Parser /** * Any additional custom tree walkers that modify the AST. * - * @psalm-var list> + * @var list> */ private $customTreeWalkers = []; @@ -193,8 +193,7 @@ public function __construct(Query $query) * Sets a custom tree walker that produces output. * This tree walker will be run last over the AST, after any other walkers. * - * @param string $className - * @psalm-param class-string $className + * @param class-string $className * * @return void */ @@ -213,8 +212,7 @@ public function setCustomOutputTreeWalker($className) /** * Adds a custom tree walker for modifying the AST. * - * @param string $className - * @psalm-param class-string $className + * @param class-string $className * * @return void */ diff --git a/src/Query/ResultSetMapping.php b/src/Query/ResultSetMapping.php index 2131f93e964..92e1d2eedc0 100644 --- a/src/Query/ResultSetMapping.php +++ b/src/Query/ResultSetMapping.php @@ -41,7 +41,7 @@ class ResultSetMapping * Maps alias names to class names. * * @ignore - * @psalm-var array + * @var array */ public $aliasMap = []; @@ -137,7 +137,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 $declaringClasses = []; @@ -172,12 +172,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 * @@ -316,15 +315,14 @@ public function isFieldResult($columnName) /** * 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 * @@ -349,12 +347,11 @@ public function addFieldResult($alias, $columnName, $fieldName, $declaringClass /** * 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 * @@ -539,7 +536,7 @@ public function getFieldName($columnName) return $this->fieldMappings[$columnName]; } - /** @psalm-return array */ + /** @return array */ public function getAliasMap() { return $this->aliasMap; diff --git a/src/Query/ResultSetMappingBuilder.php b/src/Query/ResultSetMappingBuilder.php index 8002df787b6..93bc7dc26d8 100644 --- a/src/Query/ResultSetMappingBuilder.php +++ b/src/Query/ResultSetMappingBuilder.php @@ -77,12 +77,10 @@ public function __construct(EntityManagerInterface $em, $defaultRenameMode = sel /** * 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). - * @param int|null $renameMode One of the COLUMN_RENAMING_* constants or array for BC reasons (CUSTOM). - * @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). + * @param int|null $renameMode One of the COLUMN_RENAMING_* constants or array for BC reasons (CUSTOM). * @psalm-param self::COLUMN_RENAMING_*|null $renameMode * * @return void @@ -99,15 +97,13 @@ public function addRootEntityFromClassMetadata($class, $alias, $renamedColumns = /** * 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). - * @param int|null $renameMode One of the COLUMN_RENAMING_* constants or array for BC reasons (CUSTOM). - * @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). + * @param int|null $renameMode One of the COLUMN_RENAMING_* constants or array for BC reasons (CUSTOM). * @psalm-param self::COLUMN_RENAMING_*|null $renameMode * * @return void @@ -228,12 +224,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 c84f4e94d99..22655478b78 100644 --- a/src/Query/TreeWalkerChain.php +++ b/src/Query/TreeWalkerChain.php @@ -23,8 +23,7 @@ class TreeWalkerChain implements TreeWalker /** * The tree walkers. * - * @var string[] - * @psalm-var list> + * @var list> */ private $walkers = []; @@ -81,8 +80,7 @@ public function __construct($query, $parserResult, array $queryComponents) /** * 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. * * @return void */ diff --git a/src/Query/TreeWalkerChainIterator.php b/src/Query/TreeWalkerChainIterator.php index 6a41c3d4774..f38f655e744 100644 --- a/src/Query/TreeWalkerChainIterator.php +++ b/src/Query/TreeWalkerChainIterator.php @@ -49,10 +49,7 @@ public function __construct(TreeWalkerChain $treeWalkerChain, $query, $parserRes $this->parserResult = $parserResult; } - /** - * @return string|false - * @psalm-return class-string|false - */ + /** @return class-string|false */ #[ReturnTypeWillChange] public function rewind() { diff --git a/src/Tools/Console/Command/MappingDescribeCommand.php b/src/Tools/Console/Command/MappingDescribeCommand.php index c467e0e100e..babd432b31a 100644 --- a/src/Tools/Console/Command/MappingDescribeCommand.php +++ b/src/Tools/Console/Command/MappingDescribeCommand.php @@ -131,8 +131,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/ConvertDoctrine1Schema.php b/src/Tools/ConvertDoctrine1Schema.php index f54b4faecee..fb89e9598a5 100644 --- a/src/Tools/ConvertDoctrine1Schema.php +++ b/src/Tools/ConvertDoctrine1Schema.php @@ -91,8 +91,8 @@ public function getMetadata() } /** - * @param mixed[] $mappingInformation - * @psalm-param class-string $className + * @param class-string $className + * @param mixed[] $mappingInformation */ private function convertToClassMetadataInfo( string $className, diff --git a/src/Tools/EntityRepositoryGenerator.php b/src/Tools/EntityRepositoryGenerator.php index 97abdb3e7a6..3e37ac8d008 100644 --- a/src/Tools/EntityRepositoryGenerator.php +++ b/src/Tools/EntityRepositoryGenerator.php @@ -31,7 +31,7 @@ */ class EntityRepositoryGenerator { - /** @psalm-var class-string|null */ + /** @var class-string|null */ private $repositoryName; /** @var string */ @@ -80,7 +80,7 @@ public function generateEntityRepositoryClass($fullClassName) /** * Generates the namespace, if class do not have namespace, return empty string instead. * - * @psalm-param class-string $fullClassName + * @param class-string $fullClassName */ private function getClassNamespace(string $fullClassName): string { @@ -90,7 +90,7 @@ private function getClassNamespace(string $fullClassName): string /** * Generates the class name * - * @psalm-param class-string $fullClassName + * @param class-string $fullClassName */ private function generateClassName(string $fullClassName): string { @@ -108,7 +108,7 @@ private function generateClassName(string $fullClassName): string /** * Generates the namespace statement, if class do not have namespace, return empty string instead. * - * @psalm-param class-string $fullClassName The full repository class name. + * @param class-string $fullClassName The full repository class name. */ private function generateEntityRepositoryNamespace(string $fullClassName): string { diff --git a/src/Tools/Pagination/Paginator.php b/src/Tools/Pagination/Paginator.php index ca41360ec6b..6e5e87a10e6 100644 --- a/src/Tools/Pagination/Paginator.php +++ b/src/Tools/Pagination/Paginator.php @@ -209,7 +209,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 fa51983e309..b5945ff016a 100644 --- a/src/UnitOfWork.php +++ b/src/UnitOfWork.php @@ -127,8 +127,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. * - * @var mixed[] - * @psalm-var array> + * @var array> */ private $identityMap = []; @@ -175,7 +174,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 $scheduledForSynchronization = []; @@ -313,7 +312,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 $eagerLoadingEntities = []; @@ -2907,11 +2906,9 @@ private function newInstance(ClassMetadata $class) * * 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. * @@ -3349,7 +3346,7 @@ private function scheduleCollectionForBatchLoading(PersistentCollection $collect /** * Gets the identity map of the UnitOfWork. * - * @psalm-return array> + * @return array> */ public function getIdentityMap() { @@ -3449,9 +3446,8 @@ public function getSingleIdentifierValue($entity) * 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. @@ -3503,8 +3499,7 @@ public function size() /** * Gets the EntityPersister for an Entity. * - * @param string $entityName The name of the Entity. - * @psalm-param class-string $entityName + * @param class-string $entityName The name of the Entity. * * @return 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 c9b11036155..e55a438648c 100644 --- a/tests/StaticAnalysis/get-metadata.php +++ b/tests/StaticAnalysis/get-metadata.php @@ -15,18 +15,15 @@ */ abstract class GetMetadata { - /** - * @param string|object $class - * @psalm-param class-string|object $class - */ + /** @param class-string|object $class */ abstract public function getEntityManager($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 74518f79a1c..7963ee89774 100644 --- a/tests/Tests/ORM/Functional/PostLoadEventTest.php +++ b/tests/Tests/ORM/Functional/PostLoadEventTest.php @@ -296,7 +296,7 @@ public function postLoad(PostLoadEventArgs $event): void class PostLoadListenerLoadEntityInEventHandler { - /** @psalm-var array */ + /** @var array */ private $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 961b89333f4..f4b4b135164 100644 --- a/tests/Tests/ORM/Functional/Ticket/DDC1884Test.php +++ b/tests/Tests/ORM/Functional/Ticket/DDC1884Test.php @@ -56,7 +56,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 { @@ -87,7 +87,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/AnnotationDriverTest.php b/tests/Tests/ORM/Mapping/AnnotationDriverTest.php index 2407d019637..ae8702e9156 100644 --- a/tests/Tests/ORM/Mapping/AnnotationDriverTest.php +++ b/tests/Tests/ORM/Mapping/AnnotationDriverTest.php @@ -134,7 +134,7 @@ protected function loadDriver(): MappingDriver return $this->createAnnotationDriver(); } - /** @psalm-var class-string $entityClassName */ + /** @var class-string $entityClassName */ protected function ensureIsLoaded(string $entityClassName): void { new $entityClassName(); @@ -241,7 +241,7 @@ public function testAttributeOverridesMappingWithTrait(): void } /** - * @psalm-param class-string $class + * @param class-string $class * * @dataProvider provideDiscriminatorColumnTestcases */ diff --git a/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index bb9256a7768..00f85b01f5d 100644 --- a/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -561,13 +561,13 @@ 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 $mockMetadata = []; - /** @psalm-var list> */ + /** @var list> */ private $requestedClasses = []; - /** @psalm-param class-string $className */ + /** @param class-string $className */ protected function newClassMetadataInstance($className): ClassMetadata { $this->requestedClasses[] = $className; @@ -581,7 +581,7 @@ protected function newClassMetadataInstance($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 316bd8a6dc2..f7aa97e6a91 100644 --- a/tests/Tests/ORM/Mapping/MappingDriverTestCase.php +++ b/tests/Tests/ORM/Mapping/MappingDriverTestCase.php @@ -94,7 +94,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, diff --git a/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php b/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php index 279cb8586c9..cfc2fc4f85d 100644 --- a/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php +++ b/tests/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php @@ -108,10 +108,9 @@ public function testCachesDistinctRepositoriesPerDistinctEntityManager(): void } /** - * @psalm-param class-string $className + * @param class-string $className * - * @return ClassMetadata&MockObject - * @psalm-return ClassMetadata&MockObject + * @return ClassMetadata&MockObject * * @template TEntity of object */ diff --git a/tests/Tests/PHPUnitCompatibility/MockBuilderCompatibilityTools.php b/tests/Tests/PHPUnitCompatibility/MockBuilderCompatibilityTools.php index 01cdbe650af..d19d7011f96 100644 --- a/tests/Tests/PHPUnitCompatibility/MockBuilderCompatibilityTools.php +++ b/tests/Tests/PHPUnitCompatibility/MockBuilderCompatibilityTools.php @@ -11,10 +11,10 @@ trait MockBuilderCompatibilityTools { /** - * @param list $onlyMethods - * @psalm-param class-string $className + * @param class-string $className + * @param list $onlyMethods * - * @psalm-return MockBuilder + * @return MockBuilder * * @template TMockedType of object */ diff --git a/tests/Tests/TestUtil.php b/tests/Tests/TestUtil.php index 4eb0afe22c6..a7729248752 100644 --- a/tests/Tests/TestUtil.php +++ b/tests/Tests/TestUtil.php @@ -170,14 +170,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'])) {