Skip to content

Commit e6bdd91

Browse files
authored
Add array_is_list polyfill for backward compatibility (#4019)
1 parent 150818d commit e6bdd91

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

recipe/magento2.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use Deployer\Exception\RunException;
1111
use Deployer\Host\Host;
1212

13+
use function Deployer\Support\array_is_list;
14+
1315
const CONFIG_IMPORT_NEEDED_EXIT_CODE = 2;
1416
const DB_UPDATE_NEEDED_EXIT_CODE = 2;
1517
const MAINTENANCE_MODE_ACTIVE_OUTPUT_MSG = 'maintenance mode is active';

src/Support/helpers.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ function array_merge_alternate(array $original, array $override)
6565
return $original;
6666
}
6767

68+
/**
69+
* Polyfill for the array_is_list function introduced in PHP 8.1.
70+
*
71+
* @param array $array The array to check.
72+
* @return bool Returns true if the array is a list, false otherwise.
73+
*/
74+
function array_is_list(array $array): bool
75+
{
76+
$keys = array_keys($array);
77+
return $keys === array_keys($keys);
78+
}
79+
6880
/**
6981
* Determines if the given string contains the given value.
7082
*/

0 commit comments

Comments
 (0)