Check Sources
The `run()` method
List of Sources
GrepSource
use Juampi92\Phecks\Domain\Sources\GrepSource;
class ResourcesMustImportOurLocalResourceCheck implements Check
{
public function __construct(
// You can inject the source in the Constructor since
// Checks are instantiated by the container.
private readonly GrepSource $source
) {}
public function getMatches(): MatchCollection
{
return $this->source
// Specify a folder (or folder pattern) to analyze.
->files('./app/Http/Resources')
// Specify a grep regex to run against each file.
->pattern("use Illuminate\Http\Resources\Json\JsonResource;")
// Add flags depending on the regex and results that you are looking for,
->addFlags([GrepFlags::IGNORE_CASE, GrepFlags::FIXED_STRINGS, GrepFlags::EXTENDED_REGEXP])
// Run.
->run();
}ClassSource
FileSource
ConfigSource
RouteCommandSource
Last updated