Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions system/Autoloader/FileLocatorCached.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ public function listNamespaceFiles(string $prefix, string $path): array

public function locateFile(string $file, ?string $folder = null, string $ext = 'php'): false|string
{
if (isset($this->cache['locateFile'][$file][$folder][$ext])) {
return $this->cache['locateFile'][$file][$folder][$ext];
$folderKey = $folder ?? '';

if (isset($this->cache['locateFile'][$file][$folderKey][$ext])) {
return $this->cache['locateFile'][$file][$folderKey][$ext];
}

$files = $this->locator->locateFile($file, $folder, $ext);

$this->cache['locateFile'][$file][$folder][$ext] = $files;
$this->cacheUpdated = true;
$this->cache['locateFile'][$file][$folderKey][$ext] = $files;
$this->cacheUpdated = true;

return $files;
}
Expand Down
12 changes: 6 additions & 6 deletions tests/system/Validation/RulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public static function provideInList(): iterable
}

#[DataProvider('provideRequiredWith')]
public function testRequiredWith(?string $field, ?string $check, bool $expected): void
public function testRequiredWith(string $field, ?string $check, bool $expected): void
{
$data = [
'foo' => 'bar',
Expand All @@ -693,8 +693,8 @@ public static function provideRequiredWith(): iterable
['nope', 'bar', false],
['foo', 'bar', true],
['nope', 'baz', true],
[null, null, true],
[null, 'foo', false],
['', null, true],
['', 'foo', false],
['foo', null, true],
[
'array.emptyField1',
Expand Down Expand Up @@ -779,7 +779,7 @@ public static function provideRequiredWithAndOtherRuleWithValueZero(): iterable
}

#[DataProvider('provideRequiredWithout')]
public function testRequiredWithout(?string $field, ?string $check, bool $expected): void
public function testRequiredWithout(string $field, ?string $check, bool $expected): void
{
$data = [
'foo' => 'bar',
Expand All @@ -802,8 +802,8 @@ public static function provideRequiredWithout(): iterable
yield from [
['nope', 'bars', false],
['foo', 'nope', true],
[null, null, false],
[null, 'foo', true],
['', null, false],
['', 'foo', true],
['foo', null, true],
[
'array.emptyField1',
Expand Down
Loading