Repository navigation
v8.0.0
Added
Diff::between(): structured diffs ofnull, scalars, arrays and objects, reported asadded,removed,modifiedandmovedchanges with their paths and old and new values. Scalars are compared strictly,NANequalsNANand-0.0equals0.0, map key order is ignored, and a missing key is notnull.- Containers above a change are reported as aggregate
modifiedchanges, parents before their descendants; the root is never an aggregate. DiffResult:hasChanges(),hasChanged(),wasAdded(),wasRemoved(),wasModified(),wasMoved(),changes(),added(),removed(),modified(),moved(),at(),under(),stats(),count(), iteration,toArray()andtoJson().Pathwith dot notation (\.,\*and\\escape a literal character) and RFC 6901 JSON Pointers.DiffOptions:ignore(),only()andredact()with*wildcards,maxDepth()(64 by default) andfloatTolerance().- Lists: the
sequencestrategy (the default) aligns items like lines of text and pairs replaced items conservatively;positionandunorderedstrategies throughlistStrategy(); records identified by one or more keys throughidentify(); anddetectMoves()for identified records that changed their relative order. - Objects: dates are compared by instant,
JsonSerializableobjects throughjsonSerialize()andstdClassas a map;normalize()andcompare()register rules for any class or interface. Unsupported values and objects that contain themselves throw anUnsupportedValueExceptionthat names the path. Diff::text(): line diffs with the Myers algorithm,"\n","\r\n"and"\r"treated alike, final newlines compared, hunks withcontext()lines, andignoreWhitespaceChanges()andignoreTrailingWhitespace().- Modified line pairing with
similarityThreshold(), and inline highlighting by word or grapheme cluster throughinline(). TextDiffResult::toUnified(), whichgit applyandpatchaccept, andtoHtml(), an escaped GitHub-style table styled by the optionalresources/diff.css.- Text limits:
maxLines()(20,000 by default),maxInputBytes()(4 MiB by default) andmaxInlineLength()(1,000 bytes by default). - Every exception implements
DiffException:UnsupportedValueException,MaximumDepthExceededException,IdentityExceptionandInputLimitExceededException.
Full Changelog: https://github.com/Pharaonic/php-diff/commits/8.0.0