Skip to content

Update webmozart/assert dependency and remove strict types#950

Closed
aaronbauman wants to merge 1 commit intomailgun:masterfrom
aaronbauman:webmozarts-assert-2
Closed

Update webmozart/assert dependency and remove strict types#950
aaronbauman wants to merge 1 commit intomailgun:masterfrom
aaronbauman:webmozarts-assert-2

Conversation

@aaronbauman
Copy link

addresses #948

@CircuitCipher
Copy link

Hoping to see this merged as I have a client that really needs mailgun to work due to limitations on their host and external SMTP and this old library dependency is preventing me from using the drupal/mailgun module.

@aaronbauman
Copy link
Author

Yeah, i've banged on this for a few hours now across 2 different PRs and can't figure out how to achieve compatibility for both versions.

I'll be running with the patched version, but someone else should feel free to pick this up.

@CircuitCipher
Copy link

Hopefully maybe you'll get some support from the mailgun org

@CircuitCipher
Copy link

@aaronbauman It looks like the implementation of the reportInvalidArgument method is the same in the mailgun implementation as it is in the parent Webmozart Assert. Is it possible to just delete the override so that it doesn't fail the build and just let the class use the parent version?

@smoench
Copy link

smoench commented Mar 24, 2026

Can you try following:

namespace Mailgun;

use Mailgun\Exception\InvalidArgumentException;

if (version_compare(\Composer\InstalledVersions::getVersion('webmozart/assert'), '2.0.0', '>=')) {
    final class Assert extends \Webmozart\Assert\Assert
    {
        protected static function reportInvalidArgument(string $message): never
        {
            throw new InvalidArgumentException($message);
        }
    }
} else {
    final class Assert extends \Webmozart\Assert\Assert
    {
        protected static function reportInvalidArgument($message): void
        {
            throw new InvalidArgumentException($message);
        }
    }
}

@aaronbauman aaronbauman force-pushed the webmozarts-assert-2 branch from cb07099 to f7c9d37 Compare March 24, 2026 13:57
@aaronbauman
Copy link
Author

Nope. The static analysis is simply too aggressive.

@aaronbauman
Copy link
Author

Seems like a major version release for mailgun-php would be appropriate, dropping support for PHP < 8

This would allow significant reduction in the tooling and testing coverage, as well as updates for packages like webmozart/assert.

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.

3 participants