chore: style

This commit is contained in:
nuno maduro
2026-05-04 07:38:50 -03:00
parent f859bb179d
commit b828ddcec7
7 changed files with 10 additions and 56 deletions

View File

@ -624,7 +624,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
private function handleParent(array $arguments, string $projectRoot, bool $forceRebuild): array private function handleParent(array $arguments, string $projectRoot, bool $forceRebuild): array
{ {
$this->watchPatterns->useDefaults($projectRoot); $this->watchPatterns->useDefaults($projectRoot);
$this->branch = (new ChangedFiles($projectRoot))->currentBranch() ?? 'main'; $this->branch = new ChangedFiles($projectRoot)->currentBranch() ?? 'main';
$fingerprint = Fingerprint::compute($projectRoot); $fingerprint = Fingerprint::compute($projectRoot);
$this->startFingerprint = $fingerprint; $this->startFingerprint = $fingerprint;
@ -687,7 +687,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
*/ */
private function handleWorker(array $arguments, string $projectRoot, bool $recordingGlobal, bool $replayingGlobal): array private function handleWorker(array $arguments, string $projectRoot, bool $recordingGlobal, bool $replayingGlobal): array
{ {
$this->branch = (new ChangedFiles($projectRoot))->currentBranch() ?? 'main'; $this->branch = new ChangedFiles($projectRoot)->currentBranch() ?? 'main';
if ($replayingGlobal) { if ($replayingGlobal) {
$this->installWorkerReplay($projectRoot); $this->installWorkerReplay($projectRoot);

View File

@ -1289,13 +1289,7 @@ final class Graph
/** @param array<string, array<int, string>> $edges */ /** @param array<string, array<int, string>> $edges */
private function anyTestUses(array $edges, string $component): bool private function anyTestUses(array $edges, string $component): bool
{ {
foreach ($edges as $components) { return array_any($edges, fn ($components): bool => in_array($component, $components, true));
if (in_array($component, $components, true)) {
return true;
}
}
return false;
} }
public function pruneMissingTests(): void public function pruneMissingTests(): void

View File

@ -386,12 +386,6 @@ final class JsModuleGraph
private static function hasViteConfig(string $projectRoot): bool private static function hasViteConfig(string $projectRoot): bool
{ {
foreach (self::VITE_CONFIG_NAMES as $name) { return array_any(self::VITE_CONFIG_NAMES, fn ($name): bool => is_file($projectRoot.DIRECTORY_SEPARATOR.$name));
if (is_file($projectRoot.DIRECTORY_SEPARATOR.$name)) {
return true;
}
}
return false;
} }
} }

View File

@ -23,15 +23,7 @@ final class TableExtractor
} }
$prefix = strtolower(substr($trimmed, 0, 6)); $prefix = strtolower(substr($trimmed, 0, 6));
$matched = array_any(self::DML_PREFIXES, fn ($dml): bool => str_starts_with($prefix, (string) $dml));
$matched = false;
foreach (self::DML_PREFIXES as $dml) {
if (str_starts_with($prefix, $dml)) {
$matched = true;
break;
}
}
if (! $matched) { if (! $matched) {
return []; return [];

View File

@ -94,15 +94,7 @@ final readonly class TestPaths
if (in_array($relativePath, $this->files, true)) { if (in_array($relativePath, $this->files, true)) {
return true; return true;
} }
$matchesSuffix = array_any($this->suffixes, fn ($suffix): bool => str_ends_with($relativePath, (string) $suffix));
$matchesSuffix = false;
foreach ($this->suffixes as $suffix) {
if (str_ends_with($relativePath, $suffix)) {
$matchesSuffix = true;
break;
}
}
if (! $matchesSuffix) { if (! $matchesSuffix) {
return false; return false;

View File

@ -253,35 +253,17 @@ final class WatchPatterns
private function patternTargetsDotfiles(string $pattern): bool private function patternTargetsDotfiles(string $pattern): bool
{ {
foreach (explode('/', str_replace('\\', '/', $pattern)) as $segment) { return array_any(explode('/', str_replace('\\', '/', $pattern)), fn ($segment): bool => $segment !== '' && $segment[0] === '.');
if ($segment !== '' && $segment[0] === '.') {
return true;
}
}
return false;
} }
private function touchesVcs(string $file): bool private function touchesVcs(string $file): bool
{ {
foreach (explode('/', $file) as $segment) { return array_any(explode('/', $file), fn ($segment): bool => in_array($segment, self::VCS_DIRS, true));
if (in_array($segment, self::VCS_DIRS, true)) {
return true;
}
}
return false;
} }
private function touchesDotfile(string $file): bool private function touchesDotfile(string $file): bool
{ {
foreach (explode('/', $file) as $segment) { return array_any(explode('/', $file), fn ($segment): bool => $segment !== '' && $segment[0] === '.');
if ($segment !== '' && $segment[0] === '.') {
return true;
}
}
return false;
} }
private function excludeMatches(string $exclude, string $file): bool private function excludeMatches(string $exclude, string $file): bool

View File

@ -37,7 +37,7 @@ final class XdebugRestarter implements Restarter
return; return;
} }
(new XdebugHandler('pest'))->check(); new XdebugHandler('pest')->check();
} }
private function xdebugIsCoverageOnly(): bool private function xdebugIsCoverageOnly(): bool