Skip to content

Method test::getItems() with return type void returns *NEVER* but should not return anything. #30

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

Closed
arnaud-lb opened this issue Jun 27, 2018 · 3 comments

Comments

@arnaud-lb
Copy link
Contributor

When the doctrine plugin is enabled, I get an error with when analysing this code in level 7:

<?php

use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Selectable;

class test
{
    /**
     * @var test[]&Collection&Selectable
     */
    private $items;

    /**
     * @return test[]&Collection&Selectable
     */
    public function getItems(): Collection
    {
        return $this->items;
    }
}

The error:

Method test::getItems() with return type void returns *NEVER* but should not return anything.
@ondrejmirtes
Copy link
Member

ondrejmirtes commented Jun 27, 2018 via email

@arnaud-lb
Copy link
Contributor Author

you should use something like iterable&Collection&Selectable

Thanks, this fixes the problem. It seems that phpstan 0.9 was handling test[] like iterable.

Also, I though it was related to this plugin, but it's not :)

@github-actions
Copy link

github-actions bot commented May 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants