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

Upgrade to Psalm 5 #370

Merged
merged 1 commit into from
May 8, 2023
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: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.22"
"vimeo/psalm": "^5.11"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 14 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand All @@ -18,6 +20,18 @@
<MixedArgumentTypeCoercion errorLevel="info" />
<MixedAssignment errorLevel="info" />

<MixedInferredReturnType>
<errorLevel type="suppress">
<file name="src/AbstractLazyCollection.php"/>
</errorLevel>
</MixedInferredReturnType>

<MixedReturnStatement>
<errorLevel type="suppress">
<file name="src/AbstractLazyCollection.php"/>
</errorLevel>
</MixedReturnStatement>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by

ERROR: MixedInferredReturnType - src/AbstractLazyCollection.php:277:21 - Could not verify return type 'TInitial|TReturn|null' for Doctrine\Common\Collections\AbstractLazyCollection::reduce (see https://psalm.dev/047)
    public function reduce(Closure $func, mixed $initial = null)


ERROR: MixedReturnStatement - src/AbstractLazyCollection.php:281:16 - Could not infer a return type (see https://psalm.dev/138)
        return $this->collection->reduce($func, $initial);

This seems to complex for Psalm.


<PossiblyNullArgument>
<errorLevel type="suppress">
<!-- Remove when https://github.com/vimeo/psalm/pull/7759 is released -->
Expand Down
1 change: 1 addition & 0 deletions src/ArrayCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ public function partition(Closure $p)
* Returns a string representation of this object.
* {@inheritDoc}
*/
#[ReturnTypeWillChange]
public function __toString()
{
return self::class . '@' . spl_object_hash($this);
Expand Down