Trait that implements the Stringable interface. Allows string conversion of class to numeric output.

Trait synopsis

trait StringableTrait
{
    use TypeTrait;

    // Stringable interface implementation.

    /**
     * Return string representation.
     * @return string String representation.
     */
    public function __toString(): string;
}

Examples


use Phrity\O\Integer\StringableTrait;

class MyClass implements Stringable
{
    use StringableTrait;

    public function __construct(int $input)
    {
        $this->initialize($input);
    }
}

$class = new MyClass(123);
echo $class; // => 123