michael-rubel / laravel-value-objects

A bunch of general-purpose value objects you can use in your Laravel application.
MIT License
190 stars 15 forks source link

Add `toString` convenience method #22

Closed michael-rubel closed 1 year ago

michael-rubel commented 1 year ago

About

As we have the toArray method in every value object, it's also nice to have a toString method to be able to get the string representation of the object without using a native (string) cast.

$bool = new Boolean(1);

$bool->toString(); // 'true'