8000 Leverage array_is_list · symfony/symfony@4bd5c8b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bd5c8b

Browse files
committed
Leverage array_is_list
1 parent bde6c09 commit 4bd5c8b

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
343343
$workflows = [];
344344
}
345345

346-
if (1 === \count($workflows) && isset($workflows['workflows']) && array_keys($workflows['workflows']) !== range(0, \count($workflows) - 1) && !empty(array_diff(array_keys($workflows['workflows']), ['audit_trail', 'type', 'marking_store', 'supports', 'support_strategy', 'initial_marking', 'places', 'transitions']))) {
346+
if (1 === \count($workflows) && isset($workflows['workflows']) && !array_is_list($workflows['workflows']) && !empty(array_diff(array_keys($workflows['workflows']), ['audit_trail', 'type', 'marking_store', 'supports', 'support_strategy', 'initial_marking', 'places', 'transitions']))) {
347347
$workflows = $workflows['workflows'];
348348
}
349349

@@ -1280,7 +1280,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode, callable $enableI
12801280
->ifString()->then(function ($v) { return ['default' => $v]; })
12811281
->end()
12821282
->beforeNormalization()
1283-
->ifTrue(function ($v) { return \is_array($v) && array_keys($v) === range(0, \count($v) - 1); })
1283+
->ifTrue(function ($v) { return \is_array($v) && array_is_list($v); })
12841284
->then(function ($v) {
12851285
$resources = [];
12861286
foreach ($v as $resource) {

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"symfony/http-kernel": "^5.4|^6.0",
2929
"symfony/polyfill-mbstring": "~1.0",
3030
"symfony/polyfill-php80": "^1.16",
31+
"symfony/polyfill-php81": "^1.22",
3132
"symfony/filesystem": "^4.4|^5.0|^6.0",
3233
"symfony/finder": "^4.4|^5.0|^6.0",
3334
"symfony/routing": "^5.3|^6.0"

src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private function addServices(\DOMElement $parent)
268268

269269
private function convertParameters(array $parameters, string $type, \DOMElement $parent, string $keyAttribute = 'key')
270270
{
271-
$withKeys = array_keys($parameters) !== range(0, \count($parameters) - 1);
271+
$withKeys = !array_is_list($parameters);
272272
foreach ($parameters as $key => $value) {
273273
$element = $this->document->createElement($type);
274274
if ($withKeys) {

src/Symfony/Component/DependencyInjection/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"psr/container": "^1.1.1",
2121
"symfony/deprecation-contracts": "^2.1",
2222
"symfony/polyfill-php80": "^1.16",
23+
"symfony/polyfill-php81": "^1.22",
2324
"symfony/service-contracts": "^1.1.6|^2"
2425
},
2526
"require-dev": {

0 commit comments

Comments
 (0)
0