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] Always consider abstract getters as autowiring candidates#21602

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:masterfromnicolas-grekas:di-getter-autow
Feb 27, 2017

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedFeb 13, 2017
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes (a missing part of getter autowiring really)
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

When a definition is set to be autowired with no method explicitly configured, we already wire the constructor.
We should also autowire abstract getters - with the same reasoning that makes us autowire the constructor: without concrete getters, the class is unusable. This just makes it usable again.

ro0NL and ogizanagi reacted with thumbs up emojijvasseur reacted with confused emoji
@nicolas-grekas
Copy link
MemberAuthor

now with tests


try {
$this->processValue($argumentDefinition,true);
$this->processValue($argumentDefinition,false);
Copy link
Member

Choose a reason for hiding this comment

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

just omit the argument entirely

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

indeed, done

@stof
Copy link
Member

👍
Status: reviewed

* @author Kévin Dunglas <dunglas@gmail.com>
*/
class GetterOverriding
abstractclass GetterOverriding
Copy link
Member

Choose a reason for hiding this comment

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

Maybe should you add another test instead of editing this one to be sure that both cases are covered?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

test case splitted

}
}

if ($reflectionMethod->isAbstract() && !$reflectionMethod->getNumberOfParameters()) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we check all conditions making it eligible to autowiring (return type...).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

that won't provide anything more to me since those checks are going to happen anyway later on

@dunglas
Copy link
Member

👍

@nicolas-grekasnicolas-grekasforce-pushed thedi-getter-autow branch 4 times, most recently fromc984198 to61ea411CompareFebruary 14, 2017 15:18
@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit8f246bd intosymfony:masterFeb 27, 2017
fabpot added a commit that referenced this pull requestFeb 27, 2017
…ates (nicolas-grekas)This PR was merged into the 3.3-dev branch.Discussion----------[DI] Always consider abstract getters as autowiring candidates| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes (a missing part of getter autowiring really)| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -When a definition is set to be autowired with no method explicitly configured, we already wire the constructor.We should also autowire abstract getters - with the same reasoning that makes us autowire the constructor: without concrete getters, the class is unusable. This just makes it usable again.Commits-------8f246bd [DI] Always consider abstract getters as autowiring candidates
@nicolas-grekasnicolas-grekas deleted the di-getter-autow branchFebruary 28, 2017 08:48
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasdunglas left review comments

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@stof@dunglas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp