Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af9920c

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 symfony#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 5c2cee5 + f272693 commit af9920c

File tree

21 files changed

+151
-45
lines changed

21 files changed

+151
-45
lines changed

.github/build-packages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs))));
1717

1818
$packages = array();
19-
$flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
19+
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
2020

2121
foreach ($dirs as $k => $dir) {
2222
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,16 @@ public static function getEventDispatchers()
163163

164164
public static function getCallables()
165165
{
166-
$callables = array(
166+
return array(
167167
'callable_1' => 'array_key_exists',
168168
'callable_2' => array('Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass', 'staticMethod'),
169169
'callable_3' => array(new CallableClass(), 'method'),
170170
'callable_4' => 'Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass::staticMethod',
171171
'callable_5' => array('Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'),
172172
'callable_6' => function () { return 'Closure'; },
173173
'callable_7' => new CallableClass(),
174+
'callable_from_callable' => \Closure::fromCallable(new CallableClass()),
174175
);
175-
176-
if (\PHP_VERSION_ID >= 70100) {
177-
$callables['callable_from_callable'] = \Closure::fromCallable(new CallableClass());
178-
}
179-
180-
return $callables;
181176
}
182177
}
183178

src/Symfony/Component/DependencyInjection/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

src/Symfony/Component/DependencyInjection/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
/**

src/Symfony/Component/DependencyInjection/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 <[email protected]>
@@ -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 <[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\DependencyInjection\Tests\Fixtures;
13+
14+
class FactoryDummyWithoutReturnTypes
15+
{
16+
public function createTestDefinition1()
17+
{
18+
}
19+
}

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

514
use Symfony\Component\DependencyInjection\Definition;

src/Symfony/Component/EventDispatcher/Tests/Debug/WrappedListenerTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,16 @@ public function testListenerDescription(callable $listener, $expected)
3030

3131
public function provideListenersToDescribe()
3232
{
33-
$listeners = array(
33+
return array(
3434
array(new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'),
3535
array(array(new FooListener(), 'listen'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'),
3636
array(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'),
3737
array('var_dump', 'var_dump'),
3838
array(function () {}, 'closure'),
39+
array(\Closure::fromCallable(array(new FooListener(), 'listen')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'),
40+
array(\Closure::fromCallable(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'),
41+
array(\Closure::fromCallable(function () {}), 'closure'),
3942
);
40-
41-
if (\PHP_VERSION_ID >= 70100) {
42-
$listeners[] = array(\Closure::fromCallable(array(new FooListener(), 'listen')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen');
43-
$listeners[] = array(\Closure::fromCallable(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic');
44-
$listeners[] = array(\Closure::fromCallable(function () {}), 'closure');
45-
}
46-
47-
return $listeners;
4843
}
4944
}
5045

src/Symfony/Component/Form/Forms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
* ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
2727
* ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
2828
* ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType')
29-
* ->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
30-
* 'choices' => array('Male' => 'm', 'Female' => 'f'),
29+
* ->add('color', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
30+
* 'choices' => array('Red' => 'r', 'Blue' => 'b'),
3131
* ))
3232
* ->getForm();
3333
*

src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public function testCreateViewFlatGroupByEmpty()
443443
array($this->obj2, $this->obj3),
444444
null, // label
445445
null, // index
446-
array() // ignored
446+
null // group
447447
);
448448

449449
$this->assertFlatView($view);

0 commit comments

Comments
 (0)