Skip to content

[DI] Remove useless state from ServiceLocator #22029

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no (master only)
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

One less state to manage for the engine, and allows to deal with non-shared services.

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

👍

@nicolas-grekas nicolas-grekas force-pushed the di-non-shared-locator branch from 5a8263e to e0a5eec Compare March 16, 2017 18:20
@@ -53,13 +52,12 @@ public function get($id)
throw new ServiceCircularReferenceException($id, array($id, $id));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to cover this? The ServiceLocator is not passed to the factories so it is very unlikely to happen.

Copy link
Member Author

@nicolas-grekas nicolas-grekas Mar 16, 2017

Choose a reason for hiding this comment

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

Why should we remove the safe guard? Symfony is used into the wild, it needs to handle properly any situations. I see no reason to trade a few lines vs a fatal error, however rare it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, just asking, fine for me as is then.

@xabbuh
Copy link
Member

xabbuh commented Mar 17, 2017

👍

Status: Reviewed

@@ -40,15 +40,20 @@ public function testGet()
$this->assertSame('baz', $locator->get('bar'));
}

public function testGetDoesNotExecuteTheSameCallableTwice()
public function testGetDoesNotMemoize()
Copy link
Contributor

Choose a reason for hiding this comment

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

Memoize => Memorize

Copy link
Member Author

@nicolas-grekas nicolas-grekas Mar 17, 2017

Choose a reason for hiding this comment

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

@jakzal
Copy link
Contributor

jakzal commented Mar 17, 2017

apart from the typo 👍

@fabpot
Copy link
Member

fabpot commented Mar 17, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit e0a5eec into symfony:master Mar 17, 2017
fabpot added a commit that referenced this pull request Mar 17, 2017
…rekas)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Remove useless state from ServiceLocator

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no (master only)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

One less state to manage for the engine, and allows to deal with non-shared services.

Commits
-------

e0a5eec [DI] Remove useless state from ServiceLocator
@nicolas-grekas nicolas-grekas deleted the di-non-shared-locator branch March 17, 2017 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants