10000 Merge branch '3.2' · symfony/symfony@6580a49 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6580a49

Browse files
committed
Merge branch '3.2'
* 3.2: Permit empty suffix on Windows fixed CS [FrameworkBundle] Remove unused import [Console][Table] fixed render when using multiple rowspans. add docblocks for Twig url and path function to improve ide completion check for circular refs caused by method calls [Serializer] fix upper camel case conversion (see #21399) [DI] Auto register extension configuration classes as a resource [Console] Updated phpdoc on return types
2 parents 3860b0b + b3ba37d commit 6580a49

File tree

20 files changed

+121
-56
lines changed

20 files changed

+121
-56
lines changed

src/Symfony/Bridge/Twig/Extension/RoutingExtension.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,25 @@ public function getFunctions()
4040
);
4141
}
4242

43+
/**
44+
* @param string $name
45+
* @param array $parameters
46+
* @param bool $relative
47+
*
48+
* @return string
49+
*/
4350
public function getPath($name, $parameters = array(), $relative = false)
4451
{
4552
return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
4653
}
4754

55+
/**
56+
* @param string $name
57+
* @param array $parameters
58+
* @param bool $schemeRelative
59+
*
60+
* @return string
61+
*/
4862
public function getUrl($name, $parameters = array(), $schemeRelative = false)
4963
{
5064
return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
3636
use Symfony\Component\Workflow;
3737
use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy;
38-
use Symfony\Component\Yaml\Yaml;
3938
use Symfony\Component\Console\Application;
4039

4140
/**

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class QuestionHelper extends Helper
3939
* @param OutputInterface $output An OutputInterface instance
4040
* @param Question $question The question to ask
4141
*
42-
* @return string The user answer
42+
* @return mixed The user answer
4343
*
4444
* @throws RuntimeException If there is no data to read in the input stream
4545
*/
@@ -397,7 +397,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream)
397397
* @param OutputInterface $output An Output instance
398398
* @param Question $question A Question instance
399399
*
400-
* @return string The validated response
400+
* @return mixed The validated response
401401
*
402402
* @throws \Exception In case the max number of attempts has been reached and no valid response has been given
403403
*/

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change< 10000 /th>
@@ -479,6 +479,9 @@ private function fillNextRows($rows, $line)
479479
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
480480
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
481481
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
482+
if ($nbLines === $unmergedRowKey - $line) {
483+
break;
484+
}
482485
}
483486
}
484487
}

src/Symfony/Component/Console/Tests/Helper/TableTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -298,29 +298,29 @@ public function testRenderProvider()
298298
array(
299299
array(
300300
new TableCell('9971-5-0210-0', array('rowspan' => 3)),
301-
'Divine Comedy',
301+
new TableCell('Divine Comedy', array('rowspan' => 2)),
302302
'Dante Alighieri',
303303
),
304-
array('A Tale of Two Cities', 'Charles Dickens'),
304+
array(),
305305
array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"),
306306
new TableSeparator(),
307307
array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'),
308308
array('80-902734-1-7', 'Test'),
309309
),
310310
'default',
311311
<<<'TABLE'
312-
+---------------+----------------------+-----------------+
313-
| ISBN | Title | Author |
314-
+---------------+----------------------+-----------------+
315-
| 9971-5-0210-0 | Divine Comedy | Dante Alighieri |
316-
| | A Tale of Two Cities | Charles Dickens |
317-
| | The Lord of | J. R. |
318-
| | the Rings | R. Tolkien |
319-
+---------------+----------------------+-----------------+
320-
| 80-902734-1-6 | And Then | Agatha Christie |
321-
| 80-902734-1-7 | There | Test |
322-
| | Were None | |
323-
+---------------+----------------------+-----------------+
312+
+---------------+---------------+-----------------+
313+
| ISBN | Title | Author |
314+
+---------------+---------------+-----------------+
315+
| 9971-5-0210-0 | Divine Comedy | Dante Alighieri |
316+
| | | |
317+
| | The Lord of | J. R. |
318+
| | the Rings | R. Tolkien |
319+
+---------------+---------------+-----------------+
320+
| 80-902734-1-6 | And Then | Agatha Christie |
321+
| 80-902734-1-7 | There | Test |
322+
| | Were None | |
323+
+---------------+---------------+-----------------+
324324

