wmde / Diff

䷂ Library for diffing, patching and representing differences between objects
BSD 3-Clause "New" or "Revised" License
200 stars 15 forks source link

Allow constructing recursive MapDiffer that uses itself #103

Open JeroenDeDauw opened 6 years ago

JeroenDeDauw commented 6 years ago

Fixes #98

JeroenDeDauw commented 6 years ago

@BoShurik I made a follow up, now it should be ready for merging.

Really a hacky solution though. Making this follow up made me realize how strange it is that the Differ return an array of DiffOp rather than a Diff. I don't see any reason for that. If they returned a Diff, we'd not have the problem in MapDiffer, that it needs to know if the inner differ is associative or not.

I'm thinking of just creating a version 4.0 that

So I am not comfortable with merging this without review from someone else that thinks this is OK.

JeroenDeDauw commented 6 years ago

Another non-big-changes approach that avoids introducing MapDifferInterface is to add a new constructor argument $recursiveMapDiffs that would then replace the instanceof check in the current PR.