diff --git a/composer.json b/composer.json index 9ff865e01d0..50319b637c7 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "symfony/console": "^3.0|^4.0|^5.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9.0", "phpstan/phpstan": "^0.12.18", "phpunit/phpunit": "^8.5|^9.4", "squizlabs/php_codesniffer": "3.6.0", diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index e1cfdbfcab0..45ade75b959 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -346,10 +346,9 @@ static function (Query\Parameter $parameter) use ($key): bool { * Sets a collection of query parameters. * * @param ArrayCollection|mixed[] $parameters + * @psalm-param ArrayCollection|mixed[] $parameters * * @return static This query instance. - * - * @psalm-param ArrayCollection|mixed[] $parameters */ public function setParameters($parameters) { @@ -402,10 +401,9 @@ public function setParameter($key, $value, $type = null) * @param mixed $value * * @return mixed[]|string|int|float|bool + * @psalm-return array|scalar * * @throws ORMInvalidArgumentException - * - * @psalm-return array|scalar */ public function processParameterValue($value) { diff --git a/lib/Doctrine/ORM/Cache/DefaultQueryCache.php b/lib/Doctrine/ORM/Cache/DefaultQueryCache.php index 211721d1ae3..18a951dc38f 100644 --- a/lib/Doctrine/ORM/Cache/DefaultQueryCache.php +++ b/lib/Doctrine/ORM/Cache/DefaultQueryCache.php @@ -345,7 +345,6 @@ public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $h * @param mixed $assocValue * * @return mixed[]|null - * * @psalm-return array{targetEntity: string, type: mixed, list?: array[], identifier?: array}|null */ private function storeAssociationCache(QueryCacheKey $key, array $assoc, $assocValue) diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index bc04c1c177a..49ce822c6f1 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -151,10 +151,9 @@ public function setMetadataDriverImpl(MappingDriver $driverImpl) * is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported. * * @param bool $useSimpleAnnotationReader + * @psalm-param string|list $paths * * @return AnnotationDriver - * - * @psalm-param string|list $paths */ public function newDefaultAnnotationDriver($paths = [], $useSimpleAnnotationReader = true) { @@ -209,9 +208,9 @@ public function getEntityNamespace($entityNamespaceAlias) /** * Sets the entity alias map. * - * @return void - * * @psalm-param array $entityNamespaces + * + * @return void */ public function setEntityNamespaces(array $entityNamespaces) { @@ -350,13 +349,13 @@ public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm) * * @param string $name The name of the query. * - * @throws ORMException - * * @psalm-return array{string, ResultSetMapping} A tuple with the first * element being the SQL * string and the second * element being the * ResultSetMapping. + * + * @throws ORMException */ public function getNamedNativeQuery($name) { @@ -426,7 +425,6 @@ public function addCustomStringFunction($name, $className) * @param string $name * * @return string|null - * * @psalm-return ?class-string */ public function getCustomStringFunction($name) @@ -444,10 +442,10 @@ public function getCustomStringFunction($name) * * Any previously added string functions are discarded. * - * @return void - * * @psalm-param array $functions The map of custom * DQL string functions. + * + * @return void */ public function setCustomStringFunctions(array $functions) { @@ -479,7 +477,6 @@ public function addCustomNumericFunction($name, $className) * @param string $name * * @return string|null - * * @psalm-return ?class-string */ public function getCustomNumericFunction($name) @@ -497,10 +494,10 @@ public function getCustomNumericFunction($name) * * Any previously added numeric functions are discarded. * - * @return void - * * @psalm-param array $functions The map of custom * DQL numeric functions. + * + * @return void */ public function setCustomNumericFunctions(array $functions) { @@ -518,10 +515,9 @@ public function setCustomNumericFunctions(array $functions) * * @param string $name Function name. * @param string|callable $className Class name or a callable that returns the function. + * @psalm-param class-string|callable $className * * @return void - * - * @psalm-param class-string|callable $className */ public function addCustomDatetimeFunction($name, $className) { @@ -534,7 +530,6 @@ public function addCustomDatetimeFunction($name, $className) * @param string $name * * @return string|null - * * @psalm-return ?class-string $name */ public function getCustomDatetimeFunction($name) @@ -553,10 +548,9 @@ public function getCustomDatetimeFunction($name) * Any previously added date/time functions are discarded. * * @param array $functions The map of custom DQL date/time functions. + * @psalm-param array $functions * * @return void - * - * @psalm-param array $functions */ public function setCustomDatetimeFunctions(array $functions) { @@ -587,7 +581,6 @@ public function setCustomHydrationModes($modes) * @param string $modeName The hydration mode name. * * @return string|null The hydrator class name. - * * @psalm-return ?class-string */ public function getCustomHydrationMode($modeName) @@ -599,10 +592,9 @@ public function getCustomHydrationMode($modeName) * Adds a custom hydration mode. * * @param string $modeName The hydration mode name. + * @psalm-param class-string $hydrator The hydrator class name. * * @return void - * - * @psalm-param class-string $hydrator The hydrator class name. */ public function addCustomHydrationMode($modeName, $hydrator) { @@ -613,10 +605,9 @@ public function addCustomHydrationMode($modeName, $hydrator) * Sets a class metadata factory. * * @param string $cmfName + * @psalm-param class-string $cmfName * * @return void - * - * @psalm-param class-string $cmfName */ public function setClassMetadataFactoryName($cmfName) { @@ -625,7 +616,6 @@ public function setClassMetadataFactoryName($cmfName) /** * @return string - * * @psalm-return class-string */ public function getClassMetadataFactoryName() @@ -655,7 +645,6 @@ public function addFilter($name, $className) * * @return string|null The class name of the filter, or null if it is not * defined. - * * @psalm-return ?class-string */ public function getFilterClassName($name) @@ -687,7 +676,6 @@ public function setDefaultRepositoryClassName($className) * Get default repository class. * * @return string - * * @psalm-return class-string */ public function getDefaultRepositoryClassName() diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index 70bbab82994..912b29a07bb 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -386,8 +386,10 @@ public function flush($entity = null) * during the search. * @param int|null $lockVersion The version of the entity to find when using * optimistic locking. + * @psalm-param class-string $className * * @return object|null The entity instance or NULL if the entity can not be found. + * @psalm-return ?T * * @throws OptimisticLockException * @throws ORMInvalidArgumentException @@ -395,8 +397,6 @@ public function flush($entity = null) * @throws ORMException * * @template T - * @psalm-param class-string $className - * @psalm-return ?T */ public function find($className, $id, $lockMode = null, $lockVersion = null) { @@ -746,12 +746,12 @@ 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 * * @return ObjectRepository|EntityRepository The repository class. + * @psalm-return EntityRepository * * @template T - * @psalm-param class-string $entityName - * @psalm-return EntityRepository */ public function getRepository($entityName) { diff --git a/lib/Doctrine/ORM/EntityManagerInterface.php b/lib/Doctrine/ORM/EntityManagerInterface.php index 33479c2a0be..98725005c25 100644 --- a/lib/Doctrine/ORM/EntityManagerInterface.php +++ b/lib/Doctrine/ORM/EntityManagerInterface.php @@ -155,14 +155,14 @@ public function createQueryBuilder(); * * @param string $entityName The name of the entity type. * @param mixed $id The entity identifier. + * @psalm-param class-string $entityName * * @return object|null The entity reference. + * @psalm-return ?T * * @throws ORMException * * @template T - * @psalm-param class-string $entityName - * @psalm-return ?T */ public function getReference($entityName, $id); diff --git a/lib/Doctrine/ORM/EntityRepository.php b/lib/Doctrine/ORM/EntityRepository.php index d429e2c944f..ff5fdca17ed 100644 --- a/lib/Doctrine/ORM/EntityRepository.php +++ b/lib/Doctrine/ORM/EntityRepository.php @@ -160,7 +160,6 @@ public function clear() * @param int|null $lockVersion The lock version. * * @return object|null The entity instance or NULL if the entity can not be found. - * * @psalm-return ?T */ public function find($id, $lockMode = null, $lockVersion = null) @@ -183,9 +182,9 @@ public function findAll() * * @param int|null $limit * @param int|null $offset - * * @psalm-param array $criteria * @psalm-param array|null $orderBy + * * @psalm-return list The objects. */ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) @@ -198,10 +197,10 @@ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $ /** * Finds a single entity by a set of criteria. * - * @return object|null The entity instance or NULL if the entity can not be found. - * * @psalm-param array $criteria * @psalm-param array|null $orderBy + * + * @return object|null The entity instance or NULL if the entity can not be found. * @psalm-return ?T */ public function findOneBy(array $criteria, ?array $orderBy = null) @@ -214,9 +213,10 @@ public function findOneBy(array $criteria, ?array $orderBy = null) /** * Counts entities by a set of criteria. * + * @psalm-param array $criteria + * * @return int The cardinality of the objects that match the given criteria. * - * @psalm-param array $criteria * @todo Add this method to `ObjectRepository` interface in the next major release */ public function count(array $criteria) @@ -228,13 +228,12 @@ public function count(array $criteria) * Adds support for magic method calls. * * @param string $method + * @psalm-param list $arguments * * @return mixed The returned value from the resolved method. * * @throws ORMException * @throws BadMethodCallException If the method called is invalid. - * - * @psalm-param list $arguments */ public function __call($method, $arguments) { @@ -307,12 +306,11 @@ public function matching(Criteria $criteria) * * @param string $method The method to call * @param string $by The property name used as condition + * @psalm-param list $arguments The arguments to pass at method call * * @return mixed * * @throws ORMException If the method called is invalid or the requested field/association does not exist. - * - * @psalm-param list $arguments The arguments to pass at method call */ private function resolveMagicCall(string $method, string $by, array $arguments) { diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index b213266f054..98cf2af6081 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -123,10 +123,9 @@ public function __construct(EntityManagerInterface $em) * * @param object $stmt * @param object $resultSetMapping + * @psalm-param array $hints * * @return IterableResult - * - * @psalm-param array $hints */ public function iterate($stmt, $resultSetMapping, array $hints = []) { @@ -151,9 +150,9 @@ public function iterate($stmt, $resultSetMapping, array $hints = []) /** * Initiates a row-by-row hydration. * - * @return iterable - * * @psalm-param array $hints + * + * @return iterable */ public function toIterable(ResultStatement $stmt, ResultSetMapping $resultSetMapping, array $hints = []): iterable { @@ -195,10 +194,9 @@ public function toIterable(ResultStatement $stmt, ResultSetMapping $resultSetMap * * @param object $stmt * @param object $resultSetMapping + * @psalm-param array $hints * * @return mixed[] - * - * @psalm-param array $hints */ public function hydrateAll($stmt, $resultSetMapping, array $hints = []) { @@ -322,14 +320,13 @@ abstract protected function hydrateAllData(); * the values applied. Scalar values are kept in a specific key 'scalars'. * * @param mixed[] $data SQL Result Row. + * @psalm-param array $id Dql-Alias => ID-Hash. + * @psalm-param array $nonemptyComponents Does this DQL-Alias has at least one non NULL value? * * @return array> An array with all the fields * (name => value) of the data * row, grouped by their * component alias. - * - * @psalm-param array $id Dql-Alias => ID-Hash. - * @psalm-param array $nonemptyComponents Does this DQL-Alias has at least one non NULL value? * @psalm-return array{ * data: array, * newObjects?: array $data + * * @psalm-return array The processed row. */ protected function gatherScalarRowData(&$data) diff --git a/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php b/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php index a815060dd99..24570c64a9e 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php +++ b/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php @@ -100,10 +100,9 @@ public static function missingDiscriminatorMetaMappingColumn($entityName, $discr /** * @param string $discrValue + * @psalm-param array $discrMap * * @return HydrationException - * - * @psalm-param array $discrMap */ public static function invalidDiscriminatorValue($discrValue, $discrMap) { diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index 69cd75a8f1e..b5e917951a1 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -223,12 +223,11 @@ private function initRelatedCollection($entity, $class, $fieldName, $parentDqlAl * Gets an entity instance. * * @param string $dqlAlias The DQL alias of the entity's class. + * @psalm-param array $data The instance data. * * @return object The entity. * * @throws HydrationException - * - * @psalm-param array $data The instance data. */ private function getEntity(array $data, $dqlAlias) { @@ -274,10 +273,9 @@ private function getEntity(array $data, $dqlAlias) /** * @param string $className + * @psalm-param array $data * * @return mixed - * - * @psalm-param array $data */ private function getEntityFromIdentityMap($className, array $data) { diff --git a/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php b/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php index 5c125222610..2e65fc44518 100644 --- a/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php +++ b/lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php @@ -138,10 +138,9 @@ public function setTable($name) * Adds Index. * * @param string $name + * @psalm-param list $columns * * @return static - * - * @psalm-param list $columns */ public function addIndex(array $columns, $name) { @@ -158,10 +157,9 @@ public function addIndex(array $columns, $name) * Adds Unique Constraint. * * @param string $name + * @psalm-param list $columns * * @return static - * - * @psalm-param list $columns */ public function addUniqueConstraint(array $columns, $name) { @@ -299,10 +297,9 @@ public function addLifecycleEvent($methodName, $event) * * @param string $name * @param string $type + * @psalm-param array $mapping * * @return static - * - * @psalm-param array $mapping */ public function addField($name, $type, array $mapping = []) { diff --git a/lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationBuilder.php b/lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationBuilder.php index 03bbbf329dd..6f67e6def65 100644 --- a/lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationBuilder.php +++ b/lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationBuilder.php @@ -28,9 +28,9 @@ class OneToManyAssociationBuilder extends AssociationBuilder { /** - * @return static - * * @psalm-param array $fieldNames + * + * @return static */ public function setOrderBy(array $fieldNames) { diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 32189e52ed9..deab8c836c3 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -704,7 +704,6 @@ public function __construct($entityName, ?NamingStrategy $namingStrategy = null) * Gets the ReflectionProperties of the mapped class. * * @return ReflectionProperty[]|null[] An array of ReflectionProperty instances. - * * @psalm-return array */ public function getReflectionProperties() @@ -780,10 +779,10 @@ public function getIdentifierValues($entity) * Populates the entity identifier of an entity. * * @param object $entity + * @psalm-param array $id * * @return void * - * @psalm-param array $id * @todo Rename to assignIdentifier() */ public function setIdentifierValues($entity, array $id) @@ -1102,9 +1101,9 @@ public function getReflectionClass() } /** - * @return void - * * @psalm-param array{usage?: mixed, region?: mixed} $cache + * + * @return void */ public function enableCache(array $cache) { @@ -1121,10 +1120,9 @@ public function enableCache(array $cache) /** * @param string $fieldName + * @psalm-param array{usage?: mixed, region?: mixed} $cache * * @return void - * - * @psalm-param array{usage?: mixed, region?: mixed} $cache */ public function enableAssociationCache($fieldName, array $cache) { @@ -1134,10 +1132,9 @@ public function enableAssociationCache($fieldName, array $cache) /** * @param string $fieldName * @param array $cache + * @psalm-param array{usage?: mixed, region?: mixed} $cache * * @return mixed[] - * - * @psalm-param array{usage?: mixed, region?: mixed} $cache * @psalm-return array{usage: mixed, region: mixed} */ public function getAssociationCacheDefaults($fieldName, array $cache) @@ -1264,9 +1261,9 @@ public function getColumnName($fieldName) * * @param string $fieldName The field name. * - * @throws MappingException - * * @psalm-return array The field mapping. + * + * @throws MappingException */ public function getFieldMapping($fieldName) { @@ -1285,9 +1282,9 @@ public function getFieldMapping($fieldName) * @param string $fieldName The field name that represents the association in * the object model. * - * @throws MappingException - * * @psalm-return array The mapping. + * + * @throws MappingException */ public function getAssociationMapping($fieldName) { @@ -1358,9 +1355,9 @@ public function getNamedQueries() * * @param string $queryName The query name. * - * @throws MappingException - * * @psalm-return array + * + * @throws MappingException */ public function getNamedNativeQuery($queryName) { @@ -1388,9 +1385,9 @@ public function getNamedNativeQueries() * * @param string $name The result set mapping name. * - * @throws MappingException - * * @psalm-return array + * + * @throws MappingException */ public function getSqlResultSetMapping($name) { @@ -1414,11 +1411,11 @@ public function getSqlResultSetMappings() /** * Validates & completes the given field mapping. * + * @psalm-param array $mapping The field mapping to validate & complete. + * * @return void * * @throws MappingException - * - * @psalm-param array $mapping The field mapping to validate & complete. */ protected function _validateAndCompleteFieldMapping(array &$mapping) { @@ -1479,11 +1476,9 @@ protected function _validateAndCompleteFieldMapping(array &$mapping) * Validates & completes the basic mapping information that is common to all * association mappings (one-to-one, many-ot-one, one-to-many, many-to-many). * - * @return mixed[] The updated mapping. - * - * @throws MappingException If something is wrong with the mapping. - * * @psalm-param array $mapping The mapping. + * + * @return mixed[] The updated mapping. * @psalm-return array{ * mappedBy: mixed, * inversedBy: mixed, @@ -1500,6 +1495,8 @@ protected function _validateAndCompleteFieldMapping(array &$mapping) * isCascadeDetach: bool, * ?orphanRemoval: bool * } + * + * @throws MappingException If something is wrong with the mapping. */ protected function _validateAndCompleteAssociationMapping(array $mapping) { @@ -1617,13 +1614,13 @@ protected function _validateAndCompleteAssociationMapping(array $mapping) /** * Validates & completes a one-to-one association mapping. * + * @psalm-param array $mapping The mapping to validate & complete. + * * @return mixed[] The validated & completed mapping. + * @psalm-return array{isOwningSide: mixed, orphanRemoval: bool, isCascadeRemove: bool} * * @throws RuntimeException * @throws MappingException - * - * @psalm-param array $mapping The mapping to validate & complete. - * @psalm-return array{isOwningSide: mixed, orphanRemoval: bool, isCascadeRemove: bool} */ protected function _validateAndCompleteOneToOneMapping(array $mapping) { @@ -1707,12 +1704,9 @@ protected function _validateAndCompleteOneToOneMapping(array $mapping) /** * Validates & completes a one-to-many association mapping. * - * @return mixed[] The validated and completed mapping. - * - * @throws MappingException - * @throws InvalidArgumentException - * * @psalm-param array $mapping The mapping to validate and complete. + * + * @return mixed[] The validated and completed mapping. * @psalm-return array{ * mappedBy: mixed, * inversedBy: mixed, @@ -1729,6 +1723,9 @@ protected function _validateAndCompleteOneToOneMapping(array $mapping) * isCascadeDetach: bool, * orphanRemoval: bool * } + * + * @throws MappingException + * @throws InvalidArgumentException */ protected function _validateAndCompleteOneToManyMapping(array $mapping) { @@ -1750,12 +1747,12 @@ protected function _validateAndCompleteOneToManyMapping(array $mapping) /** * Validates & completes a many-to-many association mapping. * + * @psalm-param array $mapping The mapping to validate & complete. + * * @return mixed[] The validated & completed mapping. + * @psalm-return array{isOwningSide: mixed, orphanRemoval: bool} * * @throws InvalidArgumentException - * - * @psalm-param array $mapping The mapping to validate & complete. - * @psalm-return array{isOwningSide: mixed, orphanRemoval: bool} */ protected function _validateAndCompleteManyToManyMapping(array $mapping) { @@ -1901,9 +1898,9 @@ public function getSingleIdentifierColumnName() * Sets the mapped identifier/primary key fields of this class. * Mainly used by the ClassMetadataFactory to assign inherited identifiers. * - * @return void - * * @psalm-param list $identifier + * + * @return void */ public function setIdentifier(array $identifier) { @@ -1930,9 +1927,9 @@ public function hasField($fieldName) /** * Gets an array containing all the column names. * - * @return mixed[] - * * @psalm-param list|null $fieldNames + * + * @return mixed[] * @psalm-return list */ public function getColumnNames(?array $fieldNames = null) @@ -2151,9 +2148,9 @@ public function getTemporaryIdTableName() /** * Sets the mapped subclasses of this class. * - * @return void - * * @psalm-param list $subclasses The names of all mapped subclasses. + * + * @return void */ public function setSubclasses(array $subclasses) { @@ -2167,9 +2164,9 @@ public function setSubclasses(array $subclasses) * Assumes that the class names in the passed array are in the order: * directParent -> directParentParent -> directParentParentParent ... -> root. * - * @return void - * * @psalm-param list $classNames + * + * @return void */ public function setParentClasses(array $classNames) { @@ -2202,12 +2199,11 @@ public function setInheritanceType($type) * Sets the association to override association mapping of property for an entity relationship. * * @param string $fieldName + * @psalm-param array $overrideMapping * * @return void * * @throws MappingException - * - * @psalm-param array $overrideMapping */ public function setAssociationOverride($fieldName, array $overrideMapping) { @@ -2268,12 +2264,11 @@ public function setAssociationOverride($fieldName, array $overrideMapping) * Sets the override for a mapped field. * * @param string $fieldName + * @psalm-param array $overrideMapping * * @return void * * @throws MappingException - * - * @psalm-param array $overrideMapping */ public function setAttributeOverride($fieldName, array $overrideMapping) { @@ -2381,9 +2376,9 @@ public function setTableName($tableName) * * If a key is omitted, the current value is kept. * - * @return void - * * @psalm-param array $table The table description. + * + * @return void */ public function setPrimaryTable(array $table) { @@ -2440,11 +2435,11 @@ private function isInheritanceType($type) /** * Adds a mapped field to the class. * + * @psalm-param array $mapping The field mapping. + * * @return void * * @throws MappingException - * - * @psalm-param array $mapping The field mapping. */ public function mapField(array $mapping) { @@ -2459,11 +2454,11 @@ public function mapField(array $mapping) * Adds an association mapping without completing/validating it. * This is mainly used to add inherited association mappings to derived classes. * + * @psalm-param array $mapping + * * @return void * * @throws MappingException - * - * @psalm-param array $mapping */ public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/) { @@ -2479,9 +2474,9 @@ public function addInheritedAssociationMapping(array $mapping/*, $owningClassNam * Adds a field mapping without completing/validating it. * This is mainly used to add inherited field mappings to derived classes. * - * @return void - * * @psalm-param array $fieldMapping + * + * @return void */ public function addInheritedFieldMapping(array $fieldMapping) { @@ -2494,11 +2489,11 @@ public function addInheritedFieldMapping(array $fieldMapping) * INTERNAL: * Adds a named query to this class. * + * @psalm-param array $queryMapping + * * @return void * * @throws MappingException - * - * @psalm-param array $queryMapping */ public function addNamedQuery(array $queryMapping) { @@ -2529,11 +2524,11 @@ public function addNamedQuery(array $queryMapping) * INTERNAL: * Adds a named native query to this class. * + * @psalm-param array $queryMapping + * * @return void * * @throws MappingException - * - * @psalm-param array $queryMapping */ public function addNamedNativeQuery(array $queryMapping) { @@ -2572,11 +2567,11 @@ public function addNamedNativeQuery(array $queryMapping) * INTERNAL: * Adds a sql result set mapping to this class. * + * @psalm-param array $resultMapping + * * @return void * * @throws MappingException - * - * @psalm-param array $resultMapping */ public function addSqlResultSetMapping(array $resultMapping) { @@ -2646,9 +2641,9 @@ public function mapOneToOne(array $mapping) /** * Adds a one-to-many mapping. * - * @return void - * * @psalm-param array $mapping The mapping. + * + * @return void */ public function mapOneToMany(array $mapping) { @@ -2662,9 +2657,9 @@ public function mapOneToMany(array $mapping) /** * Adds a many-to-one mapping. * - * @return void - * * @psalm-param array $mapping The mapping. + * + * @return void */ public function mapManyToOne(array $mapping) { @@ -2679,9 +2674,9 @@ public function mapManyToOne(array $mapping) /** * Adds a many-to-many mapping. * - * @return void - * * @psalm-param array $mapping The mapping. + * + * @return void */ public function mapManyToMany(array $mapping) { @@ -2695,11 +2690,11 @@ public function mapManyToMany(array $mapping) /** * Stores the association mapping. * + * @psalm-param array $assocMapping + * * @return void * * @throws MappingException - * - * @psalm-param array $assocMapping */ protected function _storeAssociationMapping(array $assocMapping) { @@ -2714,10 +2709,9 @@ protected function _storeAssociationMapping(array $assocMapping) * Registers a custom repository class for the entity class. * * @param string $repositoryClassName The class name of the custom mapper. + * @psalm-param class-string $repositoryClassName * * @return void - * - * @psalm-param class-string $repositoryClassName */ public function setCustomRepositoryClass($repositoryClassName) { @@ -2787,9 +2781,9 @@ public function addLifecycleCallback($callback, $event) * Sets the lifecycle callbacks for entities of this class. * Any previously registered callbacks are overwritten. * - * @return void - * * @psalm-param array> $callbacks + * + * @return void */ public function setLifecycleCallbacks(array $callbacks) { @@ -2834,11 +2828,11 @@ public function addEntityListener($eventName, $class, $method) * * @see getDiscriminatorColumn() * + * @psalm-param array $columnDef + * * @return void * * @throws MappingException - * - * @psalm-param array $columnDef */ public function setDiscriminatorColumn($columnDef) { @@ -2871,9 +2865,9 @@ public function setDiscriminatorColumn($columnDef) * Sets the discriminator values used by this class. * Used for JOINED and SINGLE_TABLE inheritance mapping strategies. * - * @return void - * * @psalm-param array $map + * + * @return void */ public function setDiscriminatorMap(array $map) { @@ -2886,12 +2880,11 @@ public function setDiscriminatorMap(array $map) * Adds one entry of the discriminator map with a new class and corresponding name. * * @param string $name + * @psalm-param class-string $className * * @return void * * @throws MappingException - * - * @psalm-param class-string $className */ public function addDiscriminatorMapClass($name, $className) { @@ -3071,9 +3064,9 @@ public function setIdGenerator($generator) /** * Sets definition. * - * @return void - * * @psalm-param array $definition + * + * @return void */ public function setCustomGeneratorDefinition(array $definition) { @@ -3093,11 +3086,11 @@ public function setCustomGeneratorDefinition(array $definition) * ) * * + * @psalm-param array $definition + * * @return void * * @throws MappingException - * - * @psalm-param array $definition */ public function setSequenceGeneratorDefinition(array $definition) { @@ -3125,11 +3118,11 @@ public function setSequenceGeneratorDefinition(array $definition) * Sets the version field mapping used for versioning. Sets the default * value to use depending on the column type. * + * @psalm-param array $mapping The version field mapping array. + * * @return void * * @throws MappingException - * - * @psalm-param array $mapping The version field mapping array. */ public function setVersionMapping(array &$mapping) { @@ -3346,10 +3339,9 @@ public function getAssociationsByTargetClass($targetClass) /** * @param string|null $className + * @psalm-param ?class-string $className * * @return string|null null if the input value is null - * - * @psalm-param ?class-string $className */ public function fullyQualifiedClassName($className) { @@ -3381,11 +3373,11 @@ public function getMetadataValue($name) /** * Map Embedded Class * + * @psalm-param array $mapping + * * @return void * * @throws MappingException - * - * @psalm-param array $mapping */ public function mapEmbedded(array $mapping) { diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index 30f31958ab2..47513cf3f3b 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -488,7 +488,6 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) /** * @param mixed[] $joinColumns - * * @psalm-param array $mapping */ private function loadRelationShipMapping( @@ -665,7 +664,6 @@ private function getMethodCallbacks(ReflectionMethod $method) * Parse the given JoinColumn as array * * @return mixed[] - * * @psalm-return array{ * name: string, * unique: bool, @@ -693,7 +691,6 @@ private function joinColumnToArray(Mapping\JoinColumn $joinColumn) * @param string $fieldName * * @return mixed[] - * * @psalm-return array{ * fieldName: string, * type: mixed, diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index 190bfb2bbe4..0eb67da0ad2 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -145,10 +145,10 @@ public function setFieldNameForColumn($tableName, $columnName, $fieldName) /** * Sets tables manually instead of relying on the reverse engineering capabilities of SchemaManager. * - * @return void - * * @psalm-param list $entityTables * @psalm-param list
$manyToManyTables + * + * @return void */ public function setTables($entityTables, $manyToManyTables) { @@ -498,7 +498,6 @@ private function buildToOneAssociationMappings(ClassMetadataInfo $metadata) * Retrieve schema table definition foreign keys. * * @return ForeignKeyConstraint[] - * * @psalm-return array */ private function getTableForeignKeys(Table $table) diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index 27be9209ebf..d8a122b1094 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -714,7 +714,6 @@ private function parseOptions(SimpleXMLElement $options) * @param SimpleXMLElement $joinColumnElement The XML element. * * @return mixed[] The mapping array. - * * @psalm-return array{ * name: string, * referencedColumnName: string, @@ -754,7 +753,6 @@ private function joinColumnToArray(SimpleXMLElement $joinColumnElement) * Parses the given field as array. * * @return mixed[] - * * @psalm-return array{ * fieldName: string, * type?: string, @@ -822,7 +820,6 @@ private function columnToArray(SimpleXMLElement $fieldMapping) * Parse / Normalize the cache configuration * * @return mixed[] - * * @psalm-return array{usage: mixed, region: string|null} */ private function cacheToArray(SimpleXMLElement $cacheMapping) @@ -850,7 +847,6 @@ private function cacheToArray(SimpleXMLElement $cacheMapping) * @param SimpleXMLElement $cascadeElement The cascade element. * * @return string[] The list of cascade options. - * * @psalm-return list */ private function getCascadeMappings(SimpleXMLElement $cascadeElement) diff --git a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index 501cea108bc..0b017ddc0fc 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -689,8 +689,6 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) * Constructs a joinColumn mapping array based on the information * found in the given join column element. * - * @return mixed[] The mapping array. - * * @psalm-param array{ * referencedColumnName?: mixed, * name?: mixed, @@ -700,6 +698,8 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) * onDelete?: mixed, * columnDefinition?: mixed * } $joinColumnElement The array join column element. + * + * @return mixed[] The mapping array. * @psalm-return array{ * referencedColumnName?: string, * name?: string, @@ -747,8 +747,6 @@ private function joinColumnToArray(array $joinColumnElement): array /** * Parses the given column as array. * - * @return mixed[] - * * @psalm-param array{ * type?: string, * column?: string, @@ -760,6 +758,8 @@ private function joinColumnToArray(array $joinColumnElement): array * version?: mixed, * columnDefinition?: mixed * }|null $column + * + * @return mixed[] * @psalm-return array{ * fieldName: string, * type?: string, @@ -832,10 +832,9 @@ private function columnToArray(string $fieldName, ?array $column): array * Parse / Normalize the cache configuration * * @param mixed[] $cacheMapping + * @psalm-param array{usage: mixed, region: (string|null)} $cacheMapping * * @return mixed[] - * - * @psalm-param array{usage: mixed, region: (string|null)} $cacheMapping * @psalm-return array{usage: mixed, region: (string|null)} */ private function cacheToArray($cacheMapping) diff --git a/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php b/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php index 0d5be731368..38c22c312ce 100644 --- a/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php +++ b/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php @@ -51,10 +51,9 @@ public function __construct(ReflectionService $reflectionService) /** * @param string $className + * @psalm-param class-string $className * * @return ReflectionProperty[] indexed by property internal name - * - * @psalm-param class-string $className */ public function getProperties($className) { @@ -79,7 +78,6 @@ public function getProperties($className) * @param string $className * * @return ReflectionClass[] - * * @psalm-return list */ private function getHierarchyClasses($className): array @@ -104,7 +102,6 @@ private function getHierarchyClasses($className): array /** * @return ReflectionProperty[] - * * @psalm-return array */ private function getClassProperties(ReflectionClass $reflectionClass): array diff --git a/lib/Doctrine/ORM/ORMInvalidArgumentException.php b/lib/Doctrine/ORM/ORMInvalidArgumentException.php index 14c742bbe32..2cc2c71cbb8 100644 --- a/lib/Doctrine/ORM/ORMInvalidArgumentException.php +++ b/lib/Doctrine/ORM/ORMInvalidArgumentException.php @@ -123,10 +123,9 @@ static function (array $newEntityWithAssociation): string { /** * @param object $entry + * @psalm-param array $associationMapping * * @return ORMInvalidArgumentException - * - * @psalm-param array $associationMapping */ public static function newEntityFoundThroughRelationship(array $associationMapping, $entry) { @@ -135,10 +134,9 @@ public static function newEntityFoundThroughRelationship(array $associationMappi /** * @param object $entry + * @psalm-param array $assoc * * @return ORMInvalidArgumentException - * - * @psalm-param array $assoc */ public static function detachedEntityFoundThroughRelationship(array $assoc, $entry) { diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index de24b0d36de..0f7b47cc17b 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -111,7 +111,6 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec * * @param EntityManagerInterface $em The EntityManager the collection will be associated with. * @param ClassMetadata $class The class descriptor of the entity type of this collection. - * * @psalm-param Collection $collection The collection elements. */ public function __construct(EntityManagerInterface $em, $class, Collection $collection) @@ -128,10 +127,9 @@ public function __construct(EntityManagerInterface $em, $class, Collection $coll * describes the association between the owner and the elements of the collection. * * @param object $entity + * @psalm-param array $assoc * * @return void - * - * @psalm-param array $assoc */ public function setOwner($entity, array $assoc) { @@ -605,7 +603,6 @@ public function clear() * with circular references. This solution seems simpler and works well. * * @return string[] - * * @psalm-return array{0: string, 1: string} */ public function __sleep(): array diff --git a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php index 7f38f934640..346fa438c54 100644 --- a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php @@ -298,11 +298,11 @@ public function loadCriteria(PersistentCollection $collection, Criteria $criteri * have to join in the actual entities table leading to additional * JOIN. * + * @psalm-param array $mapping Array containing mapping information. + * * @return string[] ordered tuple: * - JOIN condition to add to the SQL * - WHERE condition to add to the SQL - * - * @psalm-param array $mapping Array containing mapping information. * @psalm-return array{0: string, 1: string} */ public function getFilterSql($mapping) @@ -350,9 +350,9 @@ protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targ /** * Generate ON condition * - * @return string[] - * * @psalm-param array $mapping + * + * @return string[] * @psalm-return list */ protected function getOnConditionSQL($mapping) @@ -429,7 +429,6 @@ protected function getDeleteSQLParameters(PersistentCollection $collection) * * @return string[]|string[][] ordered tuple containing the SQL to be executed and an array * of types for bound parameters - * * @psalm-return array{0: string, 1: list} */ protected function getDeleteRowSQL(PersistentCollection $collection) @@ -477,7 +476,6 @@ protected function getDeleteRowSQLParameters(PersistentCollection $collection, $ * * @return string[]|string[][] ordered tuple containing the SQL to be executed and an array * of types for bound parameters - * * @psalm-return array{0: string, 1: list} */ protected function getInsertRowSQL(PersistentCollection $collection) @@ -529,7 +527,6 @@ protected function getInsertRowSQLParameters(PersistentCollection $collection, $ * @param object $element * * @return mixed[] - * * @psalm-return list */ private function collectJoinTableColumnParameters(PersistentCollection $collection, $element) @@ -577,7 +574,6 @@ private function collectJoinTableColumnParameters(PersistentCollection $collecti * - where clauses to be added for filtering * - parameters to be bound for filtering * - types of the parameters to be bound for filtering - * * @psalm-return array{0: string, 1: list, 2: list, 3: list} */ private function getJoinTableRestrictionsWithKey(PersistentCollection $collection, $key, $addFilters) @@ -663,7 +659,6 @@ private function getJoinTableRestrictionsWithKey(PersistentCollection $collectio * - where clauses to be added for filtering * - parameters to be bound for filtering * - types of the parameters to be bound for filtering - * * @psalm-return array{0: string, 1: list, 2: list, 3: list} */ private function getJoinTableRestrictions(PersistentCollection $collection, $element, $addFilters) diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php index adbd5934b43..b3af206e946 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php @@ -362,7 +362,6 @@ protected function fetchVersionValue($versionedClass, array $id) * @param mixed[] $id * * @return int[]|null[]|string[] - * * @psalm-return list<(int|string|null)> */ private function extractIdentifierTypes(array $id, ClassMetadata $versionedClass): array @@ -611,7 +610,6 @@ public function delete($entity) * @param object $entity The entity for which to prepare the data. * * @return mixed[][] The prepared data. - * * @psalm-return array> */ protected function prepareUpdateData($entity) @@ -703,7 +701,6 @@ protected function prepareUpdateData($entity) * @param object $entity The entity for which to prepare the data. * * @return mixed[][] The prepared data for the tables to update. - * * @psalm-return array */ protected function prepareInsertData($entity) @@ -976,11 +973,11 @@ public function loadManyToManyCollection(array $assoc, $sourceEntity, Persistent } /** + * @psalm-param array $assoc + * * @return \Doctrine\DBAL\Driver\Statement * * @throws MappingException - * - * @psalm-param array $assoc */ private function getManyToManyStatement( array $assoc, @@ -1140,9 +1137,9 @@ public function getCountSQL($criteria = []) /** * Gets the ORDER BY SQL snippet for ordered collections. * - * @throws ORMException - * * @psalm-param array $orderBy + * + * @throws ORMException */ final protected function getOrderBySQL(array $orderBy, string $baseTableAlias): string { @@ -1350,9 +1347,9 @@ protected function getSelectColumnAssociationSQL($field, $assoc, ClassMetadata $ * Gets the SQL join fragment used when selecting entities from a * many-to-many association. * - * @return string - * * @psalm-param array $manyToMany + * + * @return string */ protected function getSelectManyToManyJoinSQL(array $manyToMany) { @@ -1431,7 +1428,6 @@ public function getInsertSQL() * columns placed in the INSERT statements used by the persister. * * @return string[] The list of columns. - * * @psalm-return list */ protected function getInsertColumnList() @@ -1661,13 +1657,12 @@ public function getSelectConditionStatementSQL($field, $value, $assoc = null, $c * Builds the left-hand-side of a where condition statement. * * @param string $field + * @psalm-param array|null $assoc * * @return string[] + * @psalm-return list * * @throws ORMException - * - * @psalm-param array|null $assoc - * @psalm-return list */ private function getSelectConditionStatementColumnSQL($field, $assoc = null) { @@ -1729,10 +1724,10 @@ private function getSelectConditionStatementColumnSQL($field, $assoc = null) * Subclasses are supposed to override this method if they intend to change * or alter the criteria by which entities are selected. * - * @return string - * * @psalm-param array $criteria * @psalm-param array|null $assoc + * + * @return string */ protected function getSelectConditionSQL(array $criteria, $assoc = null) { @@ -1773,10 +1768,9 @@ public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentC * @param object $sourceEntity * @param int|null $offset * @param int|null $limit + * @psalm-param array $assoc * * @return Statement - * - * @psalm-param array $assoc */ private function getOneToManyStatement(array $assoc, $sourceEntity, $offset = null, $limit = null) { @@ -1855,7 +1849,6 @@ public function expandParameters($criteria) * - class to which the field belongs to * * @return mixed[][] - * * @psalm-return array{0: array, 1: list} */ private function expandToManyParameters($criteria) @@ -1882,10 +1875,9 @@ private function expandToManyParameters($criteria) * @param mixed $value * * @return int[]|null[]|string[] + * @psalm-return list<(int|string|null)> * * @throws QueryException - * - * @psalm-return list<(int|string|null)> */ private function getTypes($field, $value, ClassMetadata $class) { @@ -2020,9 +2012,9 @@ public function exists($entity, ?Criteria $extraConditions = null) /** * Generates the appropriate join SQL for the given join column. * - * @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise. - * * @psalm-param array> $joinColumns The join columns definition of an association. + * + * @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise. */ protected function getJoinSQLForJoinColumns($joinColumns) { diff --git a/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php index 0c755e95ee7..1bdf7d29ebc 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php @@ -106,10 +106,9 @@ public function expandCriteriaParameters(Criteria $criteria); * @param string $field * @param mixed $value * @param string|null $comparison + * @psalm-param array|null $assoc * * @return string - * - * @psalm-param array|null $assoc */ public function getSelectConditionStatementSQL($field, $value, $assoc = null, $comparison = null); @@ -192,9 +191,6 @@ public function getOwningTable($fieldName); * or NULL if no specific lock mode should be used * for loading the entity. * @param int|null $limit Limit number of results. - * - * @return object|null The loaded and managed entity instance or NULL if the entity can not be found. - * * @psalm-param array $hints Hints for entity creation. * @psalm-param array $criteria The criteria by which * to load the entity. @@ -203,6 +199,9 @@ public function getOwningTable($fieldName); * load to another entity, * if any. * @psalm-param array|null $orderBy Criteria to order by. + * + * @return object|null The loaded and managed entity instance or NULL if the entity can not be found. + * * @todo Check identity map? loadById method? Try to guess whether $criteria is the id? */ public function load( @@ -219,10 +218,10 @@ public function load( * Loads an entity by identifier. * * @param object|null $entity The entity to load the data into. If not specified, a new entity is created. + * @psalm-param array $identifier The entity identifier. * * @return object The loaded and managed entity instance or NULL if the entity can not be found. * - * @psalm-param array $identifier The entity identifier. * @todo Check parameters */ public function loadById(array $identifier, $entity = null); @@ -232,15 +231,14 @@ public function loadById(array $identifier, $entity = null); * association from another entity. * * @param object $sourceEntity The entity that owns the association (not necessarily the "owning side"). - * - * @return object The loaded and managed entity instance or NULL if the entity can not be found. - * - * @throws MappingException - * * @psalm-param array $identifier The identifier of the entity to load. Must be provided if * the association to load represents the owning side, otherwise * the identifier is derived from the $sourceEntity. * @psalm-param array $assoc The association to load. + * + * @return object The loaded and managed entity instance or NULL if the entity can not be found. + * + * @throws MappingException */ public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = []); @@ -251,12 +249,11 @@ public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifie * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants * or NULL if no specific lock mode should be used * for refreshing the managed entity. - * - * @return void - * * @psalm-param array $id The identifier of the entity as an * associative array from column or * field names to values. + * + * @return void */ public function refresh(array $id, $entity, $lockMode = null); @@ -272,7 +269,6 @@ public function loadCriteria(Criteria $criteria); * * @param int|null $limit * @param int|null $offset - * * @psalm-param array|null $orderBy * @psalm-param array $criteria */ @@ -284,10 +280,9 @@ public function loadAll(array $criteria = [], ?array $orderBy = null, $limit = n * @param object $sourceEntity * @param int|null $offset * @param int|null $limit + * @psalm-param array $assoc * * @return mixed[] - * - * @psalm-param array $assoc */ public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null); @@ -296,10 +291,9 @@ public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = n * * @param object $sourceEntity The entity that owns the collection. * @param PersistentCollection $collection The collection to fill. + * @psalm-param array $assoc The association mapping of the association being loaded. * * @return mixed[] - * - * @psalm-param array $assoc The association mapping of the association being loaded. */ public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection); @@ -308,10 +302,9 @@ public function loadManyToManyCollection(array $assoc, $sourceEntity, Persistent * * @param object $sourceEntity * @param PersistentCollection $collection The collection to load/fill. + * @psalm-param array $assoc * * @return mixed - * - * @psalm-param array $assoc */ public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection); @@ -319,10 +312,9 @@ public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentC * Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode. * * @param int $lockMode One of the Doctrine\DBAL\LockMode::* constants. + * @psalm-param array $criteria * * @return void - * - * @psalm-param array $criteria */ public function lock(array $criteria, $lockMode); @@ -332,10 +324,9 @@ public function lock(array $criteria, $lockMode); * @param object $sourceEntity * @param int|null $offset * @param int|null $limit + * @psalm-param array $assoc * * @return mixed[] - * - * @psalm-param array $assoc */ public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null); diff --git a/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php b/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php index b5036ff7a6c..cdd964017ef 100644 --- a/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php +++ b/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php @@ -83,7 +83,6 @@ public function walkValue(Value $value) * Returns the Parameters and Types necessary for matching the last visited expression. * * @return mixed[][] - * * @psalm-return array{0: array, 1: array} */ public function getParamsAndTypes() diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index b7aa3943992..c1a1df03d4d 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -110,10 +110,9 @@ protected function createProxyDefinition($className) * Creates a closure capable of initializing a proxy * * @return Closure + * @psalm-return Closure(BaseProxy ): void * * @throws EntityNotFoundException - * - * @psalm-return Closure(BaseProxy ): void */ private function createInitializer(ClassMetadata $classMetadata, EntityPersister $entityPersister) { @@ -163,10 +162,9 @@ private function createInitializer(ClassMetadata $classMetadata, EntityPersister * Creates a closure capable of finalizing state a cloned proxy * * @return Closure + * @psalm-return Closure(BaseProxy ): void * * @throws EntityNotFoundException - * - * @psalm-return Closure(BaseProxy ): void */ private function createCloner(ClassMetadata $classMetadata, EntityPersister $entityPersister) { diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index 447225be82e..e6c928b9570 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -374,10 +374,9 @@ private function evictEntityCacheRegion() * @param Parameter[] $paramMappings * * @return mixed[][] + * @psalm-return array{0: list, 1: array} * * @throws Query\QueryException - * - * @psalm-return array{0: list, 1: array} */ private function processParameterMappings(array $paramMappings): array { @@ -426,7 +425,6 @@ private function processParameterMappings(array $paramMappings): array /** * @return mixed[] tuple of (value, type) - * * @psalm-return array{0: mixed, 1: mixed} */ private function resolveParameterValue(Parameter $parameter): array diff --git a/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php b/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php index cfe42489ffc..1834a778e54 100644 --- a/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php @@ -72,12 +72,11 @@ public function removeQueryCacheProfile() * Executes all sql statements. * * @param Connection $conn The database connection that is used to execute the queries. - * - * @return ResultStatement|int - * * @psalm-param array|array $params The parameters. * @psalm-param array| * array $types The parameter types. + * + * @return ResultStatement|int */ abstract public function execute(Connection $conn, array $params, array $types); } diff --git a/lib/Doctrine/ORM/Query/Expr/Base.php b/lib/Doctrine/ORM/Query/Expr/Base.php index 9928f5c232f..37c9433bf23 100644 --- a/lib/Doctrine/ORM/Query/Expr/Base.php +++ b/lib/Doctrine/ORM/Query/Expr/Base.php @@ -60,9 +60,9 @@ public function __construct($args = []) } /** - * @return static - * * @psalm-param list $args + * + * @return static */ public function addMultiple($args = []) { diff --git a/lib/Doctrine/ORM/Query/Expr/Func.php b/lib/Doctrine/ORM/Query/Expr/Func.php index 118530c2af3..e87fc1e1358 100644 --- a/lib/Doctrine/ORM/Query/Expr/Func.php +++ b/lib/Doctrine/ORM/Query/Expr/Func.php @@ -39,7 +39,6 @@ class Func * Creates a function, with the given argument. * * @param string $name - * * @psalm-param list $arguments */ public function __construct($name, $arguments) diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 96204abecca..3d966269420 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -261,9 +261,9 @@ public function setCustomOutputTreeWalker($className) /** * Adds a custom tree walker for modifying the AST. * - * @return void - * * @psalm-param class-string $className + * + * @return void */ public function addCustomTreeWalker($className) { @@ -491,12 +491,11 @@ private function fixIdentificationVariableOrder($AST) * Generates a new syntax error. * * @param string $expected Expected string. + * @psalm-param array|null $token Got token. * * @return void * * @throws QueryException - * - * @psalm-param array|null $token Got token. */ public function syntaxError($expected = '', $token = null) { @@ -517,12 +516,11 @@ public function syntaxError($expected = '', $token = null) * Generates a new semantical error. * * @param string $message Optional message. + * @psalm-param array|null $token Optional token. * * @return void * * @throws QueryException - * - * @psalm-param array|null $token Optional token. */ public function semanticalError($message = '', $token = null) { @@ -613,9 +611,9 @@ private function isFunction(): bool /** * Checks whether the given token type indicates an aggregate function. * - * @return bool TRUE if the token type is an aggregate function, FALSE otherwise. - * * @psalm-param Lexer::T_* $tokenType + * + * @return bool TRUE if the token type is an aggregate function, FALSE otherwise. */ private function isAggregateFunction(int $tokenType): bool { diff --git a/lib/Doctrine/ORM/Query/QueryException.php b/lib/Doctrine/ORM/Query/QueryException.php index 5fd86474ea8..edfbc123c1f 100644 --- a/lib/Doctrine/ORM/Query/QueryException.php +++ b/lib/Doctrine/ORM/Query/QueryException.php @@ -165,9 +165,9 @@ public static function invalidLiteral($literal) } /** - * @return QueryException - * * @psalm-param array $assoc + * + * @return QueryException */ public static function iterateWithFetchJoinCollectionNotAllowed($assoc) { @@ -190,9 +190,9 @@ public static function partialObjectsAreDangerous() } /** - * @return QueryException - * * @psalm-param array $assoc + * + * @return QueryException */ public static function overwritingJoinConditionsNotYetSupported($assoc) { @@ -215,9 +215,9 @@ public static function associationPathInverseSideNotSupported(PathExpression $pa } /** - * @return QueryException - * * @psalm-param array $assoc + * + * @return QueryException */ public static function iterateWithFetchJoinNotAllowed($assoc) { diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index 288ada32ec7..52fefde70f0 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -87,10 +87,9 @@ public function __construct(EntityManagerInterface $em, $defaultRenameMode = sel * @param string $class The class name of the root entity. * @param string $alias The unique alias to use for the root entity. * @param int|null $renameMode One of the COLUMN_RENAMING_* constants or array for BC reasons (CUSTOM). + * @psalm-param array $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). * * @return void - * - * @psalm-param array $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). */ public function addRootEntityFromClassMetadata($class, $alias, $renamedColumns = [], $renameMode = null) { @@ -110,10 +109,9 @@ public function addRootEntityFromClassMetadata($class, $alias, $renamedColumns = * @param string $relation The association field that connects the parent entity result * with the joined entity result. * @param int|null $renameMode One of the COLUMN_RENAMING_* constants or array for BC reasons (CUSTOM). + * @psalm-param array $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). * * @return void - * - * @psalm-param array $renamedColumns Columns that have been renamed (tableColumnName => queryColumnName). */ public function addJoinedEntityFromClassMetadata($class, $alias, $parentAlias, $relation, $renamedColumns = [], $renameMode = null) { @@ -129,12 +127,11 @@ public function addJoinedEntityFromClassMetadata($class, $alias, $parentAlias, $ * * @param string $class * @param string $alias + * @psalm-param array $columnAliasMap * * @return void * * @throws InvalidArgumentException - * - * @psalm-param array $columnAliasMap */ protected function addAllClassFields($class, $alias, $columnAliasMap = []) { @@ -199,10 +196,9 @@ private function isInheritanceSupported(ClassMetadataInfo $classMetadata): bool * * @param string $columnName * @param int $mode + * @psalm-param array $customRenameColumns * * @return string - * - * @psalm-param array $customRenameColumns */ private function getColumnAlias($columnName, $mode, array $customRenameColumns) { @@ -225,10 +221,9 @@ private function getColumnAlias($columnName, $mode, array $customRenameColumns) * * @param string $className * @param int $mode + * @psalm-param array $customRenameColumns * * @return string[] - * - * @psalm-param array $customRenameColumns * @psalm-return array */ private function getColumnAliasMap($className, $mode, array $customRenameColumns) @@ -430,9 +425,9 @@ public function addNamedNativeQueryEntityResultMapping(ClassMetadataInfo $classM * Works only for all the entity results. The select parts for scalar * expressions have to be written manually. * - * @return string - * * @psalm-param array $tableAliases + * + * @return string */ public function generateSelectClause($tableAliases = []) { diff --git a/lib/Doctrine/ORM/Query/TreeWalker.php b/lib/Doctrine/ORM/Query/TreeWalker.php index a868185706b..248cd520c41 100644 --- a/lib/Doctrine/ORM/Query/TreeWalker.php +++ b/lib/Doctrine/ORM/Query/TreeWalker.php @@ -41,7 +41,6 @@ public function __construct($query, $parserResult, array $queryComponents); * Returns internal queryComponents array. * * @return array> - * * @psalm-return array|false */ public function rewind() diff --git a/lib/Doctrine/ORM/QueryBuilder.php b/lib/Doctrine/ORM/QueryBuilder.php index ac9fd9b1c18..df24824458e 100644 --- a/lib/Doctrine/ORM/QueryBuilder.php +++ b/lib/Doctrine/ORM/QueryBuilder.php @@ -455,7 +455,6 @@ public function getRootAlias() * * * @return mixed[] - * * @psalm-return list */ public function getRootAliases() @@ -491,7 +490,6 @@ public function getRootAliases() * * * @return mixed[] - * * @psalm-return list */ public function getAllAliases() @@ -512,7 +510,6 @@ public function getAllAliases() * * * @return mixed[] - * * @psalm-return list */ public function getRootEntities() @@ -695,10 +692,9 @@ public function getMaxResults() * * @param string $dqlPartName The DQL part name. * @param bool $append Whether to append (true) or replace (false). + * @psalm-param string|object|list|array{join: array} $dqlPart An Expr object. * * @return self - * - * @psalm-param string|object|list|array{join: array} $dqlPart An Expr object. */ public function add($dqlPartName, $dqlPart, $append = false) { @@ -1469,9 +1465,9 @@ private function getReducedDQLQueryPart(string $queryPartName, array $options = /** * Resets DQL parts. * - * @return self - * * @psalm-param list|null $parts + * + * @return self */ public function resetDQLParts($parts = null) { diff --git a/lib/Doctrine/ORM/Tools/Console/Command/MappingDescribeCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/MappingDescribeCommand.php index 889dad9693c..8d16e0325fd 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/MappingDescribeCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/MappingDescribeCommand.php @@ -253,7 +253,6 @@ private function formatValue($value) * @param mixed $value A Value to show * * @return string[] - * * @psalm-return array{0: string, 1: string} */ private function formatField($label, $value): array @@ -268,9 +267,9 @@ private function formatField($label, $value): array /** * Format the association mappings * - * @return string[][] - * * @psalm-param array> $propertyMappings + * + * @return string[][] * @psalm-return list */ private function formatMappings(array $propertyMappings): array @@ -291,9 +290,9 @@ private function formatMappings(array $propertyMappings): array /** * Format the entity listeners * - * @return string[] - * * @psalm-param list $entityListeners + * + * @return string[] * @psalm-return array{0: string, 1: string} */ private function formatEntityListeners(array $entityListeners): array diff --git a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php index fa7c6cc40fd..682f860acd1 100644 --- a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php +++ b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php @@ -71,7 +71,6 @@ public function __construct($from) * Doctrine 1 schema. * * @return ClassMetadataInfo[] An array of ClassMetadataInfo instances - * * @psalm-return list */ public function getMetadata() diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 4828fdd47ff..6c0fb82b8c2 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -384,10 +384,9 @@ public function __construct() * Generates and writes entity classes for the given array of ClassMetadataInfo instances. * * @param string $outputDirectory + * @psalm-param list $metadatas * * @return void - * - * @psalm-param list $metadatas */ public function generate(array $metadatas, $outputDirectory) { @@ -539,12 +538,11 @@ public function setGenerateAnnotations($bool) * Sets the class fields visibility for the entity (can either be private or protected). * * @param string $visibility + * @psalm-param self::FIELD_VISIBLE_* * * @return void * * @throws InvalidArgumentException - * - * @psalm-param self::FIELD_VISIBLE_* */ public function setFieldVisibility($visibility) { @@ -946,10 +944,9 @@ protected function hasMethod($method, ClassMetadataInfo $metadata) /** * @return ReflectionClass[] + * @psalm-return array * * @throws ReflectionException - * - * @psalm-return array */ protected function getTraits(ClassMetadataInfo $metadata) { @@ -1115,10 +1112,9 @@ protected function generateTableAnnotation(ClassMetadataInfo $metadata) /** * @param string $constraintName + * @psalm-param array> $constraints * * @return string - * - * @psalm-param array> $constraints */ protected function generateTableConstraints($constraintName, array $constraints) { @@ -1286,9 +1282,9 @@ protected function generateEntityStubMethods(ClassMetadataInfo $metadata) } /** - * @return bool - * * @psalm-param array $associationMapping + * + * @return bool */ protected function isAssociationIsNullable(array $associationMapping) { @@ -1490,9 +1486,9 @@ protected function generateLifecycleCallbackMethod($name, $methodName, ClassMeta } /** - * @return string - * * @psalm-param array $joinColumn + * + * @return string */ protected function generateJoinColumnAnnotation(array $joinColumn) { @@ -1812,9 +1808,9 @@ protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, Cla } /** - * @return string - * * @psalm-param array $embeddedClass + * + * @return string */ protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) { diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php index dc2b0453b30..18acfa7ff93 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php @@ -88,9 +88,9 @@ abstract public function exportClassMetadata(ClassMetadataInfo $metadata); /** * Sets the array of ClassMetadata instances to export. * - * @return void - * * @psalm-param list $metadata + * + * @return void */ public function setMetadata(array $metadata) { @@ -187,10 +187,9 @@ public function setExtension($extension) /** * @param int $type + * @psalm-param ClassMetadataInfo::INHERITANCE_TYPE_* $type * * @return string - * - * @psalm-param ClassMetadataInfo::INHERITANCE_TYPE_* $type */ protected function _getInheritanceTypeString($type) { @@ -211,10 +210,9 @@ protected function _getInheritanceTypeString($type) /** * @param int $mode + * @psalm-param ClassMetadataInfo::FETCH_* $mode * * @return string - * - * @psalm-param ClassMetadataInfo::FETCH_* $mode */ protected function _getFetchModeString($mode) { @@ -232,10 +230,9 @@ protected function _getFetchModeString($mode) /** * @param int $policy + * @psalm-param ClassMetadataInfo::CHANGETRACKING_* $policy * * @return string - * - * @psalm-param ClassMetadataInfo::CHANGETRACKING_* $policy */ protected function _getChangeTrackingPolicyString($policy) { @@ -253,10 +250,9 @@ protected function _getChangeTrackingPolicyString($policy) /** * @param int $type + * @psalm-param ClassMetadataInfo::GENERATOR_TYPE_* $type * * @return string - * - * @psalm-param ClassMetadataInfo::GENERATOR_TYPE_* $type */ protected function _getIdGeneratorTypeString($type) { diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php index 616b00f98a6..b2e55974849 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php @@ -197,7 +197,6 @@ protected function _varExport($var) /** * @return string[] - * * @psalm-return list */ private function processEntityListeners(ClassMetadataInfo $metadata): array diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index 64ff3066445..e004c9b24e3 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -245,6 +245,7 @@ protected function yamlDump($array, $inline = 2) /** * @psalm-param array $array + * * @psalm-return array&array{entityListeners: array>} */ private function processEntityListeners(ClassMetadataInfo $metadata, array $array): array @@ -265,6 +266,7 @@ private function processEntityListeners(ClassMetadataInfo $metadata, array $arra /** * @psalm-param array{entityListeners: array>} $array * @psalm-param list $entityListenerConfig + * * @psalm-return array{entityListeners: array>} */ private function processEntityListenerConfig( diff --git a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php index b783390b0dc..fd98114f1b7 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php @@ -514,7 +514,6 @@ private function getInnerSQL(SelectStatement $AST) /** * @return array-key[] - * * @psalm-return array */ private function getSQLIdentifier(SelectStatement $AST) diff --git a/lib/Doctrine/ORM/Tools/ResolveTargetEntityListener.php b/lib/Doctrine/ORM/Tools/ResolveTargetEntityListener.php index 4a6459085de..4218020b906 100644 --- a/lib/Doctrine/ORM/Tools/ResolveTargetEntityListener.php +++ b/lib/Doctrine/ORM/Tools/ResolveTargetEntityListener.php @@ -58,10 +58,9 @@ public function getSubscribedEvents() * * @param string $originalEntity * @param string $newEntity + * @psalm-param array $mapping * * @return void - * - * @psalm-param array $mapping */ public function addResolveTargetEntity($originalEntity, $newEntity, array $mapping) { diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index 85443e4148c..003a7faf4b5 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -87,11 +87,11 @@ public function __construct(EntityManagerInterface $em) /** * Creates the database schema for the given array of ClassMetadata instances. * + * @psalm-param list $classes + * * @return void * * @throws ToolsException - * - * @psalm-param list $classes */ public function createSchema(array $classes) { @@ -111,9 +111,9 @@ public function createSchema(array $classes) * Gets the list of DDL statements that are required to create the database schema for * the given list of ClassMetadata instances. * - * @return string[] The SQL statements needed to create the schema for the classes. - * * @psalm-param list $classes + * + * @return string[] The SQL statements needed to create the schema for the classes. */ public function getCreateSchemaSql(array $classes) { @@ -140,11 +140,11 @@ private function processingNotRequired( /** * Creates a Schema instance from a given set of metadata classes. * + * @psalm-param list $classes + * * @return Schema * * @throws ORMException - * - * @psalm-param list $classes */ public function getSchemaFromMetadata(array $classes) { @@ -431,7 +431,6 @@ private function gatherColumns($class, Table $table) * Creates a column definition as required by the DBAL from an ORM field mapping definition. * * @param ClassMetadata $class The class that owns the field mapping. - * * @psalm-param array $mapping The field mapping. */ private function gatherColumn( @@ -500,13 +499,13 @@ private function gatherColumn( * Gathers the SQL for properly setting up the relations of the given class. * This includes the SQL for foreign key constraints and join tables. * - * @throws ORMException - * * @psalm-param array * }> $addedFks * @psalm-param array $blacklistedFks + * + * @throws ORMException */ private function gatherRelationsSql( ClassMetadata $class, @@ -614,8 +613,6 @@ private function getDefiningClass(ClassMetadata $class, string $referencedColumn /** * Gathers columns and fk constraints that are required for one part of relationship. * - * @throws ORMException - * * @psalm-param array $joinColumns * @psalm-param array $mapping * @psalm-param list $primaryKeyColumns @@ -624,6 +621,8 @@ private function getDefiningClass(ClassMetadata $class, string $referencedColumn * foreignColumns: list * }> $addedFks * @psalm-param array $blacklistedFks + * + * @throws ORMException */ private function gatherRelationJoinColumns( array $joinColumns, @@ -763,9 +762,9 @@ private function gatherColumnOptions(array $mapping): array * In any way when an exception is thrown it is suppressed since drop was * issued for all classes of the schema and some probably just don't exist. * - * @return void - * * @psalm-param list $classes + * + * @return void */ public function dropSchema(array $classes) { @@ -815,9 +814,9 @@ public function getDropDatabaseSQL() /** * Gets SQL to drop the tables defined by the passed classes. * - * @return string[] - * * @psalm-param list $classes + * + * @return string[] */ public function getDropSchemaSQL(array $classes) { diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index f9aa4e696fa..5c9fab64b3a 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -80,7 +80,6 @@ public function validateMapping() * Validates a single class of the current. * * @return string[] - * * @psalm-return list */ public function validateClass(ClassMetadataInfo $class) diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 4e9a206b25a..4ece50f3bd6 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -883,11 +883,10 @@ public function computeChangeSets() * Computes the changes of an association. * * @param mixed $value The value of the association. + * @psalm-param array $assoc The association mapping. * * @throws ORMInvalidArgumentException * @throws ORMException - * - * @psalm-param array $assoc The association mapping. */ private function computeAssociationChanges(array $assoc, $value): void { @@ -1412,10 +1411,10 @@ public function scheduleForUpdate($entity) * Extra updates for entities are stored as (entity, changeset) tuples. * * @param object $entity The entity for which to schedule an extra update. + * @psalm-param array $changeset The changeset of the entity (what to update). * * @return void * - * @psalm-param array $changeset The changeset of the entity (what to update). * @ignore */ public function scheduleExtraUpdate($entity, array $changeset) @@ -1772,11 +1771,10 @@ public function persist($entity) * the already visited entities to prevent infinite recursions. * * @param object $entity The entity to persist. + * @psalm-param array $visited The already visited entities. * * @throws ORMInvalidArgumentException * @throws UnexpectedValueException - * - * @psalm-param array $visited The already visited entities. */ private function doPersist(object $entity, array &$visited): void { @@ -1858,11 +1856,10 @@ public function remove($entity) * the already visited entities to prevent infinite recursions. * * @param object $entity The entity to delete. + * @psalm-param array $visited The map of the already visited entities. * * @throws ORMInvalidArgumentException If the instance is a detached entity. * @throws UnexpectedValueException - * - * @psalm-param array $visited The map of the already visited entities. */ private function doRemove($entity, array &$visited): void { @@ -1932,6 +1929,7 @@ public function merge($entity) * Executes a merge operation on an entity. * * @param string[] $assoc + * @psalm-param array $visited * * @return object The managed copy of the entity. * @@ -1939,8 +1937,6 @@ public function merge($entity) * attribute and the version check against the managed copy fails. * @throws ORMInvalidArgumentException If the entity instance is NEW. * @throws EntityNotFoundException if an assigned identifier is used in the entity, but none is provided. - * - * @psalm-param array $visited */ private function doMerge( object $entity, @@ -2186,10 +2182,9 @@ public function refresh($entity) * Executes a refresh operation on an entity. * * @param object $entity The entity to refresh. + * @psalm-param array $visited The already visited entities during cascades. * * @throws ORMInvalidArgumentException If the entity is not MANAGED. - * - * @psalm-param array $visited The already visited entities during cascades. */ private function doRefresh(object $entity, array &$visited): void { @@ -2637,10 +2632,10 @@ private function newInstance($class) * * @param string $className The name of the entity class. * @param mixed[] $data The data for the entity. + * @psalm-param array $hints Any hints to account for during reconstitution/lookup of the entity. * * @return object The managed entity instance. * - * @psalm-param array $hints Any hints to account for during reconstitution/lookup of the entity. * @ignore * @todo Rename: getOrCreateEntity */ @@ -3170,9 +3165,9 @@ public function getEntityPersister($entityName) /** * Gets a collection persister for a collection-valued association. * - * @return CollectionPersister - * * @psalm-param array $association + * + * @return CollectionPersister */ public function getCollectionPersister(array $association) { diff --git a/lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php b/lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php index 42156edcfbd..58e007cc2c5 100644 --- a/lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php +++ b/lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php @@ -19,7 +19,6 @@ private function __construct() * it extracts all the discriminators from the child classes and returns them * * @return null[] - * * @psalm-return array */ public static function resolveDiscriminatorsForClass( diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 7bfbccc611c..102e65fefe8 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -140,18 +140,10 @@ */tests/* - - */tests/* - - */tests/* - - */tests/* - - */tests/* @@ -195,13 +187,6 @@ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php - - - lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php - lib/Doctrine/ORM/Tools/EntityGenerator.php - - tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1884Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1884Test.php index de35e77dc3c..0b8d1b63b1c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1884Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1884Test.php @@ -55,8 +55,9 @@ protected function setUp(): void } /** - * @psalm-var class-string $class * @psalm-return array{Car, Car, Car, Car} + * + * @psalm-var class-string $class */ private function createCars(string $class): array { @@ -85,8 +86,9 @@ private function createCars(string $class): array } /** - * @psalm-var class-string $class * @psalm-return array{Driver, Driver} + * + * @psalm-var class-string $class */ private function createDrivers(string $class): array { diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index d24d7629384..86b6d9e2d7d 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -509,6 +509,7 @@ class ClassMetadataFactoryTestSubject extends ClassMetadataFactory /** * @psalm-param class-string $className + * * @override */ protected function newClassMetadataInstance($className): ClassMetadata