peridot-php / leo

Next level assertion and matcher library for PHP
http://peridot-php.github.io/leo/
MIT License
35 stars 7 forks source link

better alternative to print_r? #9

Open brianium opened 9 years ago

brianium commented 9 years ago

The Formatter class uses print_r($var, true) to format an object by default.

This works most of the time, but will result in an endless stream of garbage if the variable contains circular references.

The symfony VarDumper component looks pretty promising. Seems like it allows you to limit depth.

brianium commented 9 years ago

This could even be an additional formatter that can be used in place of the default one.

mallorydxw commented 7 years ago

Another problem with print_r is that it doesn't differentiate types at all.

This code:

expect(1)->to->equal(1.0);

Produces this output:

Expected 1 to be identical to 1