diff --git a/src/Blueprint.php b/src/Blueprint.php index 613770fd..80b82b49 100644 --- a/src/Blueprint.php +++ b/src/Blueprint.php @@ -112,21 +112,11 @@ public function swapGenerator(string $concrete, Generator $generator) protected function shouldGenerate(array $types, array $only, array $skip): bool { if (count($only)) { - $found = 0; - foreach ($types as $type) { - $found += in_array($type, $only) ? 1 : 0; - } - - return $found > 0; + return collect($types)->intersect($only)->isNotEmpty(); } if (count($skip)) { - $found = 0; - foreach ($types as $type) { - $found += in_array($type, $skip) ? 1 : 0; - } - - return $found === 0; + return collect($types)->intersect($skip)->isEmpty(); } return true;