Skip to content

Commit 44aa8c2

Browse files
authored
Run static analysis with language level PHP 8.1 (doctrine#9314)
1 parent c456157 commit 44aa8c2

File tree

5 files changed

+17
-37
lines changed

5 files changed

+17
-37
lines changed

lib/Doctrine/ORM/LazyCriteriaCollection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\Common\Collections\Criteria;
1010
use Doctrine\Common\Collections\Selectable;
1111
use Doctrine\ORM\Persisters\Entity\EntityPersister;
12+
use ReturnTypeWillChange;
1213

1314
/**
1415
* A lazy collection that allows a fast count when using criteria object
@@ -38,6 +39,7 @@ public function __construct(EntityPersister $entityPersister, Criteria $criteria
3839
*
3940
* @return int
4041
*/
42+
#[ReturnTypeWillChange]
4143
public function count()
4244
{
4345
if ($this->isInitialized()) {

lib/Doctrine/ORM/PersistentCollection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use Doctrine\Common\Collections\Criteria;
1111
use Doctrine\Common\Collections\Selectable;
1212
use Doctrine\ORM\Mapping\ClassMetadata;
13+
use ReturnTypeWillChange;
1314
use RuntimeException;
1415

1516
use function array_combine;
1617
use function array_diff_key;
1718
use function array_map;
18-
use function array_udiff_assoc;
1919
use function array_values;
2020
use function array_walk;
2121
use function get_class;
@@ -505,6 +505,7 @@ public function offsetSet($offset, $value): void
505505
*
506506
* @return object|null
507507
*/
508+
#[ReturnTypeWillChange]
508509
public function offsetUnset($offset)
509510
{
510511
return $this->remove($offset);

phpstan-baseline.neon

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -550,16 +550,6 @@ parameters:
550550
count: 1
551551
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
552552

553-
-
554-
message: "#^Call to an undefined method ReflectionProperty\\:\\:getType\\(\\)\\.$#"
555-
count: 3
556-
path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
557-
558-
-
559-
message: "#^Call to an undefined method ReflectionProperty\\:\\:hasType\\(\\)\\.$#"
560-
count: 1
561-
path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
562-
563553
-
564554
message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\NamingStrategy\\:\\:joinColumnName\\(\\) invoked with 2 parameters, 1 required\\.$#"
565555
count: 2
@@ -1441,18 +1431,17 @@ parameters:
14411431
path: lib/Doctrine/ORM/Query/Parser.php
14421432

14431433
-
1444-
message:
1445-
"""
1446-
#^PHPDoc tag @return has invalid value \\(AST\\\\BetweenExpression\\|
1447-
AST\\\\CollectionMemberExpression\\|
1448-
AST\\\\ComparisonExpression\\|
1449-
AST\\\\EmptyCollectionComparisonExpression\\|
1450-
AST\\\\ExistsExpression\\|
1451-
AST\\\\InExpression\\|
1452-
AST\\\\InstanceOfExpression\\|
1453-
AST\\\\LikeExpression\\|
1454-
AST\\\\NullComparisonExpression\\)\\: Unexpected token "\\\\n \\* ", expected type at offset 344$#
1455-
"""
1434+
message: """
1435+
#^PHPDoc tag @return has invalid value \\(AST\\\\BetweenExpression\\|
1436+
AST\\\\CollectionMemberExpression\\|
1437+
AST\\\\ComparisonExpression\\|
1438+
AST\\\\EmptyCollectionComparisonExpression\\|
1439+
AST\\\\ExistsExpression\\|
1440+
AST\\\\InExpression\\|
1441+
AST\\\\InstanceOfExpression\\|
1442+
AST\\\\LikeExpression\\|
1443+
AST\\\\NullComparisonExpression\\)\\: Unexpected token "\\\\n \\* ", expected type at offset 344$#
1444+
"""
14561445
count: 1
14571446
path: lib/Doctrine/ORM/Query/Parser.php
14581447

phpstan-params.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ parameters:
88
earlyTerminatingMethodCalls:
99
Doctrine\ORM\Query\Parser:
1010
- syntaxError
11-
phpVersion: 70100
11+
phpVersion: 80100

psalm.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<psalm
33
errorLevel="2"
4+
phpVersion="8.1"
45
resolveFromConfigFile="true"
56
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
67
xmlns="https://getpsalm.org/schema/config"
@@ -87,25 +88,12 @@
8788
<file name="lib/Doctrine/ORM/QueryBuilder.php"/>
8889
</errorLevel>
8990
</RedundantCastGivenDocblockType>
90-
<!-- Workaround for https://github.com/vimeo/psalm/issues/7026 -->
91-
<ReservedWord>
92-
<errorLevel type="suppress">
93-
<directory name="lib"/>
94-
<directory name="tests"/>
95-
</errorLevel>
96-
</ReservedWord>
9791
<TypeDoesNotContainType>
9892
<errorLevel type="suppress">
9993
<file name="lib/Doctrine/ORM/Internal/SQLResultCasing.php"/>
10094
<file name="lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php"/>
10195
</errorLevel>
10296
</TypeDoesNotContainType>
103-
<UndefinedAttributeClass>
104-
<errorLevel type="suppress">
105-
<!-- The class was added in PHP 8.1 -->
106-
<referencedClass name="ReturnTypeWillChange"/>
107-
</errorLevel>
108-
</UndefinedAttributeClass>
10997
<UndefinedClass>
11098
<errorLevel type="suppress">
11199
<referencedClass name="Doctrine\Common\Cache\ApcCache"/>

0 commit comments

Comments
 (0)