These are the release notes for the Diff library.
- Made our __unserialize declarations match PHP 7's, to avoid PHP warnings
- Raised minimum PHP version from 7.0 to 7.2
- Added testing with PHP 7.3, 7.4, 8.0 and 8.1
- Deprecated constant
Diff_VERSION
- Switched License from GPL-2.0-or-later to BSD-3-Clause
- Fixed bug in
ListPatcher
that caused it to compare objects by identity rather than by value - Add
.gitattributes
file to exclude not needed files from git exports - Removed MediaWiki extension registration
- Added return type hints where possible
- Added scalar type hints where possible
- Added strict_types declare statements to all files
- Dropped support for PHP 5.x
- Dropped class aliases deprecated since Diff 1.0
- Removed
ListDiff
andMapDiff
, deprecated since Diff 0.5 - Removed
ListDiffer::MODE_NATIVE
andListDiffer::MODE_STRICT
, deprecated since Diff 0.8 - Removed
MapDiffer::setComparisonCallback
in favour of a new constructor argument
- Fixed bug in
ListPatcher
that caused it to compare objects by identity rather than by value
- Removed MediaWiki extension registration
- Add
.gitattributes
file to exclude not needed files from git exports
- Improved various PHPDocs
- Added
Diff::equals
- Removed unused
Diff\Appendable
interface - Removed
Diff.credits.php
- Changed visibility of most protected fields and methods to private
bootstrap.php
no longer runscomposer update
- Added PHPCS and PHPMD support and configuration (
phpcs.xml
andphpmd.xml
) - Added
composer cs
command for running the code style checks - CI now runs
composer ci
(includes code style checks) instead ofphpunit
- Removed not needed support for the MediaWiki i18n system
- Updated the url in
Diff.credits.php
(used on Special:Version when included with MediaWiki)
- Diff is now PSR-4 compliant
- Removed the
Diff\IDiff
interface (deprecated since 0.5) - Removed the
Diff\IDiffOp
interface (deprecated since 0.4) - Replaced custom autoloader with PSR-4 based loading via Composer
- The classes that got moved into other namespace now have their old names as deprecated aliases:
- All Differ classes that resided directly in the Diff namespace are now in Diff\Differ.
- All DiffOp classes that resided directly in the Diff namespace are now in Diff\DiffOp.
- All Patcher classes that resided directly in the Diff namespace are now in Diff\Patcher.
- Added
OrderedArrayComparer
, anArrayComparer
for ordered arrays - Added
OrderedListDiffer
, a Differ that acts as facade for aListDiffer
using anOrderedArrayComparer
- Added
ComparableComparer
, aValueComparer
that makes use of a "equals" method of the objects it compares
- Added Diff\ArrayComparer\ArrayComparer interface
- Added NativeArrayComparer, ArrayComparer adapter for array_diff
- Added StrictArrayComparer, containing the "strict mode" logic from ListDiffer
- Added StrategicArrayComparer, implementation of ArrayComparer that takes a ValueComparer as strategy
- MapPatcher will now report conflicts for remove operations that specify a value to be removed different from the value in the structure being patched.
- ListDiffer now supports arbitrary array comparison behaviour by using an ArrayComparer strategy.
- The installation and usage documentation can now be found in README.md.
- Removed obsolete tests/phpunit.php test runner
- Removed obsolete INSTALL file. Installation instructions are now in README.md.
- The "comparison mode" flag in the ListDiffer constructor has been deprecated in favour of the ArrayComparer strategy it now has.
- Added extra tests for MapPatcher and ListPatcher
- Added extra tests for Diff
- Added extra tests for MapDiffer
- Added @covers tags to the unit tests to improve coverage report accuracy
- Removed static methods from ListDiff and MapDiff (all deprecated since 0.4)
- Removed DiffOpTestDummy
- MapPatcher will now no longer stop patching after the first remove operation it encounters
- MapPatcher now always treats its top level input diff as a map diff
- Fixed several issues in ListPatcherTest
- The tests can now run independently of MediaWiki
- The tests now require PHPUnit 3.7 or later
- Added phpunit.php runner in the tests directory
- Added Diff\Comparer\ValueComparer interface with CallbackComparer and StrictComparer implementations
- Added MapPatcher::setValueComparer to facilitate patching maps containing objects
- Added PHPUnit configuration file using the new tests/bootstrap.php
- GenericArrayObject has been removed from this package. Diff derives from ArrayObject rather than GenericArrayObject. Its interface has not changed expect for the points below.
- The getObjectType method in Diff (previously defined in GenericArrayObject) is now private rather than public.
- Adding a non-DiffOp element to a Diff will now result in an InvalidArgumentException rather than a MWException.
- Removed Diff\Exception
- Added DiffOpFactory
- Added DiffOp::toArray
- Added CallbackListDiffer
- Added MapDiffer::setComparisonCallback
- Hard deprecated ListDiff, MapDiff and IDiff
- Removed Diff::getApplicableDiff
- Split off diffing code from MapDiff and ListDiff to dedicated Differ classes
- Added dedicated Patcher classes, which are used for the getApplicableDiff functionality
- Deprecated ListDiff:newFromArrays and MapDiff::newFromArrays
- Deprecated ListDiff::newEmpty and MapDiff::newEmpty
- Deprecated Diff::getApplicableDiff
- Soft deprecated DiffOp interface in favour of DiffOp
- Soft deprecated IDiff interface in favour of Diff
- Soft deprecated MapDiff and ListDiff in favour of Diff
- Removed parentKey functionality from Diff
- Removed constructor from Diff interface
- Removed Diff::newEmpty
- Improved entry point and setup code. Diff.php is now the main entry point for both MW extension and standalone library
- ListDiffs with only add operations can now be applied on top of bases that do not have their key
- Added Diff::removeEmptyOperations
- Improved type hinting
- Improved test coverage
- Added constructor tests for MapDiff and ListDiff
- Added extra tests for Diff and MapDiff
- Test coverage is now 100%
- Removed static method from Diff interface
- Fixed tests to work with PHP 5.4 and above
- Added translations
- Added some profiling calls
Initial release with these features:
- Classes to represent diffs or collections of diff operations: Diff, MapDiff, ListDiff
- Classes to represent diff operations: Diff, MapDiff, ListDiff, DiffOpAdd, DiffOpChange, DiffOpRemove
- Methods to compute list and maps diffs
- Support for recursive diffs of arbitrary depth
- Works as MediaWiki extension or as standalone library