Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jan 18, 2024
2 parents e931659 + 0788018 commit 787382c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -1361,11 +1361,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Exceptions/PageNotFoundException.php',
];
$ignoreErrors[] = [
'message' => '#^Call to method SplFileInfo\\:\\:getBasename\\(\\) with incorrect case\\: getBaseName$#',
'count' => 1,
'path' => __DIR__ . '/system/Files/File.php',
];
$ignoreErrors[] = [
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 1,
Expand Down
2 changes: 1 addition & 1 deletion system/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function getRandomName(): string
public function move(string $targetPath, ?string $name = null, bool $overwrite = false)
{
$targetPath = rtrim($targetPath, '/') . '/';
$name ??= $this->getBaseName();
$name ??= $this->getBasename();
$destination = $overwrite ? $targetPath . $name : $this->getDestination($targetPath . $name);

$oldName = $this->getRealPath() ?: $this->__toString();
Expand Down
2 changes: 1 addition & 1 deletion system/Validation/DotArrayFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function run(array $indexes, array $array): array
$segments
);

$result = array_merge_recursive($result, self::filter($segments, $array));
$result = array_replace_recursive($result, self::filter($segments, $array));
}

return $result;
Expand Down
15 changes: 15 additions & 0 deletions tests/system/Validation/DotArrayFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,19 @@ public function testRunNestedArray()
];
$this->assertSame($expected, $result);
}

public function testRunReturnOrderedIndices()
{
$data = [
'foo' => [
2 => 'bar',
0 => 'baz',
1 => 'biz',
],
];

$result = DotArrayFilter::run(['foo.2', 'foo.0', 'foo.1'], $data);

$this->assertSame($data, $result);
}
}

0 comments on commit 787382c

Please sign in to comment.