Add Stringable
interface to classes with __toString()
method
-class SomeClass
+class SomeClass implements Stringable
{
- public function __toString()
+ public function __toString(): string
{
return 'I can stringz';
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
return RectorConfig::configure()
->withRules([
StringableForToStringRector::class,
]);