Skip to content

Commit 39786df

Browse files
committed
Merge master.
2 parents aee3f1a + cec3a43 commit 39786df

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ on:
88
jobs:
99
testsuite:
1010
name: Unittests
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-24.04
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php-version: ['8.1', '8.3']
15+
php-version: ['8.1', '8.5']
1616

1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v5
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
@@ -43,14 +43,14 @@ jobs:
4343
4444
- name: Code Coverage Report
4545
if: success() && matrix.php-version == '8.1'
46-
uses: codecov/codecov-action@v3
46+
uses: codecov/codecov-action@v5
4747

4848
cs-stan:
4949
name: Coding Standard & Static Analysis
50-
runs-on: ubuntu-22.04
50+
runs-on: ubuntu-24.04
5151

5252
steps:
53-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v5
5454

5555
- name: Setup PHP
5656
uses: shivammathur/setup-php@v2

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
"ext-fileinfo": "*",
2020
"ext-json": "*",
2121
"ext-mbstring": "*",
22-
"php-collective/file-storage-factories": "dev-master as 1.0",
22+
"php-collective/file-storage-factories": "dev-master as 0.1.0",
2323
"psr/http-message": "^1.0|^2.0"
2424
},
2525
"require-dev": {
26-
"phpstan/phpstan": "^1.10",
26+
"phpstan/phpstan": "^2.0",
2727
"phpunit/phpunit": "^10.3",
28-
"php-collective/code-sniffer": "^0.2.1"
28+
"php-collective/code-sniffer": "^0.4.1",
29+
"php-collective/file-storage-image-processor": "dev-master as 0.1.0"
2930
},
3031
"suggest": {
3132
"php-collective/file-storage-image-processor": "For image processing"

src/File.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,38 @@ public function withoutMetadataKey(string $key): FileInterface
596596
public function withVariants(array $variants, bool $merge = true): FileInterface
597597
{
598598
$that = clone $this;
599-
$that->variants = array_merge_recursive(
599+
$that->variants = $this->arrayMergeDeep(
600600
$merge ? $that->variants : [],
601601
$variants,
602602
);
603603

604604
return $that;
605605
}
606606

607+
/**
608+
* Sets many variants at once
609+
*
610+
* @param array $array1
611+
* @param array $array2
612+
*
613+
* @return array
614+
*/
615+
protected function arrayMergeDeep(array $array1, array $array2): array {
616+
foreach ($array2 as $key => $value) {
617+
if (
618+
isset($array1[$key]) &&
619+
is_array($array1[$key]) &&
620+
is_array($value)
621+
) {
622+
$array1[$key] = $this->arrayMergeDeep($array1[$key], $value);
623+
} else {
624+
$array1[$key] = $value;
625+
}
626+
}
627+
628+
return $array1;
629+
}
630+
607631
/**
608632
* @inheritDoc
609633
*/

0 commit comments

Comments
 (0)