From cac2acae07f06cb5ba852937488706b8bb23b024 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 28 Nov 2021 00:50:56 +0100 Subject: [PATCH] Psalm 4.13.1, PHPStan 1.2.0 (#9204) --- composer.json | 4 +- phpstan.neon | 9 --- psalm-baseline.xml | 139 ++++++++++++++++++++++++--------------------- psalm.xml | 4 ++ 4 files changed, 81 insertions(+), 75 deletions(-) diff --git a/composer.json b/composer.json index a1c8427619d..abd30bf43bd 100644 --- a/composer.json +++ b/composer.json @@ -39,12 +39,12 @@ "doctrine/annotations": "^1.13", "doctrine/coding-standard": "^9.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "1.0.1", + "phpstan/phpstan": "1.2.0", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.4", "squizlabs/php_codesniffer": "3.6.1", "symfony/cache": "^4.4 || ^5.2", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.10.0" + "vimeo/psalm": "4.13.1" }, "conflict": { "doctrine/annotations": "<1.13 || >= 2.0" diff --git a/phpstan.neon b/phpstan.neon index 7a0b60a06b1..67a10eea343 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -30,15 +30,6 @@ parameters: message: '/^Call to static method ensure\(\) on an unknown class Doctrine\\DBAL\\ForwardCompatibility\\Result\.$/' path: lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php - # Forward compatibility for DBAL 3.2 - - '/^Call to an undefined method Doctrine\\DBAL\\Cache\\QueryCacheProfile::[gs]etResultCache\(\)\.$/' - - - message: '/^Call to an undefined static method Doctrine\\DBAL\\Configuration::[gs]etResultCache\(\)\.$/' - path: lib/Doctrine/ORM/Configuration.php - - - message: '/^Parameter #3 \$resultCache of class Doctrine\\DBAL\\Cache\\QueryCacheProfile constructor/' - path: lib/Doctrine/ORM/AbstractQuery.php - # False positive - message: '/^Variable \$offset in isset\(\) always exists and is not nullable\.$/' diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3f29dd590cf..1d53071d242 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + IterableResult @@ -7,9 +7,6 @@ iterate - - $resultCacheDriver !== null && ! ($resultCacheDriver instanceof \Doctrine\Common\Cache\Cache) - ! $filteredParameters->isEmpty() ? $filteredParameters->first() : null @@ -518,15 +515,16 @@ new $metadataFactoryClassName() - + + is_object($connection) is_object($connection) $this->filterCollection !== null - $connection instanceof Connection ': "' . $connection . '"' + gettype($connection) @@ -604,9 +602,6 @@ $sequenceName - - (string) $em->getConnection()->lastInsertId($this->sequenceName) - @@ -777,8 +772,7 @@ - - ClassMetadata + ClassMetadata ClassMetadata ClassMetadata @@ -820,11 +814,13 @@ ClassMetadata::GENERATOR_TYPE_UUID - + addNamedNativeQuery addNamedQuery + getName - + + ! $definition $definition @@ -891,7 +887,8 @@ $subClass->table - + + $parent->idGenerator $parent->idGenerator @@ -922,13 +919,17 @@ self::GENERATOR_TYPE_UUID + + canEmulateSchemas + $this->columnNames $this->columnNames $this->columnNames $this->columnNames - + + ! $this->table $this->table @@ -1021,8 +1022,7 @@ $this->fieldMappings[$idProperty]['columnName'] $this->fieldMappings[$idProperty]['columnName'] - - $discriminatorColumn + $idGenerator $isVersioned $namespace @@ -1081,6 +1081,10 @@ + + canEmulateSchemas + canEmulateSchemas + $joinColumn @@ -1101,7 +1105,8 @@ $metadata - + + ! $class $class @@ -1286,11 +1291,7 @@ $indexXml->options $uniqueXml->options - - (string) $attributes->name - - - isset($attributes->name) + isset($xmlRoot->cache) isset($xmlRoot->embedded) isset($xmlRoot->field) @@ -1582,16 +1583,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selectable - - $persister->slice($this, $offset, $length) - $this->collection - new ArrayCollection($persister->loadCriteria($this, $criteria)) - parent::slice($offset, $length) - - - Collection<TKey, T> - array<TKey,T> - + $key $offset @@ -1626,7 +1618,9 @@ $backRefFieldName - + + $this->em + $this->em is_object($this->collection) is_object($value) && $this->em is_object($value) && $this->em @@ -1852,9 +1846,6 @@ $this->currentPersisterContext->sqlTableAliases - - ($comparison === Comparison::EQ || $comparison === Comparison::IS) && $value === null - $this->insertSql !== null @@ -1895,11 +1886,6 @@ $columnList - - - ($operator === Comparison::EQ || $operator === Comparison::IS) && $value === null - - $classMetadata @@ -2195,6 +2181,9 @@ $this->stringPrimary + + getLowerExpression + $stringPrimary @@ -2224,6 +2213,9 @@ + + getSqrtExpression + $simpleArithmeticExpression @@ -2262,6 +2254,9 @@ $this->stringPrimary + + getUpperExpression + $stringPrimary @@ -2848,22 +2843,23 @@ - - ! ($factor instanceof AST\ConditionalFactor) - $condExpr instanceof AST\ConditionalExpression - $condTerm instanceof AST\ConditionalTerm - $simpleArithmeticExpr instanceof AST\SimpleArithmeticExpression + + $likeExpr->stringPattern instanceof AST\Functions\FunctionNode + $likeExpr->stringPattern instanceof AST\PathExpression $this->queryComponents[$dqlAlias]['relation'] === null '' - is_numeric($leftExpr) ? $leftExpr : $this->conn->quote($leftExpr) - is_numeric($rightExpr) ? $rightExpr : $this->conn->quote($rightExpr) + is_numeric($leftExpr) + is_numeric($rightExpr) is_string($expression) is_string($stringExpr) $expr - + + $condExpr + $condTerm + $factor $selectedClass['class']->name @@ -2934,10 +2930,12 @@ $this->queryComponents $this->selectedClasses - + $leftExpr instanceof AST\Node $likeExpr->stringPattern instanceof AST\InputParameter $rightExpr instanceof AST\Node + $this->conn->quote($leftExpr) + $this->conn->quote($rightExpr) $whereClause !== null ($factor->not ? 'NOT ' : '') . $this->walkConditionalPrimary($factor->conditionalPrimary) @@ -3300,13 +3298,9 @@ configure - - $cacheDriver + $cacheDriver - - deleteAll - @@ -3507,7 +3501,9 @@ (array) $metadata->table['options'] (bool) $embeddablesImmutable - + + $metadata->sequenceGeneratorDefinition + $metadata->sequenceGeneratorDefinition isset($metadata->lifecycleCallbacks) @@ -3582,6 +3578,10 @@ $_extension + + $metadata->table + $metadata->table + @@ -3608,10 +3608,12 @@ addAttribute - + + $field['associationKey'] isset($field['associationKey']) && $field['associationKey'] - + + $sequenceDefinition isset($metadata->lifecycleCallbacks) @@ -3648,6 +3650,10 @@ + + getCountExpression + getCountExpression + $query @@ -3701,7 +3707,8 @@ - + + $AST->whereClause->conditionalExpression instanceof ConditionalFactor $AST->whereClause->conditionalExpression instanceof ConditionalPrimary @@ -3713,12 +3720,16 @@ $AST->whereClause->conditionalExpression - - $AST->whereClause->conditionalExpression instanceof ConditionalExpression - + - + + canEmulateSchemas + compare + setExplicitForeignKeyIndexes + + + ! $definingClass $definingClass diff --git a/psalm.xml b/psalm.xml index f6c3220dc8e..45b4810a8e6 100644 --- a/psalm.xml +++ b/psalm.xml @@ -30,6 +30,10 @@ + + + +