10000 change exception to better indicate purpose · symfony/symfony@c005615 · GitHub
[go: up one dir, main page]

Skip to content

Commit c005615

Browse files
committed
change exception to better indicate purpose
1 parent 54cb1af commit c005615

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Symfony/Component/Routing/RouteCompiler.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ class RouteCompiler implements RouteCompilerInterface
3131
/**
3232
* {@inheritdoc}
3333
*
34-
* @throws \LogicException If a variable is referenced more than once
35-
* @throws \DomainException If a variable name is numeric because PHP raises an error for such
36-
* subpatterns in PCRE and thus would break matching, e.g. "(?P<123>.+)".
34+
* @throws \InvalidArgumentException If a path variable is named _fragment
35+
* @throws \LogicException If a variable is referenced more than once
36+
* @throws \DomainException If a variable name is numeric because PHP raises an error for such
37+
* subpatterns in PCRE and thus would break matching, e.g. "(?P<123>.+)".
3738
*/
3839
public static function compile(Route $route)
3940
{
@@ -62,7 +63,7 @@ public static function compile(Route $route)
6263

6364
foreach ($pathVariables as $pathParam) {
6465
if ('_fragment' === $pathParam) {
65-
throw new \LogicException(sprintf('Route pattern "%s" cannot contain "_fragment" as a path parameter.', $route->getPath()));
66+
throw new \InvalidArgumentException(sprintf('Route pattern "%s" cannot contain "_fragment" as a path parameter.', $route->getPath()));
6667
}
6768
}
6869

src/Symfony/Component/Routing/Tests/RouteCompilerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function testRouteWithSameVariableTwice()
162162
}
163163

164164
/**
165-
* @expectedException \LogicException
165+
* @expectedException \InvalidArgumentException
166166
*/
167167
public function testRouteWithFragmentAsPathParameter()
168168
{

0 commit comments

Comments
 (0)
0