Skip to content

Commit

Permalink
Throw exception for duplicate route names
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Mar 5, 2020
1 parent a3d0f07 commit 1008254
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Illuminate/Routing/AbstractRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Http\Response;
use Illuminate\Support\Str;
use IteratorAggregate;
use LogicException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
Expand Down Expand Up @@ -200,6 +201,8 @@ protected function addToSymfonyRoutesCollection(SymfonyRouteCollection $symfonyR
$route->name($name = $this->generateRouteName());

$this->add($route);
} elseif (! is_null($symfonyRoutes->get($name))) {
throw new LogicException("Unable to prepare route [{$route->uri}] for serialization. Has a duplicate name [{$name}].");
}

$symfonyRoutes->add($name, $route->toSymfonyRoute());
Expand Down

0 comments on commit 1008254

Please sign in to comment.