Skip to content

Conversation

@elnur-ibr
Copy link

While using two or more dependent callback on define it was not passing already resolved data.

class UserStoreRequestFactory extends RequestFactory
{
    public function definition(): array
    {
        return [
            'name'       => $this->faker()->name,
            'status'     => 'active',
            'email'      => $this->faker()->email,
            'level'      => 1,
            'client_ids' => fn (array $data) => [1,2,3],
            'brand_ids'  => fn (array $data) => $this->getBrandIds(data['client_ids']),
        ];
    }
}

public function getBrandIds(array $clientIds)

It was throwing error Argument #1 ($clientIds) must be of type array, Closure given, called in

@etibarrustam
Copy link

I am facing the same issue. Can it be fixed, please?

@SuperDJ
Copy link
Contributor

SuperDJ commented Jun 27, 2025

Can you add a test that would fail without the change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants