It seems like $table can also be of type Illuminate\Database\Query\Expression; however, parameter $haystack of Illuminate\Support\Str::startsWith() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
12
if (Str::startsWith(/** @scrutinizer ignore-type */ $table, 'laravel_')) {
The expression return $table could return the type Illuminate\Database\Query\Expression which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.