php-cs-fixer/phpunit-constraint-isidenticalstring
PHP-CS-Fixer constraint plugin providing PHPUnit IsIdenticalString constraint for fixer rules and tests. Intended for internal PHP-CS-Fixer usage to assert strings are identical; not a general-purpose PHPUnit extension.
This package provides a single PHPUnit constraint: IsIdenticalString. It’s designed exclusively for internal use by PHP CS Fixer itself — not for general application code. You almost never need to install or use it directly unless you're contributing to or debugging PHP CS Fixer's test suite.
First steps:
php-cs-fixer/phpunit-constraint-isidenticalstring is only referenced in the PHP CS Fixer repository’s dev dependencies (composer.json of PHP-CS-Fixer).composer test — this constraint is loaded automatically via phpunit.xml.tests/Rule/RuleTestCase.php) to see how it’s used.Typical first use case: You’re debugging a PHP CS Fixer test and see an assertion like:
$this->assertThat($fixturePath, new IsIdenticalString($expectedContent));
The constraint’s implementation is trivial — it simply wraps assertSame() semantics with a more descriptive isIdenticalTo($string)-style interface for string comparison in tests.
In practice, you won’t integrate it into your own codebase. Instead:
In PHP CS Fixer’s tests, it replaces verbose assertThat(..., new IsEqual($expected)) (or raw assertEquals) with an explicit IsIdenticalString, enforcing exact string match (type + value).
Usage in tests looks like:
use PHP_CS_Fixer\Tests\Constraint\IsIdenticalString;
$this->assertThat($fixer->fix($input), new IsIdenticalString($expected));
Why not use assertEquals? To catch subtle differences like "\n" vs "\r\n" or non-breaking spaces — critical for deterministic formatting rules. IsIdenticalString enforces === semantics, including type, while skipping normalization (e.g., 0 === "0" fails).
assertEquals (e.g., whitespace trimming). Replace with IsIdenticalString only if you’re temporarily patching PHP CS Fixer itself.assertStringIsIdenticalTo() helper if absolutely needed.💡 Rule of thumb: If you’re not fixing bugs in PHP CS Fixer, you don’t need this package. Treat it as noise unless you’re running
./vendor/bin/phpunitinsidePHP-CS-Fixer’s source tree.
How can I help you explore Laravel packages today?