Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #27879 [Routing] deprecate non string requirement names (xabbuh)
This PR was merged into the 4.2-dev branch. Discussion ---------- [Routing] deprecate non string requirement names | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Basically, this will help catching wrong `@Route` annotation configurations like the following which can lead to hard to debug issues: ```php @route("/{foo}", requirements={"foo", "bar"}) ``` Commits ------- 8bb5266 deprecate non string requirement names
- Loading branch information
Showing
6 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...outing/Tests/Fixtures/AnnotationFixtures/RequirementsWithoutPlaceholderNameController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures; | ||
|
||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
/** | ||
* @Route("/", requirements={"foo", "\d+"}) | ||
*/ | ||
class RequirementsWithoutPlaceholderNameController | ||
{ | ||
/** | ||
* @Route("/{foo}", name="foo", requirements={"foo", "\d+"}) | ||
*/ | ||
public function foo() | ||
{ | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/Symfony/Component/Routing/Tests/Fixtures/requirements_without_placeholder_name.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
foo: | ||
path: '/{foo}' | ||
requirements: | ||
- '\d+' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters