getFilename(), '.blade.php')) { continue; } preg_match_all('/\{\{--.*?--\}\}/s', $file->getContents(), $comments); foreach ($comments[0] ?? [] as $comment) { // Assembled rather than written out, for the reason this test // exists: the needles below would otherwise be compiled out of THIS // file's own comments if it were ever a template. $needles = ['@'.'php', '@'.'endphp', '<'.'?php', '<'.'?=']; foreach ($needles as $needle) { if (str_contains($comment, $needle)) { $offenders[] = str_replace(resource_path().'/', '', $file->getPathname()).': '.$needle; } } } } expect($offenders)->toBe([]); });