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] Avoid private call to Container::has()#22912

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:3.2fromro0NL:di/private-has
May 25, 2017
Merged

[DI] Avoid private call to Container::has()#22912

fabpot merged 1 commit intosymfony:3.2fromro0NL:di/private-has
May 25, 2017

Conversation

@ro0NL
Copy link
Contributor

QA
Branch?3.2
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#...
LicenseMIT
Doc PRsymfony/symfony-docs#...

FixesUser Deprecated: Checking for the existence of the "debug.file_link_formatter" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.

foreach ($servicesas$service) {
$conditions[] =sprintf("\$this->has('%s')",$service);
if ($this->container->hasDefinition($service) && !$this->container->getDefinition($service)->isPublic()) {
$conditions[] =sprintf("isset(\$this->methodMap['%s'])",$service);

Choose a reason for hiding this comment

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

in the "set" method, "methodMap" is not updated on override, whereas "privates" is,
shouldn't this check for "privates" ?

Copy link
Member

Choose a reason for hiding this comment

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

if the container has the definition, why adding a condition ? It will have the service.

@nicolas-grekasnicolas-grekas added this to the3.2 milestoneMay 25, 2017
@nicolas-grekas
Copy link
Member

any test case possible?

@ro0NL
Copy link
ContributorAuthor

Updated. The private definitions are now skipped from the service conditionals, like@stof mentioned.

Note this only applies to dumping an uncompiled container, ie. this fest fails as of 3.3 and probably allows for the dumper to be further simplified (invalid references are removed due compilation, so it seems).

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

Thank you@ro0NL.

@fabpotfabpot merged commit5689281 intosymfony:3.2May 25, 2017
fabpot added a commit that referenced this pull requestMay 25, 2017
This PR was merged into the 3.2 branch.Discussion----------[DI] Avoid private call to Container::has()| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->Fixes `User Deprecated: Checking for the existence of the "debug.file_link_formatter" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.`Commits-------5689281 [DI] Avoid private call to Container::has()
@ro0NLro0NL deleted the di/private-has branchMay 26, 2017 07:13
@stof
Copy link
Member

we could even skip the condition when we know we have a public service here (as we already know thathas will returntrue)

@ro0NL
Copy link
ContributorAuthor

😓 yes. Tend to leave it as is for now; not sure if worth it. And i definitely dont want to break stuff unintentionally :))

But i believe as of 4.0 (container is compiled) we can drop the logic entirely from phpdumper dueResolveInvalidReferencesPass. Not sure though..

This was referencedMay 29, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.2

Development

Successfully merging this pull request may close these issues.

5 participants

@ro0NL@nicolas-grekas@fabpot@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp