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

Run static analysis with language level PHP 8.1 #9314

Merged
merged 1 commit into from
Jan 2, 2022
Merged
Show file tree
Hide file tree
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: 2 additions & 0 deletions lib/Doctrine/ORM/LazyCriteriaCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -38,6 +39,7 @@ public function __construct(EntityPersister $entityPersister, Criteria $criteria
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
if ($this->isInitialized()) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/PersistentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -505,6 +505,7 @@ public function offsetSet($offset, $value): void
*
* @return object|null
*/
#[ReturnTypeWillChange]
public function offsetUnset($offset)
{
return $this->remove($offset);
Expand Down
33 changes: 11 additions & 22 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion phpstan-params.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ parameters:
earlyTerminatingMethodCalls:
Doctrine\ORM\Query\Parser:
- syntaxError
phpVersion: 70100
phpVersion: 80100
14 changes: 1 addition & 13 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
phpVersion="8.1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand Down Expand Up @@ -87,25 +88,12 @@
<file name="lib/Doctrine/ORM/QueryBuilder.php"/>
</errorLevel>
</RedundantCastGivenDocblockType>
<!-- Workaround for https://github.com/vimeo/psalm/issues/7026 -->
<ReservedWord>
<errorLevel type="suppress">
<directory name="lib"/>
<directory name="tests"/>
</errorLevel>
</ReservedWord>
<TypeDoesNotContainType>
<errorLevel type="suppress">
<file name="lib/Doctrine/ORM/Internal/SQLResultCasing.php"/>
<file name="lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php"/>
</errorLevel>
</TypeDoesNotContainType>
<UndefinedAttributeClass>
<errorLevel type="suppress">
<!-- The class was added in PHP 8.1 -->
<referencedClass name="ReturnTypeWillChange"/>
</errorLevel>
</UndefinedAttributeClass>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\Common\Cache\ApcCache"/>
Expand Down