Fork me on GitHub
a Sensio Labs Product

Folding Bike (v3.91.3) edition

Rule stringable_for_to_string

A class that implements the __toString() method must explicitly implement the Stringable interface.

Examples

Example #1

--- Original
+++ New
 <?php
-class Foo
+class Foo implements \Stringable
 {
     public function __toString()
     {
         return "Foo";
     }
 }

References

The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.