Skip to content

Conversation

@rbarden
Copy link
Contributor

@rbarden rbarden commented Mar 12, 2021

This PR removes the array type declaration on the InteractsWithViews concern used in testing. These methods should ultimately have the type declaration of Arrayable|array, but until the framework's minimum PHP version is increased to 8, the type declaration should be removed.

With this array type declaration, one must explicitly call ->toArray() on any Arrayable they are using, otherwise a TypeError is thrown: TypeError : Illuminate\Foundation\Testing\TestCase::view(): Argument #2 ($data) must be of type array, ...

public function test_view()
{
    $arrayable = new SomeArrayable();
    $this->view('post.form', $arrayable->toArray());
}
public function test_view()
{
    $arrayable = new SomeArrayable();
    $this->view('post.form', $arrayable);
}

driesvints and others added 2 commits March 11, 2021 17:04
Removes array declaration for methods should actually accept Arrayable|array.
@driesvints
Copy link
Member

These are breaking changes to the method signature and thus best sent to master.

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

Successfully merging this pull request may close these issues.

2 participants