The method hasCollection() does not exist on Illuminate\Database\Schema\Builder. It seems like you code against a sub-type of Illuminate\Database\Schema\Builder such as Jenssegers\Mongodb\Schema\Builder.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
52
if (Schema::connection($this->connection)->/** @scrutinizer ignore-call */ hasCollection($this->collection)) {