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

[DI] Turn services and aliases private by default, with BC layer #24238

Merged
merged 1 commit into from Sep 19, 2017

Conversation

Projects
None yet
6 participants
@nicolas-grekas
Member

nicolas-grekas commented Sep 17, 2017

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

With this PR, all services and aliases are made private by default.
This is done in a BC way, thanks to the layer introduced in #24104.

We will require bundles to explicitly opt-in for "public", either using "defaults", or stating public="true" explicitly. Same in DI extension, where calling ->setPublic(true) will be required in 4.0.

@nicolas-grekas

This comment has been minimized.

Show comment
Hide comment
@nicolas-grekas

nicolas-grekas Sep 17, 2017

Member

(failure false-positive, known composer bug)

Member

nicolas-grekas commented Sep 17, 2017

(failure false-positive, known composer bug)

@@ -25,6 +25,7 @@ public function __construct($id, $public = true)
{
$this->id = (string) $id;
$this->public = $public;
$this->private = 2 > func_num_args();

This comment has been minimized.

@stof

stof Sep 18, 2017

Member

shouldn't this be $public && 2 > func_num_args() ?

If I register an alias as private explicitly, it does not need to have the BC layer keeping it from being inlined.

@stof

stof Sep 18, 2017

Member

shouldn't this be $public && 2 > func_num_args() ?

If I register an alias as private explicitly, it does not need to have the BC layer keeping it from being inlined.

This comment has been minimized.

@nicolas-grekas

nicolas-grekas Sep 18, 2017

Member

when "private" is set to true, the BC layer is enabled and triggers deprecations,
so here, we want it to be "false" when either true or false is passes.

@nicolas-grekas

nicolas-grekas Sep 18, 2017

Member

when "private" is set to true, the BC layer is enabled and triggers deprecations,
so here, we want it to be "false" when either true or false is passes.

This comment has been minimized.

@stof

stof Sep 18, 2017

Member

hmm sorry, I misunderstood the condition (reading too fast).

@stof

stof Sep 18, 2017

Member

hmm sorry, I misunderstood the condition (reading too fast).

@nicolas-grekas

This comment has been minimized.

Show comment
Hide comment
@nicolas-grekas

nicolas-grekas Sep 19, 2017

Member

Now with UPGRADE/CHANGELOG entries.

Member

nicolas-grekas commented Sep 19, 2017

Now with UPGRADE/CHANGELOG entries.

@fabpot

fabpot approved these changes Sep 19, 2017

@nicolas-grekas nicolas-grekas merged commit 9948b09 into symfony:3.4 Sep 19, 2017

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
fabbot.io Your code looks good.
Details

nicolas-grekas added a commit that referenced this pull request Sep 19, 2017

feature #24238 [DI] Turn services and aliases private by default, wit…
…h BC layer (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Turn services and aliases private by default, with BC layer

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

With this PR, all services and aliases are made private by default.
This is done in a BC way, thanks to the layer introduced in #24104.

We will require bundles to explicitly opt-in for "public", either using "defaults", or stating `public="true"` explicitly. Same in DI extension, where calling `->setPublic(true)` will be required in 4.0.

Commits
-------

9948b09 [DI] Turn services and aliases private by default, with BC layer

@nicolas-grekas nicolas-grekas deleted the nicolas-grekas:private-default branch Sep 19, 2017

nicolas-grekas added a commit that referenced this pull request Sep 19, 2017

bug #24266 [DI] Fix private-by-default BC layer (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Fix private-by-default BC layer

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

Spotted while merging 3.4 into master and by looking at the cross-versions CI.

Commits
-------

ff2ab58 [DI] Fix private-by-default BC layer

This was referenced Oct 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment