Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix for #18843#18861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
inso wants to merge7 commits intosymfony:2.3frominso:fix-for-18843
Closed

Fix for #18843#18861

inso wants to merge7 commits intosymfony:2.3frominso:fix-for-18843

Conversation

@inso
Copy link

@insoinso commentedMay 24, 2016
edited
Loading

QA
Branch?2.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#18843
LicenseMIT
Doc PR-

flat1701 reacted with thumbs up emoji
@inso
Copy link
Author

ping @symfony/deciders

*/
privatestaticfunctiondumpArray($value,$exceptionOnInvalidType,$objectSupport)
{
if ($value) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I was intrigued by this problem:"how to detect if an array is associative or not" and I found two one-liners on StackOverflow. Maybe we can simplify this code?

$isMapping =array_keys($value) !==range(0,count($value) -1);$isMapping =count(array_filter(array_keys($value),'is_string')) >0;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

My solution uses less memory and is faster

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In theDumper class we usearray_keys($input) !== range(0, count($input) - 1) to detect the type of array. I am fine with changing the way we detect it, but then we should move the detection into a dedicated method an reuse it in both places.

@inso
Copy link
Author

@nicolas-grekas
Copy link
Member

👍

@xabbuhxabbuh added the Yaml labelMay 29, 2016
@inso
Copy link
Author

inso commentedMay 29, 2016
edited
Loading

@xabbuh comments addressed, but I'm not sure where isHash method should be placed.

* Check if given array is hash or just normal indexed array.
*
* @param array $value The PHP array to check
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The method should be marked as@internal.

@inso
Copy link
Author

@xabbuh done.

@nicolas-grekas
Copy link
Member

Thank you@inso.

nicolas-grekas added a commit that referenced this pull requestMay 30, 2016
This PR was squashed before being merged into the 2.3 branch (closes#18861).Discussion----------Fix for#18843| Q             | A| ------------- | ---| Branch?       | 2.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18843| License       | MIT| Doc PR        | -Commits-------7d78196 Fix for#18843
@fabpotfabpot mentioned this pull requestMay 30, 2016
This was referencedJun 6, 2016
@fabpotfabpot mentioned this pull requestJun 15, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@inso@nicolas-grekas@javiereguiluz@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp