8000 Merge branch '5.4' into 6.0 · symfony/symfony@6041dfe · GitHub
[go: up one dir, main page]

Skip to content

Commit 6041dfe

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Yaml] Leverage array_is_list()
2 parents 7ce410e + 2fe4442 commit 6041dfe

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,7 @@ public static function dump($value, int $flags = 0): string
203203
*/
204204
public static function isHash(array|\ArrayObject|\stdClass $value): bool
205205
{
206-
if ($value instanceof \stdClass || $value instanceof \ArrayObject) {
207-
return true;
208-
}
209-
210-
$expectedKey = 0;
211-
212-
foreach ($value as $key => $val) {
213-
if ($key !== $expectedKey++) {
214-
return true;
215-
}
216-
}
217-
218-
return false;
206+
return !\is_array($value) || !array_is_list($value);
219207
}
220208

221209
/**

src/Symfony/Component/Yaml/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php": ">=8.0.2",
2020
"symfony/deprecation-contracts": "^2.1",
21-
"symfony/polyfill-ctype": "~1.8"
21+
"symfony/polyfill-ctype": "^1.8",
22+
"symfony/polyfill-php81": "^1.22"
2223
},
2324
"require-dev": {
2425
"symfony/console": "^5.4|^6.0"

0 commit comments

Comments
 (0)
0