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

Support Object[] params #1373

Open
ciaranmcnulty opened this issue Mar 8, 2021 · 2 comments
Open

Support Object[] params #1373

ciaranmcnulty opened this issue Mar 8, 2021 · 2 comments

Comments

@ciaranmcnulty
Copy link
Member

We took out support for @param in favour of type hints, but there are maybe some cases where it could be supported - I'm mostly thinking of Object[] types

/**
 * @param Foo[] $foos
 */
function it_uses_array(array $foos)
{
    $foos[0]->bar()->willReturn(1);
    $foos[1]->bar()->willReturn(2);

    $this->baz($foo)->shouldBe([1,2]);
}
@orklah
Copy link

orklah commented Jun 20, 2021

In order to give static analysis tools all the information they need, array<int, Foo> or even list<Foo> should be used when applicable

@drupol
Copy link
Contributor

drupol commented Jun 20, 2021

I would also use array<int, Foo> or list<Foo> over Foo[].

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

3 participants