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

ImpureMethodCall false-positive for Collection::toArray() #85

Open
fluffycondor opened this issue Dec 18, 2020 · 1 comment
Open

ImpureMethodCall false-positive for Collection::toArray() #85

fluffycondor opened this issue Dec 18, 2020 · 1 comment

Comments

@fluffycondor
Copy link
Contributor

fluffycondor commented Dec 18, 2020

class Test {
    
    private Collection $collection;
    
    /**
     * @psalm-mutation-free
     */
    public function test(): array
    {
        return $this->collection->toArray();
    }
}

ImpureMethodCall: Cannot call an possibly-mutating method Doctrine\Common\Collections\Collection::toArray from a mutation-free context

doctrine/orm 2.7.4
weirdan/doctrine-psalm-plugin 0.11.3
vimeo/psalm 3.18.2

@weirdan
Copy link
Member

weirdan commented Dec 18, 2020

Is it implied to be mutation-free? I'd suggest to ask doctrine/collection devs (they are not very responsive though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants