Skip to content

Commit d4c8c3b

Browse files
author
Robin Chalas
committed
Merge branch '4.2'
* 4.2: properly fix tests on PHP 5 fix tests on PHP 5 remove doubled dot from exception message bug #29697 [DI] Fixed wrong factory method in exception (Wojciech Gorczyca) [Intl] make type-hinted arguments nullable [DI] Fixed wrong factory method in exception Changed gender choice types to color Fix unnecessary use remove no longer needed PHP version checks remove no longer needed PHP version checks Fixed groupBy argument value in DefaultChoiceListFactoryTest [HttpKernel] Correctly Render Signed URIs Containing Fragments [HttpFoundation] Fix request uri when it starts with double slashes
2 parents e1c5d25 + a28dda9 commit d4c8c3b

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

Compiler/ResolveNamedArgumentsPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ protected function processValue($value, $isRoot = false)
4949
if (null === $parameters) {
5050
$r = $this->getReflectionMethod($value, $method);
5151
$class = $r instanceof \ReflectionMethod ? $r->class : $this->currentId;
52+
$method = $r->getName();
5253
$parameters = $r->getParameters();
5354
}
5455

EnvVarProcessor.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection;
1313

1414
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
15-
use Symfony\Component\DependencyInjection\Exception\LogicException;
1615
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1716

1817
/**

Tests/Compiler/ResolveNamedArgumentsPassTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Reference;
1818
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
19+
use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes;
1920
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
2021
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsVariadicsDummy;
2122
use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy;
23+
use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1;
2224

2325
/**
2426
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -103,6 +105,7 @@ public function testClassNoConstructor()
103105

104106
/**
105107
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
108+
* @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "__construct()" has no argument named "$notFound". Check your service definition.
106109
*/
107110
public function testArgumentNotFound()
108111
{
@@ -115,6 +118,24 @@ public function testArgumentNotFound()
115118
$pass->process($container);
116119
}
117120

121+
/**
122+
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
123+
* @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1": method "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::createTestDefinition1()" has no argument named "$notFound". Check your service definition.
124+
*/
125+
public function testCorrectMethodReportedInException()
126+
{
127+
$container = new ContainerBuilder();
128+
129+
$container->register(FactoryDummyWithoutReturnTypes::class, FactoryDummyWithoutReturnTypes::class);
130+
131+
$definition = $container->register(TestDefinition1::class, TestDefinition1::class);
132+
$definition->setFactory(array(FactoryDummyWithoutReturnTypes::class, 'createTestDefinition1'));
133+
$definition->setArguments(array('$notFound' => '123'));
134+
135+
$pass = new ResolveNamedArgumentsPass();
136+
$pass->process($container);
137+
}
138+
118139
public function testTypedArgument()
119140
{
120141
$container = new ContainerBuilder();
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\DependencyInjection\Tests\Fixtures;
13+
14+
class FactoryDummyWithoutReturnTypes
15+
{
16+
public function createTestDefinition1()
17+
{
18+
}
19+
}

Tests/Fixtures/TestDefinition1.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

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+
312
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
413

514
use Symfony\Component\DependencyInjection\Definition;

0 commit comments

Comments
 (0)