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
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
@@ -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.
*/
14 changes: 7 additions & 7 deletions lib/Doctrine/ORM/Configuration.php
Original file line number Diff line number Diff line change
@@ -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
*
* @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
*/
14 changes: 8 additions & 6 deletions lib/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
@@ -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.
*
@@ -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
*
6 changes: 4 additions & 2 deletions lib/Doctrine/ORM/EntityRepository.php
Original file line number Diff line number Diff line change
@@ -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)
{
@@ -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.
5 changes: 4 additions & 1 deletion lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
Original file line number Diff line number Diff line change
@@ -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)
{
@@ -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)
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Internal/Hydration/HydrationException.php
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
@@ -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
*/
@@ -1388,6 +1389,7 @@ public function getNamedQueries()
*
* @param string $queryName The query name.
*
* @return mixed[]
* @psalm-return array<string, mixed>
*
* @throws MappingException
@@ -2951,6 +2953,7 @@ public function hasLifecycleCallbacks($lifecycleEvent)
*
* @param string $event
*
* @return string[]
* @psalm-return list<string>
*/
public function getLifecycleCallbacks($event)
@@ -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
*
@@ -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<string>
*/
public function getQuotedIdentifierColumnNames($platform)
@@ -3532,6 +3538,7 @@ public function getAssociationMappedByTargetField($fieldName)
/**
* @param string $targetClass
*
* @return mixed[][]
* @psalm-return array<string, array<string, mixed>>
*/
public function getAssociationsByTargetClass($targetClass)
31 changes: 17 additions & 14 deletions lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
Original file line number Diff line number Diff line change
@@ -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
*
@@ -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
{
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Mapping/MappingException.php
Original file line number Diff line number Diff line change
@@ -922,6 +922,9 @@ public static function infiniteEmbeddableNesting($className, $propertyName)
}

/**
* @param string $className
* @param string $propertyName
*
* @return self
*/
public static function illegalOverrideOfInheritedProperty($className, $propertyName)
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/PersistentCollection.php
Original file line number Diff line number Diff line change
@@ -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
@@ -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
*/
Original file line number Diff line number Diff line change
@@ -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
@@ -350,6 +351,7 @@ protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targ
/**
* Generate ON condition
*
* @param mixed[] $mapping
* @psalm-param array<string, mixed> $mapping
*
* @return string[]
@@ -464,6 +466,7 @@ protected function getDeleteRowSQL(PersistentCollection $collection)
*
* @param mixed $element
*
* @return mixed[]
* @psalm-return list<mixed>
*/
protected function getDeleteRowSQLParameters(PersistentCollection $collection, $element)
@@ -513,6 +516,7 @@ protected function getInsertRowSQL(PersistentCollection $collection)
*
* @param mixed $element
*
* @return mixed[]
* @psalm-return list<mixed>
*/
protected function getInsertRowSQLParameters(PersistentCollection $collection, $element)
4 changes: 3 additions & 1 deletion lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
@@ -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
*
@@ -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.
*/
35 changes: 19 additions & 16 deletions lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php
Original file line number Diff line number Diff line change
@@ -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
@@ -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.
*
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Query/Expr/Base.php
Original file line number Diff line number Diff line change
@@ -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
*/
5 changes: 3 additions & 2 deletions lib/Doctrine/ORM/Query/Expr/Func.php
Original file line number Diff line number Diff line change
@@ -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)
{
11 changes: 7 additions & 4 deletions lib/Doctrine/ORM/Query/Parser.php
Original file line number Diff line number Diff line change
@@ -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<string, mixed>|null $token Got token.
* @param string $expected Expected string.
* @param mixed[]|null $token Got token.
* @psalm-param array<string, mixed>|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<string, mixed>|null $token Optional token.
* @param string $message Optional message.
* @param mixed[]|null $token Optional token.
* @psalm-param array<string, mixed>|null $token
*
* @return void
*
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Query/ParserResult.php
Original file line number Diff line number Diff line change
@@ -131,7 +131,8 @@ public function getParameterMappings()
*
* @param string|int $dqlPosition The name or position of the DQL parameter.
*
* @psalm-return list<int> The positions of the corresponding SQL parameters.
* @return int[] The positions of the corresponding SQL parameters.
* @psalm-return list<int>
*/
public function getSqlParameterPositions($dqlPosition)
{
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Query/QueryException.php
Original file line number Diff line number Diff line change
@@ -165,6 +165,7 @@ public static function invalidLiteral($literal)
}

/**
* @param string[] $assoc
* @psalm-param array<string, string> $assoc
*
* @return QueryException
@@ -190,6 +191,7 @@ public static function partialObjectsAreDangerous()
}

/**
* @param string[] $assoc
* @psalm-param array<string, string> $assoc
*
* @return QueryException
@@ -215,6 +217,7 @@ public static function associationPathInverseSideNotSupported(PathExpression $pa
}

/**
* @param string[] $assoc
* @psalm-param array<string, string> $assoc
*
* @return QueryException
30 changes: 17 additions & 13 deletions lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php
Original file line number Diff line number Diff line change
@@ -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<string, string> $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<string, string> $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<string, string> $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<string, string> $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<string, string> $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<string, string> $tableAliases
*
* @return string
15 changes: 8 additions & 7 deletions lib/Doctrine/ORM/Query/SqlWalker.php
Original file line number Diff line number Diff line change
@@ -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)
{
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php
Original file line number Diff line number Diff line change
@@ -106,6 +106,7 @@ public function offsetExists($offset)
}

/**
* @param mixed $offset
* @psalm-param array-key|null $offset
*
* @return TreeWalker|null
8 changes: 5 additions & 3 deletions lib/Doctrine/ORM/QueryBuilder.php
Original file line number Diff line number Diff line change
@@ -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<string>|array{join: array<int|string, object>} $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<string>|array{join: array<int|string, object>} $dqlPart
*
* @return static
*/
@@ -1458,6 +1459,7 @@ private function getReducedDQLQueryPart(string $queryPartName, array $options =
/**
* Resets DQL parts.
*
* @param string[]|null $parts
* @psalm-param list<string>|null $parts
*
* @return static
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php
Original file line number Diff line number Diff line change
@@ -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>|string $from
*/
public function __construct($from)
5 changes: 4 additions & 1 deletion lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
@@ -589,6 +589,7 @@ private function executeExtraUpdates(): void
*
* @param object $entity
*
* @return mixed[][]
* @psalm-return array<string, array{mixed, mixed}>
*/
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<string, mixed> $hints Any hints to account for during reconstitution/lookup of the entity.
* @psalm-param array<string, mixed> $hints
*
* @return object The managed entity instance.
*
@@ -3006,6 +3008,7 @@ public function getIdentityMap()
*
* @param object $entity
*
* @return mixed[]
* @psalm-return array<string, mixed>
*/
public function getOriginalEntityData($entity)
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/Utility/IdentifierFlattener.php
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ public function __construct(UnitOfWork $unitOfWork, ClassMetadataFactory $metada
*
* @param mixed[] $id
*
* @return mixed[]
* @psalm-return array<string, mixed>
*/
public function flattenIdentifier(ClassMetadata $class, array $id): array
20 changes: 0 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -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\\<object\\>\\:\\: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\\<T of object\\>\\:\\:\\$name\\.$#"
count: 1
52 changes: 10 additions & 42 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -472,8 +472,7 @@
<code>setCacheDriver</code>
<code>setCacheDriver</code>
</DeprecatedMethod>
<DocblockTypeContradiction occurrences="10">
<code>$connection instanceof Connection</code>
<DocblockTypeContradiction occurrences="9">
<code>$entityName !== null &amp;&amp; ! is_string($entityName)</code>
<code>$this-&gt;expressionBuilder === null</code>
<code>$this-&gt;filterCollection === null</code>
@@ -534,7 +533,8 @@
<code>$this-&gt;filterCollection !== null</code>
<code>method_exists($this-&gt;metadataFactory, 'setCache')</code>
</RedundantConditionGivenDocblockType>
<TypeDoesNotContainType occurrences="1">
<TypeDoesNotContainType occurrences="2">
<code>$connection instanceof Connection</code>
<code>': "' . $connection . '"'</code>
</TypeDoesNotContainType>
</file>
@@ -927,8 +927,8 @@
<code>fixSchemaElementName</code>
<code>prefersSequences</code>
</DeprecatedMethod>
<DocblockTypeContradiction occurrences="4">
<code>! $metadata-&gt;reflClass</code>
<DocblockTypeContradiction occurrences="3">
<code>! $class-&gt;reflClass</code>
<code>$class-&gt;reflClass</code>
<code>$definition</code>
</DocblockTypeContradiction>
@@ -1138,9 +1138,8 @@
<code>$this-&gt;table</code>
<code>$this-&gt;table</code>
</PropertyTypeCoercion>
<RedundantConditionGivenDocblockType occurrences="4">
<RedundantConditionGivenDocblockType occurrences="3">
<code>$className !== null</code>
<code>$columnDef !== null</code>
<code>$mapping !== false</code>
<code>$mapping !== false</code>
</RedundantConditionGivenDocblockType>
@@ -1312,22 +1311,6 @@
<code>isset($column-&gt;name)</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php">
<ArgumentTypeCoercion occurrences="1">
<code>$attributeClassName</code>
</ArgumentTypeCoercion>
<MissingParamType occurrences="3">
<code>$annotationName</code>
<code>$annotationName</code>
<code>$annotationName</code>
</MissingParamType>
<UndefinedMethod occurrences="4">
<code>getAttributes</code>
<code>getAttributes</code>
<code>getAttributes</code>
<code>getAttributes</code>
</UndefinedMethod>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php">
<ArgumentTypeCoercion occurrences="3">
<code>$metadata</code>
@@ -1674,13 +1657,11 @@
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="lib/Doctrine/ORM/Mapping/MappingException.php">
<MissingParamType occurrences="6">
<code>$className</code>
<MissingParamType occurrences="4">
<code>$className</code>
<code>$className</code>
<code>$indexName</code>
<code>$indexName</code>
<code>$propertyName</code>
</MissingParamType>
</file>
<file src="lib/Doctrine/ORM/Mapping/NamedNativeQuery.php">
@@ -1901,15 +1882,13 @@
<code>$owner</code>
<code>$owner</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="35">
<code>$mapping[$sourceRelationMode]</code>
<PossiblyNullArrayAccess occurrences="32">
<code>$mapping['indexBy']</code>
<code>$mapping['isOwningSide']</code>
<code>$mapping['isOwningSide']</code>
<code>$mapping['isOwningSide']</code>
<code>$mapping['isOwningSide']</code>
<code>$mapping['isOwningSide']</code>
<code>$mapping['isOwningSide']</code>
<code>$mapping['joinTable']</code>
<code>$mapping['joinTable']</code>
<code>$mapping['joinTable']</code>
@@ -1918,7 +1897,6 @@
<code>$mapping['mappedBy']</code>
<code>$mapping['mappedBy']</code>
<code>$mapping['mappedBy']</code>
<code>$mapping['mappedBy']</code>
<code>$mapping['relationToSourceKeyColumns']</code>
<code>$mapping['relationToSourceKeyColumns']</code>
<code>$mapping['sourceEntity']</code>
@@ -1938,15 +1916,13 @@
<code>$mapping['targetEntity']</code>
<code>$mapping['targetEntity']</code>
</PossiblyNullArrayAccess>
<PossiblyNullArrayOffset occurrences="4">
<PossiblyNullArrayOffset occurrences="3">
<code>$associationSourceClass-&gt;associationMappings</code>
<code>$sourceClass-&gt;associationMappings</code>
<code>$targetClass-&gt;associationMappings</code>
<code>$targetClass-&gt;associationMappings</code>
</PossiblyNullArrayOffset>
<PossiblyNullIterator occurrences="7">
<PossiblyNullIterator occurrences="6">
<code>$joinColumns</code>
<code>$mapping[$sourceRelationMode]</code>
<code>$mapping['joinTable']['joinColumns']</code>
<code>$mapping['joinTable']['joinColumns']</code>
<code>$mapping['joinTable']['joinColumns']</code>
@@ -2626,9 +2602,6 @@
<PossiblyInvalidCast occurrences="1">
<code>$this-&gt;parts[0]</code>
</PossiblyInvalidCast>
<RedundantCastGivenDocblockType occurrences="1">
<code>(array) $args</code>
</RedundantCastGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Query/Expr/Composite.php">
<PossiblyInvalidCast occurrences="2">
@@ -2641,11 +2614,6 @@
<code>$indexBy</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="lib/Doctrine/ORM/Query/Expr/Func.php">
<RedundantCastGivenDocblockType occurrences="1">
<code>(array) $arguments</code>
</RedundantCastGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Query/Expr/GroupBy.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$parts</code>
3 changes: 0 additions & 3 deletions tests/Doctrine/Tests/Mocks/ConnectionMock.php
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
Original file line number Diff line number Diff line change
@@ -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
{
8 changes: 0 additions & 8 deletions tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php
Original file line number Diff line number Diff line change
@@ -200,9 +200,6 @@ public function __construct(string $name)
$this->name = $name;
}

/**
* @param Product $product
*/
public function setProduct(DDC1163Product $product): void
{
$this->product = $product;
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php
Original file line number Diff line number Diff line change
@@ -163,8 +163,6 @@ class DDC2138UserFollowedUser extends DDC2138UserFollowedObject

/**
* Construct a UserFollowedUser entity
*
* @param bool $giveAgency
*/
public function __construct(User $user, User $followedUser)
{
Original file line number Diff line number Diff line change
@@ -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();
6 changes: 0 additions & 6 deletions tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
Original file line number Diff line number Diff line change
@@ -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,
Original file line number Diff line number Diff line change
@@ -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 = []
6 changes: 2 additions & 4 deletions tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php
Original file line number Diff line number Diff line change
@@ -1049,7 +1049,8 @@ public function testRegenerateEntityClass(): void
}

/**
* @return list<array{
* @return mixed[]
* @psalm-return list<array{
* fieldName: string,
* phpType: string,
* dbType: string,
@@ -1215,9 +1216,6 @@ private function assertPhpDocReturnType(string $type, ReflectionMethod $method):
$this->assertEquals($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));
1 change: 0 additions & 1 deletion tests/Doctrine/Tests/OrmTestCase.php
Original file line number Diff line number Diff line change
@@ -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