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

[DependencyInjection] Yaml: check if $tags is an array before using it#21348

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
dunglas wants to merge3 commits intosymfony:masterfromdunglas:test_tags

Conversation

@dunglas
Copy link
Member

QA
Branch?master
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsn/a
LicenseMIT
Doc PRn/a

@dunglasdunglas changed the title[DependencyInjection] Yaml: check if is an array before using it[DependencyInjection] Yaml: check if $tags is an array before using itJan 19, 2017
}
}

$tags =isset($service['tags']) ?$service['tags'] :array();

Choose a reason for hiding this comment

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

I think this line was fine, just addif (!is_array($tags)) { on the next line

Choose a reason for hiding this comment

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

shouldn't this PR be applied on a lower branch btw?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Why not but it adds 1 useless check when$service['tags'] is not set.

Copy link
MemberAuthor

@dunglasdunglasJan 19, 2017
edited
Loading

Choose a reason for hiding this comment

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

No the branch is correct (this "bug" was introduced by_defaults in#21071).

Copy link
Member

@nicolas-grekasnicolas-grekasJan 19, 2017
edited
Loading

Choose a reason for hiding this comment

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

it adds 1 useless check

yes, but we don't care, readibility is more important here (thinking about the complexity of nested if/else blocks) IMHO

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I usually preferif/else than the ternary operator but it's probably because I need glasses to read on a screen.
I'll change that.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

@xabbuh
Copy link
Member

We should add a test then to avoid future regressions.

@dunglas
Copy link
MemberAuthor

@xabbuh test added

@nicolas-grekas
Copy link
Member

Tests fail :)

@dunglas
Copy link
MemberAuthor

Fixed.

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

👍

Status: Reviewed


Foo\Bar:
tags:invalid
inherit_tags:true

Choose a reason for hiding this comment

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

I find this test confusing. Intuitively, I thought that tags were inherited and then validated, so theFoo\Bar service has the validtags: ['foo'] tags instead oftags: invalid

Copy link
Member

Choose a reason for hiding this comment

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

But this way (using a string instead of an array) to specify tags already wasn't supported before. Why should we do that now?

@nicolas-grekasnicolas-grekas added this to the3.3 milestoneJan 24, 2017
@nicolas-grekas
Copy link
Member

Thank you@dunglas.

nicolas-grekas added a commit that referenced this pull requestJan 24, 2017
…efore using it (dunglas)This PR was squashed before being merged into the 3.3-dev branch (closes#21348).Discussion----------[DependencyInjection] Yaml: check if $tags is an array before using it| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | n/a| License       | MIT| Doc PR        | n/aCommits-------1c9b5c9 [DependencyInjection] Yaml: check if  is an array before using it
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

5 participants

@dunglas@xabbuh@nicolas-grekas@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp