File tree Expand file tree Collapse file tree 3 files changed +35
-10
lines changed Expand file tree Collapse file tree 3 files changed +35
-10
lines changed Original file line number Diff line number Diff line change 88jobs :
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
Original file line number Diff line number Diff line change 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"
Original file line number Diff line number Diff 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 */
You can’t perform that action at this time.
0 commit comments