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

Appearance settings

[DI] Improve some deprecation messages #24423

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
Oct 5, 2017

Conversation

nicolas-grekas
Copy link
Member

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

To improve DX.

@@ -282,7 +282,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
// calling $this->normalizeId($id) unless necessary.
for ($i = 2;;) {
if (isset($this->privates[$id])) {
@trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or preferably eg implement ServiceSubscriberInterface or use any other dependency injection method instead of using the container at all.', $id), E_USER_DEPRECATED);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the most critical one, as it will be triggered quite often in 3.4 where services are now private by default.

Copy link
Member

Choose a reason for hiding this comment

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

Minor reword proposal:

Before:

The "%s" service is private, getting it from the container is deprecated since
Symfony 3.2 and will fail in 4.0. You should either make the service public, or
preferably eg implement ServiceSubscriberInterface or use any other dependency
injection method instead of using the container at all.

After:

The "%s" service is private, getting it from the container is deprecated since
Symfony 3.2 and will fail in 4.0. You should either make the service public or
stop getting services directly from the container (instead, implement
ServiceSubscriberInterface or use other dependency injection methods).

Copy link
Member

Choose a reason for hiding this comment

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

I would not mention ServiceSubscriberInterface here as this is just one example amongst many other ones.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated, better?

@nicolas-grekas nicolas-grekas force-pushed the di-better-deprec branch 2 times, most recently from 9f18291 to 2cc8592 Compare October 4, 2017 15:47
@@ -282,7 +282,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
// calling $this->normalizeId($id) unless necessary.
for ($i = 2;;) {
if (isset($this->privates[$id])) {
@trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public or stop getting services directly from the container and use any dependency injection methods instead.', $id), E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's "any method", not "any methods" because only one of the methods should be used, not several at once.

@fabpot
Copy link
Member

fabpot commented Oct 5, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 3e80760 into symfony:3.3 Oct 5, 2017
fabpot added a commit that referenced this pull request Oct 5, 2017
This PR was merged into the 3.3 branch.

Discussion
----------

[DI] Improve some deprecation messages

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

To improve DX.

Commits
-------

3e80760 [DI] Improve some deprecation messages
@nicolas-grekas nicolas-grekas deleted the di-better-deprec branch October 5, 2017 16:37
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.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.