wmde / Diff

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

Make the difference between maps and lists more explicit #100

Open JeroenDeDauw opened 6 years ago

JeroenDeDauw commented 6 years ago

Background: the map/list distinction was not present in the very first versions as got hacked in, leaving something that is not explicit and clean.

Terms:

Pain points:

BoShurik commented 6 years ago

What about two empty interfaces MapDifferInterface and ListDifferInterface so the code

return new Diff( $this->listDiffer->doDiff( $old, $new ), $this->listDiffer instanceof MapDifferInterface);

would be appropriate

JeroenDeDauw commented 6 years ago

That is not elegant, but it

So yeah, adding a MapDifferInterface seems OK. I'm really not a fan of the name though. You want to make a PR that adds MapDifferInterface? (no need for ListDifferInterface at this point as far as I can tell)