This commit is contained in:
nuno maduro
2026-05-02 17:37:47 +01:00
parent 635460653c
commit df829ad19d
2 changed files with 21 additions and 4 deletions

View File

@ -9,9 +9,11 @@ use Pest\Plugins\Tia\Contracts\State;
/**
* @internal
*/
final readonly class FileState implements State
final class FileState implements State
{
private string $rootDir;
private readonly string $rootDir;
private ?string $resolvedRoot = null;
public function __construct(string $rootDir)
{
@ -100,9 +102,17 @@ final readonly class FileState implements State
private function resolvedRoot(): ?string
{
if ($this->resolvedRoot !== null) {
return $this->resolvedRoot;
}
$resolved = @realpath($this->rootDir);
return $resolved === false ? null : $resolved;
if ($resolved === false) {
return null;
}
return $this->resolvedRoot = $resolved;
}
private function ensureRoot(): bool