assert
assert copied to clipboard
Fix error on `resource` assertion if message has a second placeholder
Prior to this change code such as
Assert::resource(null, 'stream', 'Got: %s, type: %s') would fail as
the second placeholder was only passed into sprintf() if the value
supplied is a resource.
Test I've added without the code change fails with:
1) Webmozart\Assert\Tests\AssertTest::testResourceOfTypeCustomMessage
Failed asserting that exception of type "ArgumentCountError" matches expected exception "\InvalidArgumentException". Message was: "3 arguments are required, 2 given" at
<snip>/src/Assert.php:255
<snip>/tests/AssertTest.php:827
I came to the conclusion a bespoke test was needed but I might have missed something.
Great to see some activity here again, I've rebased this to pickup the CI changes.
Thank you!