Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2fe4442

Browse filesBrowse files
minor #41431 [Yaml] Leverage array_is_list() (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Yaml] Leverage array_is_list() | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- f4da7e4 [Yaml] Leverage array_is_list()
2 parents dbeebd1 + f4da7e4 commit 2fe4442
Copy full SHA for 2fe4442

File tree

2 files changed

+3
-14
lines changed
Filter options

2 files changed

+3
-14
lines changed

‎src/Symfony/Component/Yaml/Inline.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Inline.php
+1-13Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,7 @@ public static function dump($value, int $flags = 0): string
207207
*/
208208
public static function isHash($value): bool
209209
{
210-
if ($value instanceof \stdClass || $value instanceof \ArrayObject) {
211-
return true;
212-
}
213-
214-
$expectedKey = 0;
215-
216-
foreach ($value as $key => $val) {
217-
if ($key !== $expectedKey++) {
218-
return true;
219-
}
220-
}
221-
222-
return false;
210+
return !\is_array($value) || !array_is_list($value);
223211
}
224212

225213
/**

‎src/Symfony/Component/Yaml/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/composer.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php": ">=7.2.5",
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": "^4.4|^5.0|^6.0"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.