Simplify unnecessary foreach check of instances
-foreach ($foos as $foo) {
- $this->assertInstanceOf(SplFileInfo::class, $foo);
-}
+$this->assertContainsOnlyInstancesOf(\SplFileInfo::class, $foos);
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\Foreach_\SimplifyForeachInstanceOfRector;
return RectorConfig::configure()
->withRules([
SimplifyForeachInstanceOfRector::class,
]);