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

[DI] Do not set values of lazy arguments after inlining them#21312

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

Merged
fabpot merged 1 commit intosymfony:masterfromchalasr:di/inlined-def-fix
Jan 18, 2017

Conversation

@chalasr
Copy link
Member

QA
Branch?master
Bug fix?not yet
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#21299
LicenseMIT
Doc PRn/a

@nicolas-grekas
Copy link
Member

Missing test ;)

@chalasrchalasrforce-pushed thedi/inlined-def-fix branch 3 times, most recently from5523b21 tobb0ad49CompareJanuary 16, 2017 19:59
@chalasr
Copy link
MemberAuthor

Test added!

@nicolas-grekas
Copy link
Member

👍

if (is_array($argument)) {
$arguments[$k] =$this->inlineArguments($container,$argument);
}elseif ($argumentinstanceof ArgumentInterface) {
$argument->setValues($this->inlineArguments($container,$argument->getValues()));

Choose a reason for hiding this comment

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

by removing this, we miss the opportunity to inline inside lazy arguments.
only the call to setValue should be removed in fact

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I didn't dare to ask you about that. Updated

@chalasrchalasr changed the title[DependencyInjection] Do not inline values of lazy arguments[DependencyInjection] Do not set values of lazy arguments after inlining themJan 17, 2017
@chalasrchalasr changed the title[DependencyInjection] Do not set values of lazy arguments after inlining them[DI] Do not set values of lazy arguments after inlining themJan 17, 2017

$this->process($container);

$values =$container->getDefinition('closure-proxy')->getArguments()[0]->getValues();
Copy link
Member

Choose a reason for hiding this comment

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

just usegetArgument(0) here

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

it was a quick copy-paste, fixed

$this->assertInstanceOf(Reference::class,$values[0]);
$this->assertSame('inline', (string)$values[0]);

$values =$container->getDefinition('iterator')->getArguments()[0]->getValues();
Copy link
Member

Choose a reason for hiding this comment

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

same here

$arguments[$k] =$this->inlineArguments($container,$argument);
}elseif ($argumentinstanceof ArgumentInterface) {
$argument->setValues($this->inlineArguments($container,$argument->getValues()));
$this->inlineArguments($container,$argument->getValues());
Copy link
Member

Choose a reason for hiding this comment

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

Is there any case where this could break? For example, if someone uses their own implementation ofArgumentInterface for whatever reason?

Copy link
Member

Choose a reason for hiding this comment

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

To answer my own question: theArgumentInterface wasn't part of any release yet.

@xabbuh
Copy link
Member

👍

Status: Reviewed

@fabpot
Copy link
Member

Thank you@chalasr.

@fabpotfabpot merged commit04da7c3 intosymfony:masterJan 18, 2017
fabpot added a commit that referenced this pull requestJan 18, 2017
…em (chalasr)This PR was merged into the 3.3-dev branch.Discussion----------[DI] Do not set values of lazy arguments after inlining them| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | not yet| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#21299| License       | MIT| Doc PR        | n/aCommits-------04da7c3 [DI] Do not inline values of lazy arguments
@chalasrchalasr deleted the di/inlined-def-fix branchJanuary 18, 2017 07:47
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhxabbuh left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@chalasr@nicolas-grekas@xabbuh@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp