From 4446eae87df865491a2a69ec308ff874f61a0c7a Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 1 Jan 2022 20:36:22 +0100 Subject: [PATCH] Run static analysis with language level PHP 8.1 --- lib/Doctrine/ORM/LazyCriteriaCollection.php | 2 ++ lib/Doctrine/ORM/PersistentCollection.php | 3 +- phpstan-baseline.neon | 33 +++++++-------------- phpstan-params.neon | 2 +- psalm.xml | 14 +-------- 5 files changed, 17 insertions(+), 37 deletions(-) diff --git a/lib/Doctrine/ORM/LazyCriteriaCollection.php b/lib/Doctrine/ORM/LazyCriteriaCollection.php index 7fb866c48d2..2e298f77f70 100644 --- a/lib/Doctrine/ORM/LazyCriteriaCollection.php +++ b/lib/Doctrine/ORM/LazyCriteriaCollection.php @@ -9,6 +9,7 @@ use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; use Doctrine\ORM\Persisters\Entity\EntityPersister; +use ReturnTypeWillChange; /** * A lazy collection that allows a fast count when using criteria object @@ -38,6 +39,7 @@ public function __construct(EntityPersister $entityPersister, Criteria $criteria * * @return int */ + #[ReturnTypeWillChange] public function count() { if ($this->isInitialized()) { diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 7b4e33d9021..89f6710b6eb 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -10,12 +10,12 @@ use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; use Doctrine\ORM\Mapping\ClassMetadata; +use ReturnTypeWillChange; use RuntimeException; use function array_combine; use function array_diff_key; use function array_map; -use function array_udiff_assoc; use function array_values; use function array_walk; use function get_class; @@ -505,6 +505,7 @@ public function offsetSet($offset, $value): void * * @return object|null */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { return $this->remove($offset); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ba2039fa06c..46fb4d40cb5 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -550,16 +550,6 @@ parameters: count: 1 path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - - - message: "#^Call to an undefined method ReflectionProperty\\:\\:getType\\(\\)\\.$#" - count: 3 - path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php - - - - message: "#^Call to an undefined method ReflectionProperty\\:\\:hasType\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php - - message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\NamingStrategy\\:\\:joinColumnName\\(\\) invoked with 2 parameters, 1 required\\.$#" count: 2 @@ -1441,18 +1431,17 @@ parameters: path: lib/Doctrine/ORM/Query/Parser.php - - message: - """ - #^PHPDoc tag @return has invalid value \\(AST\\\\BetweenExpression\\| - AST\\\\CollectionMemberExpression\\| - AST\\\\ComparisonExpression\\| - AST\\\\EmptyCollectionComparisonExpression\\| - AST\\\\ExistsExpression\\| - AST\\\\InExpression\\| - AST\\\\InstanceOfExpression\\| - AST\\\\LikeExpression\\| - AST\\\\NullComparisonExpression\\)\\: Unexpected token "\\\\n \\* ", expected type at offset 344$# - """ + message: """ + #^PHPDoc tag @return has invalid value \\(AST\\\\BetweenExpression\\| + AST\\\\CollectionMemberExpression\\| + AST\\\\ComparisonExpression\\| + AST\\\\EmptyCollectionComparisonExpression\\| + AST\\\\ExistsExpression\\| + AST\\\\InExpression\\| + AST\\\\InstanceOfExpression\\| + AST\\\\LikeExpression\\| + AST\\\\NullComparisonExpression\\)\\: Unexpected token "\\\\n \\* ", expected type at offset 344$# + """ count: 1 path: lib/Doctrine/ORM/Query/Parser.php diff --git a/phpstan-params.neon b/phpstan-params.neon index 1a5e688fa43..784f63e2d2b 100644 --- a/phpstan-params.neon +++ b/phpstan-params.neon @@ -8,4 +8,4 @@ parameters: earlyTerminatingMethodCalls: Doctrine\ORM\Query\Parser: - syntaxError - phpVersion: 70100 + phpVersion: 80100 diff --git a/psalm.xml b/psalm.xml index 836cb7998b5..63daf409360 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,7 @@ - - - - - - - - - - - - -