8000 Annotated routes with a variadic parameter · symfony/symfony@9b7d4c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b7d4c7

Browse files
wdalmutstof
authored andcommitted
Annotated routes with a variadic parameter
There are no variadic default values and that generate a fatal error.
1 parent 69171d4 commit 9b7d4c7

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
13+
14+
class VariadicClass
15+
{
16+
public function routeAction(...$params)
17+
{
18+
}
19+
}

src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
1515
use Symfony\Component\Config\FileLocator;
16+
use Symfony\Component\Routing\Annotation\Route;
1617

1718
class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
1819
{
@@ -34,6 +35,19 @@ public function testLoad()
3435
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
3536
}
3637

38+
/**
39+
* @requires PHP 5.6
40+
*/
41+
public function testLoadVariadic()
42+
{
43+
$route = new Route(["path" => "/path/to/{id}"]);
44+
$this->reader->expects($this->once())->method('getClassAnnotation');
45+
$this->reader->expects($this->once())->method('getMethodAnnotations')
46+
->will($this->returnValue([$route]));
47+
48+
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/VariadicClass.php');
49+
}
50+
3751
public function testSupports()
3852
{
3953
$fixture = __DIR__.'/../Fixtures/annotated.php';

0 commit comments

Comments
 (0)
0