NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #48 most downloaded on Packagist
Provides the functionality to compare PHP values for equality
Last release 2 months ago
07 Aug 2026
Release timing varies
gaps range from 1 weeks to 5 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
74 releases · first in 2014
Factory::setExporter() and Factory::exporter() for configuring the SebastianBergmann\Exporter\Exporter instance that is used by comparators registered
Factory::setExporter() and Factory::exporter() for configuring the SebastianBergmann\Exporter\Exporter instance that is used by comparators registered with the factoryExporter instance configured for their Factory instead of creating their own instances (this allows customizing how values are represented in comparison failure messages)DateTimeComparator, for instance), as the representation such a comparator provides always has precedenceAdded #163 : Expose detection of closure comparisons
One column per quarter.
Changed #136 : Cleaner diff output for canonicalized list comparisons #160 : Use by-value comparison for closures Fixed #136 : Canonicalized array com
Added #126 : DateIntervalComparator for comparing DateInterval objects with a delta tolerance Fixed #70 : Non-ASCII text in XML diffs is rendered as n
DateIntervalComparator for comparing DateInterval objects with a delta toleranceDOMNodeComparator crashes or returns false positives when DOMNode::C14N() failsDOMNodeComparator reports XML documents as equal when they differ only in commentsDateTimeComparator does not track processed pairs, producing misleading diffs in nested structuresComparisonFailure cannot be serialized when stack trace contains non-serializable objectsChanged #138 : Use StrictUnifiedDiffOutputBuilder instead of UnifiedDiffOutputBuilder
StrictUnifiedDiffOutputBuilder instead of UnifiedDiffOutputBuilderPass configuration options introduced in sebastian/diff 8.3.0
Fixed #141 : ArrayComparator sorts objects by spl_object_id() , breaking canonicalized equality for arrays of equal objects
ArrayComparator sorts objects by spl_object_id(), breaking canonicalized equality for arrays of equal objects### Fixed * #140: sort() in ArrayComparator produces non-deterministic results for arrays with mixed types
sort() in ArrayComparator produces non-deterministic results for arrays with mixed types### Added * #137: Make diff context lines configurable
### Removed * Removed support for PHP 8.3
Changed #136 : Cleaner diff output for canonicalized list comparisons #160 : Use by-value comparison for closures Fixed #136 : Canonicalized array com
Fixed #70 : Non-ASCII text in XML diffs is rendered as numeric character references, making diffs unreadable #87 : DOMNodeComparator crashes or return
DOMNodeComparator crashes or returns false positives when DOMNode::C14N() failsDOMNodeComparator reports XML documents as equal when they differ only in commentsDateTimeComparator does not track processed pairs, producing misleading diffs in nested structuresComparisonFailure cannot be serialized when stack trace contains non-serializable objectsFixed #141 : ArrayComparator sorts objects by spl_object_id() , breaking canonicalized equality for arrays of equal objects
ArrayComparator sorts objects by spl_object_id(), breaking canonicalized equality for arrays of equal objects### Fixed * #140: sort() in ArrayComparator produces non-deterministic results for arrays with mixed types
sort() in ArrayComparator produces non-deterministic results for arrays with mixed types### Changed * #134: Suppress warning introduced in PHP 8.5
### Changed * #130: Provide a diff when ClosureComparator fails
ClosureComparator failsSebastianBergmann\Comparator\Comparator should not have been marked as private implementation detail of this library
SebastianBergmann\Comparator\Comparator should not have been marked as private implementation detail of this libraryDo not use SplObjectStorage methods that will be deprecated in PHP 8.5
SplObjectStorage methods that will be deprecated in PHP 8.5### Added * #127: Support for comparing Closure objects
Closure objects### Fixed * #122: INF is considered equal to -INF
INF is considered equal to -INF### Removed * Removed support for PHP 8.2
### Changed * #134: Suppress warning introduced in PHP 8.5
Do not use SplObjectStorage methods that will be deprecated in PHP 8.5
SplObjectStorage methods that will be deprecated in PHP 8.5### Fixed * #122: INF is considered equal to -INF
INF is considered equal to -INF### Added * #121: Support for BcMath\Number objects
BcMath\Number objects### Fixed * #119: Uninitialized string offset -1 warning
Uninitialized string offset -1 warning### Changed * #117: Remove common prefixes and suffixes from actual and expected single-line strings
Reverted #113 as it broke backward compatibility
Specialized comparator for enumerations
### Fixed * #112: Arrays with different keys and the same values are considered equal in canonicalize mode
This project now uses PHPStan instead of Psalm for static analysis
### Removed * Removed support for PHP 8.1
### Changed * #134: Suppress warning introduced in PHP 8.5
Do not use SplObjectStorage methods that will be deprecated in PHP 8.5
SplObjectStorage methods that will be deprecated in PHP 8.5Reverted #113 as it broke backward compatibility
### Fixed * #112: Arrays with different keys and the same values are considered equal in canonicalize mode
MockObjectComparator only works on instances of PHPUnit\Framework\MockObject\MockObject, but not on instances of PHPUnit\Framework\MockObject\Stub
MockObjectComparator only works on instances of PHPUnit\Framework\MockObject\MockObject, but not on instances of PHPUnit\Framework\MockObject\StubMockObjectComparator only ignores the $__phpunit_invocationMocker property, but not other properties with names prefixed with __phpunit_Methods now have parameter and return type declarations
Comparator::$factory is now private, use Comparator::factory() insteadComparisonFailure, DOMNodeComparator, DateTimeComparator, ExceptionComparator, MockObjectComparator, NumericComparator, ResourceComparator, SplObjectStorageComparator, and TypeComparator are now finalScalarComparator and DOMNodeComparator now use mb_strtolower($string, 'UTF-8') instead of strtolower($string)$identical parameter from ComparisonFailure::__construct()Comparator::$exporter### Changed * #134: Suppress warning introduced in PHP 8.5
Do not use SplObjectStorage methods that will be deprecated in PHP 8.5
SplObjectStorage methods that will be deprecated in PHP 8.5### Fixed * #102: Fix float comparison precision
float comparison precision### Fixed * #99: Fix weak comparison between '0' and false
'0' and falseSebastianBergmann\Comparator\Exception now correctly extends \Throwable
SebastianBergmann\Comparator\Exception now correctly extends \Throwable### Fixed * #89: Handle PHP 8 ValueError
ValueErrorChanged PHP version constraint in composer.json from ^7.3 || ^8.0 to >=7.3
composer.json from ^7.3 || ^8.0 to >=7.3This component is now supported on PHP 8
### Fixed * #85: Version 4.0.1 breaks backward compatibility
Tests etc. are now ignored for archive exports
Removed support for PHP 7.1 and PHP 7.2
### Changed * #134: Suppress warning introduced in PHP 8.5
Do not use SplObjectStorage methods that will be deprecated in PHP 8.5
SplObjectStorage methods that will be deprecated in PHP 8.5### Fixed * #102: Fix float comparison precision
float comparison precision### Fixed * #99: Fix weak comparison between '0' and false
'0' and falseChanged PHP version constraint in composer.json from ^7.1 to >=7.1
composer.json from ^7.1 to >=7.1By default, MockObjectComparator is now tried before all other (default) comparators
MockObjectComparator is now tried before all other (default) comparators### Fixed * #53: DOMNodeComparator ignores $ignoreCase parameter * #58: ScalarComparator does not handle extremely ugly string comparison edge cases
### Fixed * #48: DateTimeComparator does not support fractional second deltas ### Removed * Removed support for PHP 7.0
DateTimeComparator does not support fractional second deltasThis component is now compatible with version 3 of sebastian/diff
sebastian/diffFix comparison of DateTimeImmutable objects
DateTimeImmutable objectsphpunit/#2923: Unexpected failed date matching
Your coding agent can read these notes before it upgrades. Set up the MCP server →