Skip to content

Commit cac2aca

Browse files
authored
Psalm 4.13.1, PHPStan 1.2.0 (#9204)
1 parent 146b465 commit cac2aca

File tree

4 files changed

+81
-75
lines changed

4 files changed

+81
-75
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
"doctrine/annotations": "^1.13",
4040
"doctrine/coding-standard": "^9.0",
4141
"phpbench/phpbench": "^0.16.10 || ^1.0",
42-
"phpstan/phpstan": "1.0.1",
42+
"phpstan/phpstan": "1.2.0",
4343
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
4444
"squizlabs/php_codesniffer": "3.6.1",
4545
"symfony/cache": "^4.4 || ^5.2",
4646
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
47-
"vimeo/psalm": "4.10.0"
47+
"vimeo/psalm": "4.13.1"
4848
},
4949
"conflict": {
5050
"doctrine/annotations": "<1.13 || >= 2.0"

phpstan.neon

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ parameters:
3030
message: '/^Call to static method ensure\(\) on an unknown class Doctrine\\DBAL\\ForwardCompatibility\\Result\.$/'
3131
path: lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
3232

33-
# Forward compatibility for DBAL 3.2
34-
- '/^Call to an undefined method Doctrine\\DBAL\\Cache\\QueryCacheProfile::[gs]etResultCache\(\)\.$/'
35-
-
36-
message: '/^Call to an undefined static method Doctrine\\DBAL\\Configuration::[gs]etResultCache\(\)\.$/'
37-
path: lib/Doctrine/ORM/Configuration.php
38-
-
39-
message: '/^Parameter #3 \$resultCache of class Doctrine\\DBAL\\Cache\\QueryCacheProfile constructor/'
40-
path: lib/Doctrine/ORM/AbstractQuery.php
41-
4233
# False positive
4334
-
4435
message: '/^Variable \$offset in isset\(\) always exists and is not nullable\.$/'

psalm-baseline.xml

Lines changed: 75 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.10.0@916b098b008f6de4543892b1e0651c1c3b92cbfa">
2+
<files psalm-version="4.13.1@5cf660f63b548ccd4a56f62d916ee4d6028e01a3">
33
<file src="lib/Doctrine/ORM/AbstractQuery.php">
44
<DeprecatedClass occurrences="1">
55
<code>IterableResult</code>
66
</DeprecatedClass>
77
<DeprecatedMethod occurrences="1">
88
<code>iterate</code>
99
</DeprecatedMethod>
10-
<DocblockTypeContradiction occurrences="1">
11-
<code>$resultCacheDriver !== null &amp;&amp; ! ($resultCacheDriver instanceof \Doctrine\Common\Cache\Cache)</code>
12-
</DocblockTypeContradiction>
1310
<FalsableReturnStatement occurrences="1">
1411
<code>! $filteredParameters-&gt;isEmpty() ? $filteredParameters-&gt;first() : null</code>
1512
</FalsableReturnStatement>
@@ -518,15 +515,16 @@
518515
<PropertyTypeCoercion occurrences="1">
519516
<code>new $metadataFactoryClassName()</code>
520517
</PropertyTypeCoercion>
521-
<RedundantCondition occurrences="1">
518+
<RedundantCondition occurrences="2">
519+
<code>is_object($connection)</code>
522520
<code>is_object($connection)</code>
523521
</RedundantCondition>
524522
<RedundantConditionGivenDocblockType occurrences="1">
525523
<code>$this-&gt;filterCollection !== null</code>
526524
</RedundantConditionGivenDocblockType>
527525
<TypeDoesNotContainType occurrences="2">
528-
<code>$connection instanceof Connection</code>
529526
<code>': "' . $connection . '"'</code>
527+
<code>gettype($connection)</code>
530528
</TypeDoesNotContainType>
531529
</file>
532530
<file src="lib/Doctrine/ORM/EntityManagerInterface.php">
@@ -604,9 +602,6 @@
604602
<PossiblyNullPropertyAssignmentValue occurrences="1">
605603
<code>$sequenceName</code>
606604
</PossiblyNullPropertyAssignmentValue>
607-
<RedundantCastGivenDocblockType occurrences="1">
608-
<code>(string) $em-&gt;getConnection()-&gt;lastInsertId($this-&gt;sequenceName)</code>
609-
</RedundantCastGivenDocblockType>
610605
</file>
611606
<file src="lib/Doctrine/ORM/Id/TableGenerator.php">
612607
<PossiblyFalseOperand occurrences="3">
@@ -777,8 +772,7 @@
777772
</RedundantCastGivenDocblockType>
778773
</file>
779774
<file src="lib/Doctrine/ORM/Mapping/ClassMetadata.php">
780-
<PropertyNotSetInConstructor occurrences="7">
781-
<code>ClassMetadata</code>
775+
<PropertyNotSetInConstructor occurrences="6">
782776
<code>ClassMetadata</code>
783777
<code>ClassMetadata</code>
784778
<code>ClassMetadata</code>
@@ -820,11 +814,13 @@
820814
<DeprecatedConstant occurrences="1">
821815
<code>ClassMetadata::GENERATOR_TYPE_UUID</code>
822816
</DeprecatedConstant>
823-
<DeprecatedMethod occurrences="2">
817+
<DeprecatedMethod occurrences="3">
824818
<code>addNamedNativeQuery</code>
825819
<code>addNamedQuery</code>
820+
<code>getName</code>
826821
</DeprecatedMethod>
827-
<DocblockTypeContradiction occurrences="1">
822+
<DocblockTypeContradiction occurrences="2">
823+
<code>! $definition</code>
828824
<code>$definition</code>
829825
</DocblockTypeContradiction>
830826
<InvalidArrayOffset occurrences="1">
@@ -891,7 +887,8 @@
891887
<PropertyTypeCoercion occurrences="1">
892888
<code>$subClass-&gt;table</code>
893889
</PropertyTypeCoercion>
894-
<RedundantConditionGivenDocblockType occurrences="1">
890+
<RedundantConditionGivenDocblockType occurrences="2">
891+
<code>$parent-&gt;idGenerator</code>
895892
<code>$parent-&gt;idGenerator</code>
896893
</RedundantConditionGivenDocblockType>
897894
<UndefinedInterfaceMethod occurrences="17">
@@ -922,13 +919,17 @@
922919
<DeprecatedConstant occurrences="1">
923920
<code>self::GENERATOR_TYPE_UUID</code>
924921
</DeprecatedConstant>
922+
<DeprecatedMethod occurrences="1">
923+
<code>canEmulateSchemas</code>
924+
</DeprecatedMethod>
925925
<DeprecatedProperty occurrences="4">
926926
<code>$this-&gt;columnNames</code>
927927
<code>$this-&gt;columnNames</code>
928928
<code>$this-&gt;columnNames</code>
929929
<code>$this-&gt;columnNames</code>
930930
</DeprecatedProperty>
931-
<DocblockTypeContradiction occurrences="1">
931+
<DocblockTypeContradiction occurrences="2">
932+
<code>! $this-&gt;table</code>
932933
<code>$this-&gt;table</code>
933934
</DocblockTypeContradiction>
934935
<InvalidDocblock occurrences="4">
@@ -1021,8 +1022,7 @@
10211022
<code>$this-&gt;fieldMappings[$idProperty]['columnName']</code>
10221023
<code>$this-&gt;fieldMappings[$idProperty]['columnName']</code>
10231024
</PossiblyUndefinedArrayOffset>
1024-
<PropertyNotSetInConstructor occurrences="7">
1025-
<code>$discriminatorColumn</code>
1025+
<PropertyNotSetInConstructor occurrences="6">
10261026
<code>$idGenerator</code>
10271027
<code>$isVersioned</code>
10281028
<code>$namespace</code>
@@ -1081,6 +1081,10 @@
10811081
</PossiblyFalseOperand>
10821082
</file>
10831083
<file src="lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php">
1084+
<DeprecatedMethod occurrences="2">
1085+
<code>canEmulateSchemas</code>
1086+
<code>canEmulateSchemas</code>
1087+
</DeprecatedMethod>
10841088
<MissingClosureParamType occurrences="1">
10851089
<code>$joinColumn</code>
10861090
</MissingClosureParamType>
@@ -1101,7 +1105,8 @@
11011105
<ArgumentTypeCoercion occurrences="1">
11021106
<code>$metadata</code>
11031107
</ArgumentTypeCoercion>
1104-
<DocblockTypeContradiction occurrences="1">
1108+
<DocblockTypeContradiction occurrences="2">
1109+
<code>! $class</code>
11051110
<code>$class</code>
11061111
</DocblockTypeContradiction>
11071112
<LessSpecificReturnStatement occurrences="1">
@@ -1286,11 +1291,7 @@
12861291
<code>$indexXml-&gt;options</code>
12871292
<code>$uniqueXml-&gt;options</code>
12881293
</PossiblyInvalidPropertyFetch>
1289-
<RedundantCast occurrences="1">
1290-
<code>(string) $attributes-&gt;name</code>
1291-
</RedundantCast>
1292-
<RedundantCondition occurrences="20">
1293-
<code>isset($attributes-&gt;name)</code>
1294+
<RedundantCondition occurrences="19">
12941295
<code>isset($xmlRoot-&gt;cache)</code>
12951296
<code>isset($xmlRoot-&gt;embedded)</code>
12961297
<code>isset($xmlRoot-&gt;field)</code>
@@ -1582,16 +1583,7 @@
15821583
<InvalidDocblock occurrences="1">
15831584
<code>final class PersistentCollection extends AbstractLazyCollection implements Selectable</code>
15841585
</InvalidDocblock>
1585-
<InvalidReturnStatement occurrences="5">
1586-
<code>$persister-&gt;slice($this, $offset, $length)</code>
1587-
<code>$this-&gt;collection</code>
1588-
<code>new ArrayCollection($persister-&gt;loadCriteria($this, $criteria))</code>
1589-
<code>parent::slice($offset, $length)</code>
1590-
</InvalidReturnStatement>
1591-
<InvalidReturnType occurrences="2">
1592-
<code>Collection&lt;TKey, T&gt;</code>
1593-
<code>array&lt;TKey,T&gt;</code>
1594-
</InvalidReturnType>
1586+
<InvalidReturnStatement occurrences="1"/>
15951587
<MissingParamType occurrences="2">
15961588
<code>$key</code>
15971589
<code>$offset</code>
@@ -1626,7 +1618,9 @@
16261618
<PropertyNotSetInConstructor occurrences="1">
16271619
<code>$backRefFieldName</code>
16281620
</PropertyNotSetInConstructor>
1629-
<RedundantConditionGivenDocblockType occurrences="3">
1621+
<RedundantConditionGivenDocblockType occurrences="5">
1622+
<code>$this-&gt;em</code>
1623+
<code>$this-&gt;em</code>
16301624
<code>is_object($this-&gt;collection)</code>
16311625
<code>is_object($value) &amp;&amp; $this-&gt;em</code>
16321626
<code>is_object($value) &amp;&amp; $this-&gt;em</code>
@@ -1852,9 +1846,6 @@
18521846
<PropertyTypeCoercion occurrences="1">
18531847
<code>$this-&gt;currentPersisterContext-&gt;sqlTableAliases</code>
18541848
</PropertyTypeCoercion>
1855-
<RedundantCondition occurrences="1">
1856-
<code>($comparison === Comparison::EQ || $comparison === Comparison::IS) &amp;&amp; $value === null</code>
1857-
</RedundantCondition>
18581849
<RedundantConditionGivenDocblockType occurrences="1">
18591850
<code>$this-&gt;insertSql !== null</code>
18601851
</RedundantConditionGivenDocblockType>
@@ -1895,11 +1886,6 @@
18951886
<code>$columnList</code>
18961887
</PossiblyUndefinedVariable>
18971888
</file>
1898-
<file src="lib/Doctrine/ORM/Persisters/SqlValueVisitor.php">
1899-
<RedundantCondition occurrences="1">
1900-
<code>($operator === Comparison::EQ || $operator === Comparison::IS) &amp;&amp; $value === null</code>
1901-
</RedundantCondition>
1902-
</file>
19031889
<file src="lib/Doctrine/ORM/Proxy/ProxyFactory.php">
19041890
<ArgumentTypeCoercion occurrences="2">
19051891
<code>$classMetadata</code>
@@ -2195,6 +2181,9 @@
21952181
<ArgumentTypeCoercion occurrences="1">
21962182
<code>$this-&gt;stringPrimary</code>
21972183
</ArgumentTypeCoercion>
2184+
<DeprecatedMethod occurrences="1">
2185+
<code>getLowerExpression</code>
2186+
</DeprecatedMethod>
21982187
<PropertyNotSetInConstructor occurrences="1">
21992188
<code>$stringPrimary</code>
22002189
</PropertyNotSetInConstructor>
@@ -2224,6 +2213,9 @@
22242213
</PropertyNotSetInConstructor>
22252214
</file>
22262215
<file src="lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php">
2216+
<DeprecatedMethod occurrences="1">
2217+
<code>getSqrtExpression</code>
2218+
</DeprecatedMethod>
22272219
<PropertyNotSetInConstructor occurrences="1">
22282220
<code>$simpleArithmeticExpression</code>
22292221
</PropertyNotSetInConstructor>
@@ -2262,6 +2254,9 @@
22622254
<ArgumentTypeCoercion occurrences="1">
22632255
<code>$this-&gt;stringPrimary</code>
22642256
</ArgumentTypeCoercion>
2257+
<DeprecatedMethod occurrences="1">
2258+
<code>getUpperExpression</code>
2259+
</DeprecatedMethod>
22652260
<PropertyNotSetInConstructor occurrences="1">
22662261
<code>$stringPrimary</code>
22672262
</PropertyNotSetInConstructor>
@@ -2848,22 +2843,23 @@
28482843
</PossiblyUndefinedArrayOffset>
28492844
</file>
28502845
<file src="lib/Doctrine/ORM/Query/SqlWalker.php">
2851-
<DocblockTypeContradiction occurrences="10">
2852-
<code>! ($factor instanceof AST\ConditionalFactor)</code>
2853-
<code>$condExpr instanceof AST\ConditionalExpression</code>
2854-
<code>$condTerm instanceof AST\ConditionalTerm</code>
2855-
<code>$simpleArithmeticExpr instanceof AST\SimpleArithmeticExpression</code>
2846+
<DocblockTypeContradiction occurrences="8">
2847+
<code>$likeExpr-&gt;stringPattern instanceof AST\Functions\FunctionNode</code>
2848+
<code>$likeExpr-&gt;stringPattern instanceof AST\PathExpression</code>
28562849
<code>$this-&gt;queryComponents[$dqlAlias]['relation'] === null</code>
28572850
<code>''</code>
2858-
<code>is_numeric($leftExpr) ? $leftExpr : $this-&gt;conn-&gt;quote($leftExpr)</code>
2859-
<code>is_numeric($rightExpr) ? $rightExpr : $this-&gt;conn-&gt;quote($rightExpr)</code>
2851+
<code>is_numeric($leftExpr)</code>
2852+
<code>is_numeric($rightExpr)</code>
28602853
<code>is_string($expression)</code>
28612854
<code>is_string($stringExpr)</code>
28622855
</DocblockTypeContradiction>
28632856
<ImplicitToStringCast occurrences="1">
28642857
<code>$expr</code>
28652858
</ImplicitToStringCast>
2866-
<InvalidArgument occurrences="1">
2859+
<InvalidArgument occurrences="4">
2860+
<code>$condExpr</code>
2861+
<code>$condTerm</code>
2862+
<code>$factor</code>
28672863
<code>$selectedClass['class']-&gt;name</code>
28682864
</InvalidArgument>
28692865
<InvalidArrayOffset occurrences="1">
@@ -2934,10 +2930,12 @@
29342930
<code>$this-&gt;queryComponents</code>
29352931
<code>$this-&gt;selectedClasses</code>
29362932
</PropertyTypeCoercion>
2937-
<RedundantConditionGivenDocblockType occurrences="5">
2933+
<RedundantConditionGivenDocblockType occurrences="7">
29382934
<code>$leftExpr instanceof AST\Node</code>
29392935
<code>$likeExpr-&gt;stringPattern instanceof AST\InputParameter</code>
29402936
<code>$rightExpr instanceof AST\Node</code>
2937+
<code>$this-&gt;conn-&gt;quote($leftExpr)</code>
2938+
<code>$this-&gt;conn-&gt;quote($rightExpr)</code>
29412939
<code>$whereClause !== null</code>
29422940
<code>($factor-&gt;not ? 'NOT ' : '') . $this-&gt;walkConditionalPrimary($factor-&gt;conditionalPrimary)</code>
29432941
</RedundantConditionGivenDocblockType>
@@ -3300,13 +3298,9 @@
33003298
<MissingReturnType occurrences="1">
33013299
<code>configure</code>
33023300
</MissingReturnType>
3303-
<PossiblyNullArgument occurrences="2">
3304-
<code>$cacheDriver</code>
3301+
<PossiblyNullArgument occurrences="1">
33053302
<code>$cacheDriver</code>
33063303
</PossiblyNullArgument>
3307-
<PossiblyNullReference occurrences="1">
3308-
<code>deleteAll</code>
3309-
</PossiblyNullReference>
33103304
</file>
33113305
<file src="lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php">
33123306
<ArgumentTypeCoercion occurrences="1">
@@ -3507,7 +3501,9 @@
35073501
<code>(array) $metadata-&gt;table['options']</code>
35083502
<code>(bool) $embeddablesImmutable</code>
35093503
</RedundantCastGivenDocblockType>
3510-
<RedundantConditionGivenDocblockType occurrences="1">
3504+
<RedundantConditionGivenDocblockType occurrences="3">
3505+
<code>$metadata-&gt;sequenceGeneratorDefinition</code>
3506+
<code>$metadata-&gt;sequenceGeneratorDefinition</code>
35113507
<code>isset($metadata-&gt;lifecycleCallbacks)</code>
35123508
</RedundantConditionGivenDocblockType>
35133509
</file>
@@ -3582,6 +3578,10 @@
35823578
<NonInvariantDocblockPropertyType occurrences="1">
35833579
<code>$_extension</code>
35843580
</NonInvariantDocblockPropertyType>
3581+
<RedundantConditionGivenDocblockType occurrences="2">
3582+
<code>$metadata-&gt;table</code>
3583+
<code>$metadata-&gt;table</code>
3584+
</RedundantConditionGivenDocblockType>
35853585
</file>
35863586
<file src="lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php">
35873587
<ArgumentTypeCoercion occurrences="3">
@@ -3608,10 +3608,12 @@
36083608
<PossiblyNullReference occurrences="1">
36093609
<code>addAttribute</code>
36103610
</PossiblyNullReference>
3611-
<RedundantCondition occurrences="1">
3611+
<RedundantCondition occurrences="2">
3612+
<code>$field['associationKey']</code>
36123613
<code>isset($field['associationKey']) &amp;&amp; $field['associationKey']</code>
36133614
</RedundantCondition>
3614-
<RedundantConditionGivenDocblockType occurrences="1">
3615+
<RedundantConditionGivenDocblockType occurrences="2">
3616+
<code>$sequenceDefinition</code>
36153617
<code>isset($metadata-&gt;lifecycleCallbacks)</code>
36163618
</RedundantConditionGivenDocblockType>
36173619
</file>
@@ -3648,6 +3650,10 @@
36483650
</RedundantConditionGivenDocblockType>
36493651
</file>
36503652
<file src="lib/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php">
3653+
<DeprecatedMethod occurrences="2">
3654+
<code>getCountExpression</code>
3655+
<code>getCountExpression</code>
3656+
</DeprecatedMethod>
36513657
<MoreSpecificImplementedParamType occurrences="1">
36523658
<code>$query</code>
36533659
</MoreSpecificImplementedParamType>
@@ -3701,7 +3707,8 @@
37013707
</PropertyNotSetInConstructor>
37023708
</file>
37033709
<file src="lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php">
3704-
<DocblockTypeContradiction occurrences="2">
3710+
<DocblockTypeContradiction occurrences="3">
3711+
<code>$AST-&gt;whereClause-&gt;conditionalExpression instanceof ConditionalFactor</code>
37053712
<code>$AST-&gt;whereClause-&gt;conditionalExpression instanceof ConditionalPrimary</code>
37063713
</DocblockTypeContradiction>
37073714
<ImplementedReturnTypeMismatch occurrences="1">
@@ -3713,12 +3720,16 @@
37133720
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
37143721
<code>$AST-&gt;whereClause-&gt;conditionalExpression</code>
37153722
</PossiblyInvalidPropertyAssignmentValue>
3716-
<RedundantConditionGivenDocblockType occurrences="1">
3717-
<code>$AST-&gt;whereClause-&gt;conditionalExpression instanceof ConditionalExpression</code>
3718-
</RedundantConditionGivenDocblockType>
3723+
<RedundantConditionGivenDocblockType occurrences="1"/>
37193724
</file>
37203725
<file src="lib/Doctrine/ORM/Tools/SchemaTool.php">
3721-
<DocblockTypeContradiction occurrences="1">
3726+
<DeprecatedMethod occurrences="3">
3727+
<code>canEmulateSchemas</code>
3728+
<code>compare</code>
3729+
<code>setExplicitForeignKeyIndexes</code>
3730+
</DeprecatedMethod>
3731+
<DocblockTypeContradiction occurrences="2">
3732+
<code>! $definingClass</code>
37223733
<code>$definingClass</code>
37233734
</DocblockTypeContradiction>
37243735
<MissingClosureParamType occurrences="1">

0 commit comments

Comments
 (0)