diff --git a/lib/Doctrine/ORM/Cache/Region.php b/lib/Doctrine/ORM/Cache/Region.php index 59bb5598711..b2ee20b990b 100644 --- a/lib/Doctrine/ORM/Cache/Region.php +++ b/lib/Doctrine/ORM/Cache/Region.php @@ -57,7 +57,7 @@ public function get(CacheKey $key); * * @param CacheKey $key The key under which to cache the item. * @param CacheEntry $entry The entry to cache. - * @param Lock $lock The lock previously obtained. + * @param Lock|null $lock The lock previously obtained. * * @throws CacheException Indicates a problem accessing the region. */ diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index 1f08216b2f0..aacefb7f16f 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -155,7 +155,8 @@ public function setMetadataDriverImpl(MappingDriver $driverImpl) * Adds a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader * is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported. * - * @param bool $useSimpleAnnotationReader + * @param string|string[] $paths + * @param bool $useSimpleAnnotationReader * @psalm-param string|list $paths * * @return AnnotationDriver @@ -391,11 +392,9 @@ public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm) * * @param string $name The name of the query. * - * @psalm-return array{string, ResultSetMapping} A tuple with the first - * element being the SQL - * string and the second - * element being the - * ResultSetMapping. + * @return mixed[] + * @psalm-return array{string, ResultSetMapping} A tuple with the first element being the SQL string and the second + * element being the ResultSetMapping. * * @throws ORMException */ @@ -634,7 +633,8 @@ 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. + * @param string $hydrator The hydrator class name. + * @psalm-param class-string $hydrator * * @return void */ diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index aac42c64a0c..ca858881a0b 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -885,9 +885,10 @@ public function initializeObject($obj) /** * Factory method to create EntityManager instances. * - * @param array|Connection $connection An array with the connection parameters or an existing Connection instance. - * @param Configuration $config The Configuration instance to use. - * @param EventManager $eventManager The EventManager instance to use. + * @param mixed[]|Connection $connection An array with the connection parameters or an existing Connection instance. + * @param Configuration $config The Configuration instance to use. + * @param EventManager|null $eventManager The EventManager instance to use. + * @psalm-param array|Connection $connection * * @return EntityManager The created EntityManager. * @@ -908,9 +909,10 @@ public static function create($connection, Configuration $config, ?EventManager /** * Factory method to create Connection instances. * - * @param array|Connection $connection An array with the connection parameters or an existing Connection instance. - * @param Configuration $config The Configuration instance to use. - * @param EventManager $eventManager The EventManager instance to use. + * @param mixed[]|Connection $connection An array with the connection parameters or an existing Connection instance. + * @param Configuration $config The Configuration instance to use. + * @param EventManager|null $eventManager The EventManager instance to use. + * @psalm-param array|Connection $connection * * @return Connection * diff --git a/lib/Doctrine/ORM/EntityRepository.php b/lib/Doctrine/ORM/EntityRepository.php index 32fea47eb1f..2bb4156ef3c 100644 --- a/lib/Doctrine/ORM/EntityRepository.php +++ b/lib/Doctrine/ORM/EntityRepository.php @@ -208,7 +208,8 @@ public function findAll() * @psalm-param array $criteria * @psalm-param array|null $orderBy * - * @psalm-return list The objects. + * @return object[] The objects. + * @psalm-return list */ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { @@ -250,7 +251,8 @@ public function count(array $criteria) /** * Adds support for magic method calls. * - * @param string $method + * @param string $method + * @param mixed[] $arguments * @psalm-param list $arguments * * @return mixed The returned value from the resolved method. diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index f0ec6721e82..b11ddb00b6b 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -412,9 +412,11 @@ protected function gatherRowData(array $data, array &$id, array &$nonemptyCompon * values according to their types. The resulting row has the same number * of elements as before. * + * @param mixed[] $data * @psalm-param array $data * - * @psalm-return array The processed row. + * @return mixed[] The processed row. + * @psalm-return array */ protected function gatherScalarRowData(&$data) { @@ -448,6 +450,7 @@ protected function gatherScalarRowData(&$data) * * @param string $key Column name * + * @return mixed[]|null * @psalm-return array|null */ protected function hydrateColumnInfo($key) diff --git a/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php b/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php index 24570c64a9e..4db1db83ad0 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php +++ b/lib/Doctrine/ORM/Internal/Hydration/HydrationException.php @@ -99,7 +99,8 @@ public static function missingDiscriminatorMetaMappingColumn($entityName, $discr } /** - * @param string $discrValue + * @param string $discrValue + * @param string[] $discrMap * @psalm-param array $discrMap * * @return HydrationException diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index c64fe0a3134..a0720e84625 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1314,7 +1314,8 @@ public function getFieldMapping($fieldName) * @param string $fieldName The field name that represents the association in * the object model. * - * @psalm-return array The mapping. + * @return mixed[] The mapping. + * @psalm-return array * * @throws MappingException */ @@ -1388,6 +1389,7 @@ public function getNamedQueries() * * @param string $queryName The query name. * + * @return mixed[] * @psalm-return array * * @throws MappingException @@ -2951,6 +2953,7 @@ public function hasLifecycleCallbacks($lifecycleEvent) * * @param string $event * + * @return string[] * @psalm-return list */ public function getLifecycleCallbacks($event) @@ -3038,7 +3041,8 @@ public function addEntityListener($eventName, $class, $method) * * @see getDiscriminatorColumn() * - * @psalm-param array $columnDef + * @param mixed[]|null $columnDef + * @psalm-param array|null $columnDef * * @return void * @@ -3090,6 +3094,7 @@ public function setDiscriminatorMap(array $map) * Adds one entry of the discriminator map with a new class and corresponding name. * * @param string $name + * @param string $className * @psalm-param class-string $className * * @return void @@ -3430,6 +3435,7 @@ public function getName() * * @param AbstractPlatform $platform * + * @return string[] * @psalm-return list */ public function getQuotedIdentifierColumnNames($platform) @@ -3532,6 +3538,7 @@ public function getAssociationMappedByTargetField($fieldName) /** * @param string $targetClass * + * @return mixed[][] * @psalm-return array> */ public function getAssociationsByTargetClass($targetClass) diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index e4e0c1c35eb..a46766742a3 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -145,6 +145,8 @@ public function setFieldNameForColumn($tableName, $columnName, $fieldName) /** * Sets tables manually instead of relying on the reverse engineering capabilities of SchemaManager. * + * @param Table[] $entityTables + * @param Table[] $manyToManyTables * @psalm-param list $entityTables * @psalm-param list
$manyToManyTables * @@ -380,21 +382,22 @@ private function buildFieldMappings(ClassMetadataInfo $metadata): void /** * Build field mapping from a schema column definition * + * @return mixed[] * @psalm-return array{ - * fieldName: string, - * columnName: string, - * type: string, - * nullable: bool, - * options?: array{ - * unsigned?: bool, - * fixed?: bool, - * comment?: string, - * default?: string - * }, - * precision?: int, - * scale?: int, - * length?: int|null - * } + * fieldName: string, + * columnName: string, + * type: string, + * nullable: bool, + * options?: array{ + * unsigned?: bool, + * fixed?: bool, + * comment?: string, + * default?: string + * }, + * precision?: int, + * scale?: int, + * length?: int|null + * } */ private function buildFieldMapping(string $tableName, Column $column): array { diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index 888e49a7b5f..909e48daf35 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -922,6 +922,9 @@ public static function infiniteEmbeddableNesting($className, $propertyName) } /** + * @param string $className + * @param string $propertyName + * * @return self */ public static function illegalOverrideOfInheritedProperty($className, $propertyName) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index e060db6e268..43182054396 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -595,6 +595,7 @@ public function __sleep(): array * @param int $offset * @param int|null $length * + * @return mixed[] * @psalm-return array */ public function slice($offset, $length = null): array @@ -637,7 +638,7 @@ public function __clone() * Selects all elements from a selectable that match the expression and * return a new collection containing these elements. * - * @return Collection + * @psalm-return Collection * * @throws RuntimeException */ diff --git a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php index c8277b9e7ac..3720e47b090 100644 --- a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php @@ -298,7 +298,8 @@ 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. + * @param mixed[] $mapping Array containing mapping information. + * @psalm-param array $mapping * * @return string[] ordered tuple: * - JOIN condition to add to the SQL @@ -350,6 +351,7 @@ protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targ /** * Generate ON condition * + * @param mixed[] $mapping * @psalm-param array $mapping * * @return string[] @@ -464,6 +466,7 @@ protected function getDeleteRowSQL(PersistentCollection $collection) * * @param mixed $element * + * @return mixed[] * @psalm-return list */ protected function getDeleteRowSQLParameters(PersistentCollection $collection, $element) @@ -513,6 +516,7 @@ protected function getInsertRowSQL(PersistentCollection $collection) * * @param mixed $element * + * @return mixed[] * @psalm-return list */ protected function getInsertRowSQLParameters(PersistentCollection $collection, $element) diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php index 098d1a4cdc5..f0b2c72a8b0 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php @@ -1722,6 +1722,7 @@ private function getSelectConditionStatementColumnSQL( * Subclasses are supposed to override this method if they intend to change * or alter the criteria by which entities are selected. * + * @param mixed[]|null $assoc * @psalm-param array $criteria * @psalm-param array|null $assoc * @@ -2009,7 +2010,8 @@ public function exists($entity, ?Criteria $extraConditions = null) /** * Generates the appropriate join SQL for the given join column. * - * @psalm-param array> $joinColumns The join columns definition of an association. + * @param array[] $joinColumns The join columns definition of an association. + * @psalm-param array> $joinColumns * * @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise. */ diff --git a/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php index 271019fea34..9409cdf6006 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php @@ -103,9 +103,10 @@ public function expandCriteriaParameters(Criteria $criteria); /** * Gets the SQL WHERE condition for matching a field with a given value. * - * @param string $field - * @param mixed $value - * @param string|null $comparison + * @param string $field + * @param mixed $value + * @param mixed[]|null $assoc + * @param string|null $comparison * @psalm-param array|null $assoc * * @return string @@ -186,19 +187,21 @@ public function getOwningTable($fieldName); /** * Loads an entity by a list of field criteria. * - * @param object|null $entity The entity to load the data into. If not specified, a new entity is created. - * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants - * or NULL if no specific lock mode should be used - * for loading the entity. - * @param int|null $limit Limit number of results. - * @psalm-param array $hints Hints for entity creation. - * @psalm-param array $criteria The criteria by which - * to load the entity. - * @psalm-param array|null $assoc The association that - * connects the entity to - * load to another entity, - * if any. - * @psalm-param array|null $orderBy Criteria to order by. + * @param mixed[] $criteria The criteria by which to load the entity. + * @param object|null $entity The entity to load the data into. If not specified, + * a new entity is created. + * @param mixed[]|null $assoc The association that connects the entity + * to load to another entity, if any. + * @param mixed[] $hints Hints for entity creation. + * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants + * or NULL if no specific lock mode should be used + * for loading the entity. + * @param int|null $limit Limit number of results. + * @param string[]|null $orderBy Criteria to order by. + * @psalm-param array $criteria + * @psalm-param array|null $assoc + * @psalm-param array $hints + * @psalm-param array|null $orderBy * * @return object|null The loaded and managed entity instance or NULL if the entity can not be found. * diff --git a/lib/Doctrine/ORM/Query/Expr/Base.php b/lib/Doctrine/ORM/Query/Expr/Base.php index d1593788368..1cabeb134b9 100644 --- a/lib/Doctrine/ORM/Query/Expr/Base.php +++ b/lib/Doctrine/ORM/Query/Expr/Base.php @@ -60,7 +60,8 @@ public function __construct($args = []) } /** - * @psalm-param list $args + * @param string[]|object[]|string|object $args + * @psalm-param list|string|object $args * * @return static */ diff --git a/lib/Doctrine/ORM/Query/Expr/Func.php b/lib/Doctrine/ORM/Query/Expr/Func.php index e87fc1e1358..d2c9075960a 100644 --- a/lib/Doctrine/ORM/Query/Expr/Func.php +++ b/lib/Doctrine/ORM/Query/Expr/Func.php @@ -38,8 +38,9 @@ class Func /** * Creates a function, with the given argument. * - * @param string $name - * @psalm-param list $arguments + * @param string $name + * @param mixed[]|mixed $arguments + * @psalm-param list|mixed $arguments */ public function __construct($name, $arguments) { diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index a35325f514f..6d8817cd192 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -262,6 +262,7 @@ public function setCustomOutputTreeWalker($className) /** * Adds a custom tree walker for modifying the AST. * + * @param string $className * @psalm-param class-string $className * * @return void @@ -489,8 +490,9 @@ private function fixIdentificationVariableOrder(Node $AST): void /** * Generates a new syntax error. * - * @param string $expected Expected string. - * @psalm-param array|null $token Got token. + * @param string $expected Expected string. + * @param mixed[]|null $token Got token. + * @psalm-param array|null $token * * @return void * @psalm-return no-return @@ -515,8 +517,9 @@ public function syntaxError($expected = '', $token = null) /** * Generates a new semantical error. * - * @param string $message Optional message. - * @psalm-param array|null $token Optional token. + * @param string $message Optional message. + * @param mixed[]|null $token Optional token. + * @psalm-param array|null $token * * @return void * diff --git a/lib/Doctrine/ORM/Query/ParserResult.php b/lib/Doctrine/ORM/Query/ParserResult.php index 9b79db38b9e..7280e659985 100644 --- a/lib/Doctrine/ORM/Query/ParserResult.php +++ b/lib/Doctrine/ORM/Query/ParserResult.php @@ -131,7 +131,8 @@ public function getParameterMappings() * * @param string|int $dqlPosition The name or position of the DQL parameter. * - * @psalm-return list The positions of the corresponding SQL parameters. + * @return int[] The positions of the corresponding SQL parameters. + * @psalm-return list */ public function getSqlParameterPositions($dqlPosition) { diff --git a/lib/Doctrine/ORM/Query/QueryException.php b/lib/Doctrine/ORM/Query/QueryException.php index edfbc123c1f..4f2d8f32c43 100644 --- a/lib/Doctrine/ORM/Query/QueryException.php +++ b/lib/Doctrine/ORM/Query/QueryException.php @@ -165,6 +165,7 @@ public static function invalidLiteral($literal) } /** + * @param string[] $assoc * @psalm-param array $assoc * * @return QueryException @@ -190,6 +191,7 @@ public static function partialObjectsAreDangerous() } /** + * @param string[] $assoc * @psalm-param array $assoc * * @return QueryException @@ -215,6 +217,7 @@ public static function associationPathInverseSideNotSupported(PathExpression $pa } /** + * @param string[] $assoc * @psalm-param array $assoc * * @return QueryException diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index 23c7714c445..25d6c93040f 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -84,10 +84,11 @@ 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 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). + * @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 array $renamedColumns * * @return void */ @@ -103,13 +104,14 @@ 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 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). + * @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 array $renamedColumns * * @return void */ @@ -125,8 +127,9 @@ public function addJoinedEntityFromClassMetadata($class, $alias, $parentAlias, $ /** * Adds all fields of the given class to the result set mapping (columns and meta fields). * - * @param string $class - * @param string $alias + * @param string $class + * @param string $alias + * @param string[] $columnAliasMap * @psalm-param array $columnAliasMap * * @return void @@ -430,6 +433,7 @@ public function addNamedNativeQueryEntityResultMapping(ClassMetadataInfo $classM * Works only for all the entity results. The select parts for scalar * expressions have to be written manually. * + * @param string[] $tableAliases * @psalm-param array $tableAliases * * @return string diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 0b37e0a9a15..13741cd91ef 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -240,14 +240,15 @@ public function getEntityManager() * * @param string $dqlAlias The DQL alias. * + * @return mixed[] * @psalm-return array{ - * metadata: ClassMetadata, - * parent: string, - * relation: mixed[], - * map: mixed, - * nestingLevel: int, - * token: array - * } + * metadata: ClassMetadata, + * parent: string, + * relation: mixed[], + * map: mixed, + * nestingLevel: int, + * token: array + * } */ public function getQueryComponent($dqlAlias) { diff --git a/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php b/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php index ba070b194bb..ea8d729bd55 100644 --- a/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php +++ b/lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php @@ -106,6 +106,7 @@ public function offsetExists($offset) } /** + * @param mixed $offset * @psalm-param array-key|null $offset * * @return TreeWalker|null diff --git a/lib/Doctrine/ORM/QueryBuilder.php b/lib/Doctrine/ORM/QueryBuilder.php index 6541f8c2420..cd00f9ca237 100644 --- a/lib/Doctrine/ORM/QueryBuilder.php +++ b/lib/Doctrine/ORM/QueryBuilder.php @@ -692,9 +692,10 @@ public function getMaxResults() * The available parts are: 'select', 'from', 'join', 'set', 'where', * 'groupBy', 'having' and 'orderBy'. * - * @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. + * @param string $dqlPartName The DQL part name. + * @param string|object|array $dqlPart An Expr object. + * @param bool $append Whether to append (true) or replace (false). + * @psalm-param string|object|list|array{join: array} $dqlPart * * @return static */ @@ -1458,6 +1459,7 @@ private function getReducedDQLQueryPart(string $queryPartName, array $options = /** * Resets DQL parts. * + * @param string[]|null $parts * @psalm-param list|null $parts * * @return static diff --git a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php index a3ac604239f..9a246f9288b 100644 --- a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php +++ b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php @@ -60,6 +60,7 @@ class ConvertDoctrine1Schema * Constructor passes the directory or array of directories * to convert the Doctrine 1 schema files from. * + * @param string[]|string $from * @psalm-param list|string $from */ public function __construct($from) diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 00f1d2b931b..7aa057d2901 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -589,6 +589,7 @@ private function executeExtraUpdates(): void * * @param object $entity * + * @return mixed[][] * @psalm-return array */ public function & getEntityChangeSet($entity) @@ -2642,8 +2643,9 @@ private function newInstance(ClassMetadata $class) * * @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 Any hints to account for during reconstitution/lookup of the entity. + * @psalm-param array $hints * * @return object The managed entity instance. * @@ -3006,6 +3008,7 @@ public function getIdentityMap() * * @param object $entity * + * @return mixed[] * @psalm-return array */ public function getOriginalEntityData($entity) diff --git a/lib/Doctrine/ORM/Utility/IdentifierFlattener.php b/lib/Doctrine/ORM/Utility/IdentifierFlattener.php index 216fd66cb05..3061782a995 100644 --- a/lib/Doctrine/ORM/Utility/IdentifierFlattener.php +++ b/lib/Doctrine/ORM/Utility/IdentifierFlattener.php @@ -62,6 +62,7 @@ public function __construct(UnitOfWork $unitOfWork, ClassMetadataFactory $metada * * @param mixed[] $id * + * @return mixed[] * @psalm-return array */ public function flattenIdentifier(ClassMetadata $class, array $id): array diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6e6a4db46c3..08dbedca281 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -800,26 +800,6 @@ parameters: count: 1 path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php - - - message: "#^Call to an undefined method ReflectionClass\\:\\:getAttributes\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php - - - - message: "#^Call to an undefined method ReflectionClass\\\\:\\:getAttributes\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php - - - - message: "#^Call to an undefined method ReflectionMethod\\:\\:getAttributes\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php - - - - message: "#^Call to an undefined method ReflectionProperty\\:\\:getAttributes\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php - - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$name\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 9dcae07bee9..55b3f5fae0d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -472,8 +472,7 @@ setCacheDriver setCacheDriver - - $connection instanceof Connection + $entityName !== null && ! is_string($entityName) $this->expressionBuilder === null $this->filterCollection === null @@ -534,7 +533,8 @@ $this->filterCollection !== null method_exists($this->metadataFactory, 'setCache') - + + $connection instanceof Connection ': "' . $connection . '"' @@ -927,8 +927,8 @@ fixSchemaElementName prefersSequences - - ! $metadata->reflClass + + ! $class->reflClass $class->reflClass $definition @@ -1138,9 +1138,8 @@ $this->table $this->table - + $className !== null - $columnDef !== null $mapping !== false $mapping !== false @@ -1312,22 +1311,6 @@ isset($column->name) - - - $attributeClassName - - - $annotationName - $annotationName - $annotationName - - - getAttributes - getAttributes - getAttributes - getAttributes - - $metadata @@ -1674,13 +1657,11 @@ - - $className + $className $className $indexName $indexName - $propertyName @@ -1901,15 +1882,13 @@ $owner $owner - - $mapping[$sourceRelationMode] + $mapping['indexBy'] $mapping['isOwningSide'] $mapping['isOwningSide'] $mapping['isOwningSide'] $mapping['isOwningSide'] $mapping['isOwningSide'] - $mapping['isOwningSide'] $mapping['joinTable'] $mapping['joinTable'] $mapping['joinTable'] @@ -1918,7 +1897,6 @@ $mapping['mappedBy'] $mapping['mappedBy'] $mapping['mappedBy'] - $mapping['mappedBy'] $mapping['relationToSourceKeyColumns'] $mapping['relationToSourceKeyColumns'] $mapping['sourceEntity'] @@ -1938,15 +1916,13 @@ $mapping['targetEntity'] $mapping['targetEntity'] - + $associationSourceClass->associationMappings $sourceClass->associationMappings $targetClass->associationMappings - $targetClass->associationMappings - + $joinColumns - $mapping[$sourceRelationMode] $mapping['joinTable']['joinColumns'] $mapping['joinTable']['joinColumns'] $mapping['joinTable']['joinColumns'] @@ -2626,9 +2602,6 @@ $this->parts[0] - - (array) $args - @@ -2641,11 +2614,6 @@ $indexBy - - - (array) $arguments - - $parts diff --git a/tests/Doctrine/Tests/Mocks/ConnectionMock.php b/tests/Doctrine/Tests/Mocks/ConnectionMock.php index c78ede33375..5aec4511787 100644 --- a/tests/Doctrine/Tests/Mocks/ConnectionMock.php +++ b/tests/Doctrine/Tests/Mocks/ConnectionMock.php @@ -43,9 +43,6 @@ class ConnectionMock extends Connection /** @var array */ private $_deletes = []; - /** - * @param array $params - */ public function __construct(array $params, Driver $driver, ?Configuration $config = null, ?EventManager $eventManager = null) { $this->_platformMock = new DatabasePlatformMock(); diff --git a/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php b/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php index 9e24e63689c..1250eddd642 100644 --- a/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php +++ b/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php @@ -35,9 +35,9 @@ public function __construct(array $resultSet) /** * Fetches all rows from the result set. * + * @param mixed $fetchMode + * @param mixed $fetchArgument * @param array|null $ctorArgs - * - * @return array */ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null): array { diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php index 78c27868c0e..5a8b509e744 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php @@ -40,10 +40,6 @@ protected function setUp(): void $this->cache = new DefaultCache($this->em); } - /** - * @param array $identifier - * @param array $data - */ private function putEntityCacheEntry(string $className, array $identifier, array $data): void { $metadata = $this->em->getClassMetadata($className); @@ -54,10 +50,6 @@ private function putEntityCacheEntry(string $className, array $identifier, array $persister->getCacheRegion()->put($cacheKey, $cacheEntry); } - /** - * @param array $ownerIdentifier - * @param array $data - */ private function putCollectionCacheEntry(string $className, string $association, array $ownerIdentifier, array $data): void { $metadata = $this->em->getClassMetadata($className); diff --git a/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php b/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php index f28e570aebc..92120834df3 100644 --- a/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php @@ -55,9 +55,6 @@ abstract class AbstractCollectionPersisterTest extends OrmTestCase 'loadCriteria', ]; - /** - * @param array $mapping - */ abstract protected function createPersister(EntityManager $em, CollectionPersister $persister, Region $region, array $mapping): AbstractCollectionPersister; protected function setUp(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php index 2d46702f102..4ead47bdb76 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php @@ -200,9 +200,6 @@ public function __construct(string $name) $this->name = $name; } - /** - * @param Product $product - */ public function setProduct(DDC1163Product $product): void { $this->product = $product; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php index d12448bba53..2b7d060ad24 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php @@ -163,8 +163,6 @@ class DDC2138UserFollowedUser extends DDC2138UserFollowedObject /** * Construct a UserFollowedUser entity - * - * @param bool $giveAgency */ public function __construct(User $user, User $followedUser) { diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index ac1fca5e6f4..25ec6c8e0a2 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -74,9 +74,6 @@ public function createClassMetadata(string $entityClassName): ClassMetadata return $class; } - /** - * @param EntityManager $entityClassName - */ protected function createClassMetadataFactory(?EntityManager $em = null): ClassMetadataFactory { $driver = $this->loadDriver(); diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index 86636de3a07..523fc7b2a67 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -42,9 +42,6 @@ protected function setUp(): void /** * Assert a valid SQL generation. - * - * @param array $queryHints - * @param array $queryParams */ public function assertSqlGeneration( string $dqlToBeTested, @@ -82,9 +79,6 @@ public function assertSqlGeneration( /** * Asser an invalid SQL generation. - * - * @param array $queryHints - * @param array $queryParams */ public function assertInvalidSqlGeneration( string $dqlToBeTested, diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php index c76372450f1..d61386c2b92 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php @@ -98,9 +98,6 @@ public function testExecuteWithCompleteFailed(): void $this->assertSame(1, $this->executeCommand($em, ['--complete' => true])); } - /** - * @param mixed[] $options - */ private function executeCommand( EntityManagerInterface $em, array $input = [] diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index ccd0ff34168..b4619b58676 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -1049,7 +1049,8 @@ public function testRegenerateEntityClass(): void } /** - * @return listassertEquals($type, $matches[1]); } - /** - * @param ReflectionProperty $method - */ private function assertPhpDocParamType(string $type, ReflectionMethod $method): void { $this->assertEquals(1, preg_match('/@param\s+([^\s]+)/', $method->getDocComment(), $matches)); diff --git a/tests/Doctrine/Tests/OrmTestCase.php b/tests/Doctrine/Tests/OrmTestCase.php index 56ff0ee9f78..b269758645e 100644 --- a/tests/Doctrine/Tests/OrmTestCase.php +++ b/tests/Doctrine/Tests/OrmTestCase.php @@ -59,7 +59,6 @@ abstract class OrmTestCase extends DoctrineTestCase protected $secondLevelCacheDriverImpl = null; /** - * @param array $paths * @param mixed $alias */ protected function createAnnotationDriver(array $paths = [], $alias = null): AnnotationDriver