Convert DB Expression __toString() calls to getValue() method calls.
use Illuminate\Support\Facades\DB;
-$string = DB::raw('select 1')->__toString();
+$string = DB::raw('select 1')->getValue(DB::connection()->getQueryGrammar());
Configure your rector.php
:
<?php
use RectorLaravel\Rector\MethodCall\DatabaseExpressionToStringToMethodCallRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
DatabaseExpressionToStringToMethodCallRector::class,
]);