Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing @param and @return PHPDoc attributes #8543

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Cache/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
14 changes: 7 additions & 7 deletions lib/Doctrine/ORM/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> $paths
simonberger marked this conversation as resolved.
Show resolved Hide resolved
*
* @return AnnotationDriver
Expand Down Expand Up @@ -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[]
simonberger marked this conversation as resolved.
Show resolved Hide resolved
* @psalm-return array{string, ResultSetMapping} A tuple with the first element being the SQL string and the second
* element being the ResultSetMapping.
*
* @throws ORMException
*/
Expand Down Expand Up @@ -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
*/
Expand Down
14 changes: 8 additions & 6 deletions lib/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,10 @@ public function initializeObject($obj)
/**
* Factory method to create EntityManager instances.
*
* @param array<string, mixed>|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<string, mixed>|Connection $connection
*
* @return EntityManager The created EntityManager.
*
Expand All @@ -908,9 +909,10 @@ public static function create($connection, Configuration $config, ?EventManager
/**
* Factory method to create Connection instances.
*
* @param array<string, mixed>|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<string, mixed>|Connection $connection
*
* @return Connection
*
Expand Down
6 changes: 4 additions & 2 deletions lib/Doctrine/ORM/EntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public function findAll()
* @psalm-param array<string, mixed> $criteria
* @psalm-param array<string, string>|null $orderBy
*
* @psalm-return list<T> The objects.
* @return object[] The objects.
* @psalm-return list<T>
*/
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
{
Expand Down Expand Up @@ -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<mixed> $arguments
*
* @return mixed The returned value from the resolved method.
Expand Down
5 changes: 4 additions & 1 deletion lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> $data
*
* @psalm-return array<string, mixed> The processed row.
* @return mixed[] The processed row.
* @psalm-return array<string, mixed>
*/
protected function gatherScalarRowData(&$data)
{
Expand Down Expand Up @@ -448,6 +450,7 @@ protected function gatherScalarRowData(&$data)
*
* @param string $key Column name
*
* @return mixed[]|null
* @psalm-return array<string, mixed>|null
*/
protected function hydrateColumnInfo($key)
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Internal/Hydration/HydrationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public static function missingDiscriminatorMetaMappingColumn($entityName, $discr
}

/**
* @param string $discrValue
* @param string $discrValue
* @param string[] $discrMap
* @psalm-param array<string, string> $discrMap
*
* @return HydrationException
Expand Down
11 changes: 9 additions & 2 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> The mapping.
* @return mixed[] The mapping.
* @psalm-return array<string, mixed>
*
* @throws MappingException
*/
Expand Down Expand Up @@ -1388,6 +1389,7 @@ public function getNamedQueries()
*
* @param string $queryName The query name.
*
* @return mixed[]
* @psalm-return array<string, mixed>
*
* @throws MappingException
Expand Down Expand Up @@ -2951,6 +2953,7 @@ public function hasLifecycleCallbacks($lifecycleEvent)
*
* @param string $event
*
* @return string[]
* @psalm-return list<string>
*/
public function getLifecycleCallbacks($event)
Expand Down Expand Up @@ -3038,7 +3041,8 @@ public function addEntityListener($eventName, $class, $method)
*
* @see getDiscriminatorColumn()
*
* @psalm-param array<string, mixed> $columnDef
* @param mixed[]|null $columnDef
* @psalm-param array<string, mixed>|null $columnDef
*
* @return void
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -3430,6 +3435,7 @@ public function getName()
*
* @param AbstractPlatform $platform
*
* @return string[]
* @psalm-return list<string>
*/
public function getQuotedIdentifierColumnNames($platform)
Expand Down Expand Up @@ -3532,6 +3538,7 @@ public function getAssociationMappedByTargetField($fieldName)
/**
* @param string $targetClass
*
* @return mixed[][]
* @psalm-return array<string, array<string, mixed>>
*/
public function getAssociationsByTargetClass($targetClass)
Expand Down
31 changes: 17 additions & 14 deletions lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<Table> $entityTables
* @psalm-param list<Table> $manyToManyTables
*
Expand Down Expand Up @@ -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
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Mapping/MappingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,9 @@ public static function infiniteEmbeddableNesting($className, $propertyName)
}

/**
* @param string $className
* @param string $propertyName
*
* @return self
*/
public static function illegalOverrideOfInheritedProperty($className, $propertyName)
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/PersistentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ public function __sleep(): array
* @param int $offset
* @param int|null $length
*
* @return mixed[]
* @psalm-return array<TKey,T>
*/
public function slice($offset, $length = null): array
Expand Down Expand Up @@ -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<TKey, T>
* @psalm-return Collection<TKey, T>
*
* @throws RuntimeException
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> $mapping Array containing mapping information.
* @param mixed[] $mapping Array containing mapping information.
* @psalm-param array<string, mixed> $mapping
*
* @return string[] ordered tuple:
* - JOIN condition to add to the SQL
Expand Down Expand Up @@ -350,6 +351,7 @@ protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targ
/**
* Generate ON condition
*
* @param mixed[] $mapping
* @psalm-param array<string, mixed> $mapping
*
* @return string[]
Expand Down Expand Up @@ -464,6 +466,7 @@ protected function getDeleteRowSQL(PersistentCollection $collection)
*
* @param mixed $element
*
* @return mixed[]
* @psalm-return list<mixed>
*/
protected function getDeleteRowSQLParameters(PersistentCollection $collection, $element)
Expand Down Expand Up @@ -513,6 +516,7 @@ protected function getInsertRowSQL(PersistentCollection $collection)
*
* @param mixed $element
*
* @return mixed[]
* @psalm-return list<mixed>
*/
protected function getInsertRowSQLParameters(PersistentCollection $collection, $element)
Expand Down
4 changes: 3 additions & 1 deletion lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> $criteria
* @psalm-param array<string, mixed>|null $assoc
*
Expand Down Expand Up @@ -2009,7 +2010,8 @@ public function exists($entity, ?Criteria $extraConditions = null)
/**
* Generates the appropriate join SQL for the given join column.
*
* @psalm-param array<array<string, mixed>> $joinColumns The join columns definition of an association.
* @param array[] $joinColumns The join columns definition of an association.
* @psalm-param array<array<string, mixed>> $joinColumns
*
* @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise.
*/
Expand Down
35 changes: 19 additions & 16 deletions lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed>|null $assoc
*
* @return string
Expand Down Expand Up @@ -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<string, mixed> $hints Hints for entity creation.
* @psalm-param array<string, mixed> $criteria The criteria by which
* to load the entity.
* @psalm-param array<string, mixed>|null $assoc The association that
* connects the entity to
* load to another entity,
* if any.
* @psalm-param array<string, string>|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<string, mixed> $criteria
* @psalm-param array<string, mixed>|null $assoc
* @psalm-param array<string, mixed> $hints
* @psalm-param array<string, string>|null $orderBy
*
* @return object|null The loaded and managed entity instance or NULL if the entity can not be found.
*
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Query/Expr/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function __construct($args = [])
}

/**
* @psalm-param list<string|object> $args
* @param string[]|object[]|string|object $args
* @psalm-param list<string|object>|string|object $args
*
* @return static
*/
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/ORM/Query/Expr/Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class Func
/**
* Creates a function, with the given argument.
*
* @param string $name
* @psalm-param list<mixed> $arguments
* @param string $name
* @param mixed[]|mixed $arguments
* @psalm-param list<mixed>|mixed $arguments
*/
public function __construct($name, $arguments)
{
Expand Down
Loading