Skip to content

Conversation

@jeffhuys
Copy link

#8

Description

So IsType::TYPE_ARRAY doesn't exist in PHPUnit 12, which causes most of the errors with simply adding PHPUnit 12 as supported in composer.json.
The correct way to fix this is using isArray() introduced in PHPUnit 11.
However, that doesn't exist in PHPUnit 10, which means we drop support for Laravel 10.

Another way I tried to fix this is to keep the new IsType() with NativeType::Array, but that also doesn't exist in earlier versions.

In the end, this is the way I went with, but it still has caveats (this example is from FilterAssertions.php):

PHPUnit::assertThat(
    $this->component->filters(NovaRequest::createFromGlobals()),
    PHPUnit::logicalAnd(
        function_exists('\PHPUnit\Framework\isArray')
            ? \PHPUnit\Framework\isArray()
            : new IsType(constant('PHPUnit\Framework\Constraint\IsType::TYPE_ARRAY') ?? 'array'),
        method_exists(TraversableContainsOnly::class, 'forClassOrInterface')
            ? TraversableContainsOnly::forClassOrInterface(Filter::class)
            : new TraversableContainsOnly(Filter::class, false)
    ),
    $message
);

I have created a fork of this repo and implemented this... gory fix. It passes the tests (finally), but undoubtedly there's a more beautiful / better way to do this that I just simply don't see at the moment.
Maybe someone with fresh eyes can chime in here!

Testing

I have tested this only using the Github Actions workflow by temporarily allowing my branch to be picked up by GH Actions. I've reverted that part of this PR.

@jeffhuys jeffhuys mentioned this pull request Jan 21, 2026
@lonnylot
Copy link
Contributor

Let's just drop support for Laravel 10. It's EOL almost a year ago.

@jeffhuys
Copy link
Author

Let's just drop support for Laravel 10. It's EOL almost a year ago.

I would be fine with that, and also okay with making that change!

I see that @robertmarney is the maintainer of this project, but you (@lonnylot) have been active here as well. Is there some kind of structure to this? Don't want to do extra work if it's not needed, of course 😄

@lonnylot
Copy link
Contributor

The company maintains it and Rob is no longer with the company.

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