phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 241 forks source link

Switch from ClassName:spl_object_hash to ClassName#id #560

Closed TysonAndre closed 2 years ago

TysonAndre commented 2 years ago

Use a much shorter object id using spl_object_id (available in PHP 7.2+) This will be shorter and easier to tell apart than hex character hashes of length 32.

Closes #549

NOTE: I'm not sure if changing the output format would require a major or minor version bump, but that's outside of the scope of this PR

Current:

      identical(Double\stdClass\P9:0000000046ef9d1d000000002ac5521e Object (
          'objectProphecyClosure' => Closure:0000000046ef8661000000002ac5521e Object (
              0 => Closure:0000000046ef8661000000002ac5521e Object
          )
      ))

Proposed

      identical(Double\stdClass\P9#4480 Object (
          'objectProphecyClosure' => Closure#4458 Object (
              0 => Closure#4458 Object
          )
      ))
stof commented 2 years ago

To me, this is fine as a minor version. I don't think we promise BC for the exact formatting of the output.