Run Rector on your code to see what it can do for you:

     
     public function run($index)
     {   
-        return str_replace($this->find, $this->replace, $this->items[$index]); 
+        return str_replace($this->find, $this->replace, (string) $this->items[$index]); 
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 341fbe - released at 2025-06-16 13:12