325325
TABLE
326326
),

src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function () {},
255255

256256
// assertEquals() does not like NAN values.
257257
$this->assertEquals($array[$i][0], 'float');
258-
$this->assertTrue(is_nan($array[$i++][1]));
258+
$this->assertNan($array[$i++][1]);
259259
}
260260

261261
public function testRecursionInArguments()

src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php

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

1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
15+
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
1516
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
1617

1718
/**
@@ -47,6 +48,9 @@ public function process(ContainerBuilder $container)
4748
$tmpContainer = new ContainerBuilder($container->getParameterBag());
4849
$tmpContainer->setResourceTracking($container->isTrackingResources());
4950
$tmpContainer->addObjectResource($extension);
51+
if ($extension instanceof ConfigurationExtensionInterface && null !== $configuration = $extension->getConfiguration($config, $tmpContainer)) {
52+
$tmpContainer->addObjectResource($configuration);
53+
}
5054

5155
foreach ($exprLangProviders as $provider) {
5256
$tmpContainer->addExpressionLanguageProvider($provider);

src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function __construct()
7474
new RemoveUnusedDefinitionsPass(),
7575
)),
7676
new CheckExceptionOnInvalidReferenceBehaviorPass(),
77+
new CheckCircularReferencesPass(),
7778
));
7879
}
7980

src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,30 @@ public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDe
113113
$this->assertFalse($container->hasDefinition('b'));
114114
$this->assertFalse($container->hasDefinition('c'), 'Service C was not inlined.');
115115
}
116+
117+
/**
118+
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
119+
*/
120+
public function testCircularReferencesCausedByMethodCallsAreDetectedDuringCompilation()
121+
{
122+
$container = new ContainerBuilder();
123+
$container->setResourceTracking(false);
124+
125+
$container
126+
->register('foobar', '\stdClass')
127+
->addArgument(new Reference('foo'))
128+
;
129+
130+
$container
131+
->register('foo', '\stdClass')
132+
->addArgument(new Reference('bar'))
133+
;
134+
135+
$container
136+
->register('foo', '\stdClass')
137+
->addMethodCall('addFoobar', array(new Reference('foobar')))
138+
;
139+
140+
$container->compile();
141+
}
116142
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

14+
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15+
use Symfony\Component\Config\Definition\ConfigurationInterface;
16+
use Symfony\Component\Config\Resource\FileResource;
1417
use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass;
1518
use Symfony\Component\DependencyInjection\ContainerBuilder;
1619
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -48,4 +51,32 @@ public function testExpressionLanguageProviderForwarding()
4851

4952
$this->assertEquals(array($provider), $tmpProviders);
5053
}
54+
55+
public function testExtensionConfigurationIsTrackedByDefault()
56+
{
57+
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\Extension')->getMock();
58+
$extension->expects($this->once())
59+
->method('getConfiguration')
60+
->will($this->returnValue(new FooConfiguration()));
61+
$extension->expects($this->any())
62+
->method('getAlias')
63+
->will($this->returnValue('foo'));
64+
65+
$container = new ContainerBuilder(new ParameterBag());
66+
$container->registerExtension($extension);
67+
$container->prependExtensionConfig('foo', array('bar' => true));
68+
69+
$pass = new MergeExtensionConfigurationPass();
70+
$pass->process($container);
71+
72+
$this->assertContains(new FileResource(__FILE__), $container->getResources(), '', false, false);
73+
}
74+
}
75+
76+
class FooConfiguration implements ConfigurationInterface
77+
{
78+
public function getConfigTreeBuilder()
79+
{
80+
return new TreeBuilder();
81+
}
5182
}

0 commit comments

Comments
 (0)
0