-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Hackday][2.7] Added deprecated notes to '_method' and '_scheme' route requirements #12719
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
Conversation
dcsg
commented
Nov 29, 2014
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | no |
Fixed tickets | [#12641, #12640] |
License | MIT |
Doc PR |
This one is tricky I decided to put the deprecations in YamlLoader and XmlLoader due to have it on stack trace to the user know what file is "broken". Also I added it in Route class because Plain PHP will instantiate it directly. This brokes a lot of tests, so now I need to know how do you want me to fix them. I can remove the |
Thanks for the info @xabbuh ;) |
@@ -131,6 +131,13 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p | |||
|
|||
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); | |||
|
|||
if (isset($requirements['_method']) || isset($requirements['_scheme'])) { | |||
trigger_error( | |||
'The router \'_method\' and \'_scheme\' requirements was removed. You should use the new \'methods\' and \'schemes\' settings instead.', |
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.
please format it this way:
trigger_error('Symfony\Component\HttpKernel\Debug\ErrorHandler is deprecated since version 2.3 and will be removed in 3.0. Use the same class from the Debug component instead.', 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.
Ok
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 requirements are not removed, they are deprecated
@@ -86,6 +86,13 @@ class Route implements \Serializable | |||
*/ | |||
public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '') | |||
{ | |||
if (isset($requirements['_method']) || isset($requirements['_scheme'])) { |
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.
this should be done in setRequirements
actually (given that the constructor calls it)
A few things to change here IMO:
@dcsg can you update your PR ? |
@stof I am a little busy this week, but I can try update it on weekend. Is that ok? |
yes it is |
@dcsg I'm finishing this PR. |
Closing in favor of #13361 which adds the triggers at different places. |
Ok thanks and sorry for the delay |
Thanks for your initiative to start this. |
…bion) This PR was merged into the 2.7 branch. Discussion ---------- [Routing] apply deprecation triggers and fix tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | [#12641, #12640, #12719] | License | MIT | Doc PR | Correctly add deprecation for _scheme and _method requirements and fix code to not trigger deprecations itself. And fix test so that they either explicitly test deprecated functionality or alternatively refactor tests to use new style. It also fixes the deprecation triggers for "pattern" which was not correctly done for YAML/XML loading. Commits ------- 9af0ff2 [FrameworkBundle] fix routing container param resolving to not access deprecated requirements while maintaining BC bd91867 [FrameworkBundle] remove superfluous test that is already covered in routing bc1c5c8 [Routing] apply deprecation triggers and fix tests