Skip to content

Commit aa119e5

Browse files
committed
minor #44167 [DependencyInjection][FrameworkBundle] Leverage array_is_list (jderusse)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection][FrameworkBundle] Leverage array_is_list | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Use `array_is_list` instead of `count`+`range`+`array_key` take over #44156 Commits ------- 4bd5c8b135 Leverage array_is_list
2 parents e3d9994 + ef2fe1f commit aa119e5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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) {

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"

0 commit comments

Comments
 (0)