Refactor and sync with latest implementation of PHPUnit_Util_Diff