-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Deprecate scope concept #14984
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
[DependencyInjection] Deprecate scope concept #14984
Conversation
You need to make sure that core code does not trigger such deprecation though (for the and the loaders should trigger their own deprecations when using |
@stof The only cases in the core code are the |
@dosten As you can see on Travis, there are still many tests that need to be moved as legacy ones. For the |
@fabpot Thank you for your feedback, I didn't have enough time to continue with this PR. I'll work on this soon. |
I've added a initial implementation of a |
I can't trigger an error on the methods of the |
@dosten I was indeed refering to the old |
|
@fabpot This PR is ready to be reviewed. |
👍 good job |
*/ | ||
public function setShared($shared) | ||
{ | ||
$this->shared = (bool) $shared; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to cast here? The docblock is explicit about the expected type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually cast in the other methods of the Definition
class
👍 |
@fabpot Comments addressed |
Thank you @dosten. |
This PR was merged into the 2.8 branch. Discussion ---------- [DependencyInjection] Deprecate scope concept | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | License | MIT This PR mark as deprecated the concept of scopes in the DI container. See #10557 (comment). Also adds a new `shared` flag to the service definitions in replacement of the `prototype` scope. Commits ------- 6c4a676 Add "shared" flag and deprecate scopes concept
if (isset($service['scope'])) { | ||
$definition->setScope($service['scope']); | ||
if ('request' !== $id) { | ||
@trigger_error(sprintf('The "scope" key in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', $file), E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the deprecation message should mention the service id IMO to make it easier to understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #15113
…outerJ) This PR was merged into the 2.8 branch. Discussion ---------- Added minimal cookbook article about the shared flag | Q | A | --- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#14984) | Applies to | 2.8+ | Fixed tickets | #5437 Commits ------- 943ee0c Added minimal cookbook article about shared
This PR mark as deprecated the concept of scopes in the DI container. See #10557 (comment).
Also adds a new
shared
flag to the service definitions in replacement of theprototype
scope.