sebastianbergmann/comparator
76.3
Strong · 19 September 2026
2k
lines of production code
PHP
primary language
1
measurement over time
What this system is
This system is a PHP library that provides a factory-based architecture for comparing objects of various types, including closures, enums, and DOM nodes. It supports modern PHP versions with strict typing and includes specialized comparators for handling edge cases like circular references and mock objects. The project focuses on high code quality through rigorous static analysis and comprehensive unit testing.
Features
Introduction of custom exception interfaces and classes
The library now defines a custom \Exception\ interface that extends PHP's \Throwable\, along with a \RuntimeException\ class that implements this interface. This change establishes a specific exception hierarchy for the \SebastianBergmann\\Comparator\ namespace, allowing consumers to catch library-specific errors distinct from standard PHP runtime exceptions.
src/exceptions · high confidence
Behavioural changes
143 commits (0 fixes) modifying tools
A change to existing behaviour in tools — 143 commits, 4 files.
tools · medium confidence · unverified
Automated release note extraction script added
A new PHP script, build/scripts/extract-release-notes.php, has been added to the build tooling. This script automates the extraction of release notes from the ChangeLog.md file based on a provided version tag, supporting the workflow of creating releases when tags are pushed.
build · high confidence
Comparator library rewritten for modern PHP with new type-specific comparators
The \src\ directory has been completely rewritten to target modern PHP versions, introducing strict typing, final classes, and a factory-based architecture for registering comparators. Several new comparators have been added to handle specific types: \ClosureComparator\ for comparing closures by reflection, \EnumerationComparator\ for PHP 8.1+ enums, \NumberComparator\ for \BcMath\\Number\ objects, and \MockObjectComparator\ to filter PHPUnit mock properties. Existing comparators like \DateTimeComparator\ and \DOMNodeComparator\ have been updated to support \DateTimeInterface\, ignore case correctly, and use canonicalization. Legacy classes such as \DOMDocumentComparator\, \DoubleComparator\, and the custom \Exception\ class have been removed. The \ComparisonFailure\ class now extends \RuntimeException\ and supports serialization, while the \Comparator\ base class now relies on a factory for exporter and context line access.
src · high confidence
Modernized build automation and configuration
The project has replaced legacy Travis CI and PHPUnit configurations with modern tooling: Travis CI is removed in favor of GitHub Actions (indicated by the new CI badge and .gitattributes), PHPUnit configuration is updated to phpunit.xml with stricter settings, and PHP-CS-Fixer is configured via .php-cs-fixer.dist.php. Static analysis has switched from Psalm to PHPStan (phpstan.neon) at level 10, and dependency management is automated via Renovate (renovate.json). Additionally, the .gitattributes file is introduced to control archive exports, and the license is updated to BSD 3-Clause with a 2026 copyright year.
(repo-wide) · high confidence
Test coverage
Added test fixtures for comparator edge cases; Added unit tests for comparator components; Removed ComparatorTest.php.
Dependencies
PHP 8.4 upgrade and dependency modernization
The project now requires PHP 8.4 and has updated its core dependencies to sebastian/diff ^9.0.1 and sebastian/exporter ^8.2.1, while adding optional support for the bcmath extension. Development tooling has been standardized by introducing a dedicated PHPStan environment in tools/.phpstan with version 2.2.14 and strict rules, and the main composer.json now enforces stable dependencies and includes a security policy link.
(dependencies) · high confidence
Updated PHPStan static analysis tooling to version 2.2.14
The \tools/.phpstan\ directory has been updated to use PHPStan version 2.2.14, along with \phpstan-strict-rules\ 2.0.12 and \ergebnis/phpstan-rules\ 2.13.1. This upgrade brings the latest static analysis capabilities and rule sets to the project's local development environment, ensuring that code quality checks reflect the most recent standards and bug fixes provided by these libraries.
tools/.phpstan · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 76.
Lenses
- Code Health 98
- Architecture 100
- Maturity 66
- Readiness 78
- Security 89
Changes since last survey
- 300 commits — 282 feature/other, 18 fixes
By area
- (root) — 102 commits
- (repo) — 52 commits
- tools/.phpstan — 44 commits
- .github/workflows — 40 commits
- tests/unit — 20 commits
- .phive/phars.xml — 8 commits
- src/ScalarComparator.php — 6 commits
- src/NumberComparator.php — 5 commits
- src/DOMNodeComparator.php — 4 commits
- src/ArrayComparator.php — 3 commits
- src/ClosureComparator.php — 3 commits
- .github/FUNDING.yml — 2 commits
- src/Factory.php — 2 commits
- .github/CODE_OF_CONDUCT.md — 1 commit
- .github/CONTRIBUTING.md — 1 commit
- src/DateTimeComparator.php — 1 commit
- src/ResourceComparator.php — 1 commit
- src/SplObjectStorageComparator.php — 1 commit
- src/exceptions — 1 commit
- tests/ScalarComparatorTest.php — 1 commit
Notable commits
- fix: Add regression test for #79
- fix: Add regression test for https://github.com/sebastianbergmann/exporter/issues/90
- fix: Added regression test for closure comparison failure
- fix: Fix
- fix: Fix
- fix: Fix
- fix: Fix "Uninitialized string offset -1" warning
- fix: Fix CS/WS issue
- fix: Fix CS/WS issue
- fix: Fix CS/WS issue
- fix: Fix CS/WS issues
- fix: Fix CS/WS issues
- fix: Fix code coverage metadata
- fix: Fix constraint
- fix: Fix copy/paste mistake
- fix: Fix errors identified by PHPStan
- fix: Fix package name
- fix: Revert "Do not use Composer-installed PHPUnit"
- change: * Install PHPStan using Composer in order to be able to use phpstan/phpstan-strict-rules and tomasvotruba/type-coverage * Configure phpstan/phpstan-strict-rules and tomasvotruba/type-coverage * Update PHPStan configuration * Put Phive binary under version control and manage it through "ant update-tools"
- change: Adapt to PHPUnit 12 API change
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
sebastianbergmann/comparator was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 34dcca995ee957b433ebfb9f1f46777cce2909a2 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.