Skip to content

Commit 71fed8c

Browse files
Merge branch '2.3' into 2.7
* 2.3: Clean wrong whitespaces [travis] Build phpunit with local components do not remove space between attributes [HttpFoundation] fixed the check of 'proxy-revalidate' in Response::mustRevalidate() Fix the retrieval of the default value for variadic arguments Annotated routes with a variadic parameter Fixing DbalSessionHandler to work with a Oracle "limitation" or bug? Update EngineInterface.php let Travis builds fail when PHP 7 jobs fail Conflicts: .travis.yml src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
2 parents ea9134f + fbadda8 commit 71fed8c

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

Loader/AnnotationClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
139139

140140
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
141141
foreach ($method->getParameters() as $param) {
142-
if (!isset($defaults[$param->getName()]) && $param->isOptional()) {
142+
if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
143143
$defaults[$param->getName()] = $param->getDefaultValue();
144144
}
145145
}
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 <[email protected]>
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\OtherAnnotatedClasses;
13+
14+
class VariadicClass
15+
{
16+
public function routeAction(...$params)
17+
{
18+
}
19+
}

Tests/Loader/AnnotationClassLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
1717
{
1818
protected $loader;
19+
private $reader;
1920

2021
protected function setUp()
2122
{

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(array('path' => '/path/to/{id}'));
44+
$this->reader->expects($this->once())->method('getClassAnnotation');
45+
$this->reader->expects($this->once())->method('getMethodAnnotations')
46+
->will($this->returnValue(array($route)));
47+
48+
$this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php');
49+
}
50+
3751
public function testSupports()
3852
{
3953
$fixture = __DIR__.'/../Fixtures/annotated.php';

0 commit comments

Comments
 (0)