Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] make RequestStack parameter required #15196

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 1, 2015

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented Jul 3, 2015

Q A
Bug fix? no
New feature? no
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

Continuation of #14634, #8904

@Tobion Tobion force-pushed the required-request-stack branch 2 times, most recently from 7ed4189 to 6d6804e Compare July 3, 2015 21:46
<argument type="service" id="request_stack" />
<argument>%kernel.debug%</argument>
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why we need to change the order of arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because having required parameters after optional ones (with defaults) makes no sense.

Copy link
Member

Choose a reason for hiding this comment

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

But that works really well. As those classes are rarely used by the end user directly, I would avoid breaking BC here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If they are not used by end users, they would not be affected by the BC break since they rely on the service definition.

Copy link
Member

Choose a reason for hiding this comment

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

I'm sure you got my point. I'm not going to argue forever as there is no reasons to break BC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get it. There is a BC break anyway. In 2.x the RequestStack was optional. But in 3.0 it is required. The argument order is just a tiny detail. The BC break is there either way.

Copy link
Member

Choose a reason for hiding this comment

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

The Bc break is that existing code passing the RequestStack already (the recommended usage) would now break

Copy link
Member

Choose a reason for hiding this comment

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

@stof see (and vote for) #15724

@nicolas-grekas
Copy link
Member

I understand why the RequestStack is moved in front of optional arguments, but this misses a continuous upgrade path. Making this PR 2.8 compatible with deprecations notices would at least prevent people from not noticing the change.
Can't we remove some type hint and add dynamic argument swapping + deprecation in 2.8?

@nicolas-grekas
Copy link
Member

@Tobion can you please rebase this PR?

@fabpot
Copy link
Member

fabpot commented Sep 24, 2015

@Tobion Can you rebase this PR?

@fabpot
Copy link
Member

fabpot commented Sep 24, 2015

👍

@fabpot
Copy link
Member

fabpot commented Sep 24, 2015

ping @symfony/deciders

@dunglas
Copy link
Member

dunglas commented Sep 24, 2015

👍

@@ -24,6 +24,12 @@ CHANGELOG
* removed `Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategyInterface`
* removed `Symfony\Component\HttpKernel\Log\LoggerInterface`
* removed `Symfony\Component\HttpKernel\Log\NullLogger`
* made the `RequestStack` parameter required in the constructor of the following classes, which also changed the parameter order:
Copy link
Member

Choose a reason for hiding this comment

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

The order of the parameters was already changed for Symfony 2.8 and should therefore not be described here.

@xabbuh
Copy link
Member

xabbuh commented Sep 25, 2015

👍

@stof
Copy link
Member

stof commented Sep 25, 2015

We still need the rebase

@@ -24,7 +24,7 @@
"symfony/asset": "~2.8|~3.0",
"symfony/finder": "~2.8|~3.0",
"symfony/form": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0",
"symfony/http-kernel": "~3.0",
Copy link
Member

Choose a reason for hiding this comment

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

this change is not true anymore AFAICT. 2.8 will still be compatible

@fabpot
Copy link
Member

fabpot commented Sep 30, 2015

@Tobion Can you rebase?

@Tobion Tobion force-pushed the required-request-stack branch from 6d6804e to 2047545 Compare October 1, 2015 17:23
@Tobion Tobion force-pushed the required-request-stack branch from 2047545 to a2e154d Compare October 1, 2015 17:33
@Tobion
Copy link
Contributor Author

Tobion commented Oct 1, 2015

Rebased

@fabpot
Copy link
Member

fabpot commented Oct 1, 2015

Thank you @Tobion.

@fabpot fabpot merged commit a2e154d into symfony:master Oct 1, 2015
fabpot added a commit that referenced this pull request Oct 1, 2015
…ion)

This PR was merged into the 3.0-dev branch.

Discussion
----------

[HttpKernel] make RequestStack parameter required

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

Continuation of #14634, #8904

Commits
-------

a2e154d [HttpKernel] make RequestStack parameter required for classes that need it
@Tobion Tobion deleted the required-request-stack branch October 1, 2015 19:24
@fabpot fabpot mentioned this pull request Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants