Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6580a49

Browse filesBrowse 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
Copy full SHA for 6580a49

File tree

Expand file treeCollapse file tree

20 files changed

+121
-56
lines changed
Filter options
Expand file treeCollapse file tree

20 files changed

+121
-56
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/RoutingExtension.php
+14Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/QuestionHelper.php
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/Table.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/TableTest.php
+14-14Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
+4Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
+26Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
+31Lines 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
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
;
6868
$container
6969
->register('baz', 'Baz')
70-
->addMethodCall('setFoo', array(new Reference('foo_with_inline')))
7170
;
7271
$container
7372
->register('request', 'Request')

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ digraph sc {
4646
node_method_call1 -> node_foobaz [label="setBar()" style="dashed"];
4747
node_foo_with_inline -> node_inlined [label="setBar()" style="dashed"];
4848
node_inlined -> node_baz [label="setBaz()" style="dashed"];
49-
node_baz -> node_foo_with_inline [label="setFoo()" style="dashed"];
5049
node_configurator_service -> node_baz [label="setFoo()" style="dashed"];
5150
node_lazy_context -> node_foo_baz [label="" style="filled" color="#9999ff"];
5251
node_lazy_context -> node_service_container [label="" style="filled" color="#9999ff"];

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ protected function getBarService()
9898
*/
9999
protected function getBazService()
100100
{
101-
$this->services['baz'] = $instance = new \Baz();
102-
103-
$instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->get('foo_with_inline')) && false ?: '_'});
104-
105-
return $instance;
101+
return $this->services['baz'] = new \Baz();
106102
}
107103

108104
/**

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ protected function getBarService()
104104
*/
105105
protected function getBazService()
106106
{
107-
$this->services['baz'] = $instance = new \Baz();
108-
109-
$instance->setFoo(${($_ = isset($this->services['foo_with_inline']) ? $this->services['foo_with_inline'] : $this->get('foo_with_inline')) && false ?: '_'});
110-
111-
return $instance;
107+
return $this->services['baz'] = new \Baz();
112108
}
113109

114110
/**
@@ -294,12 +290,11 @@ protected function getFooBarService()
294290
protected function getFooWithInlineService()
295291
{
296292
$a = new \Bar();
297-
298-
$this->services['foo_with_inline'] = $instance = new \Foo();
299-
300293
$a->pub = 'pub';
301294
$a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->get('baz')) && false ?: '_'});
302295

296+
$this->services['foo_with_inline'] = $instance = new \Foo();
297+
303298
$instance->setBar($a);
304299

305300
return $instance;

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@
7070
<argument type="service" id="baz"/>
7171
</call>
7272
</service>
73-
<service id="baz" class="Baz">
74-
<call method="setFoo">
75-
<argument type="service" id="foo_with_inline"/>
76-
</call>
77-
</service>
73+
<service id="baz" class="Baz"/>
7874
<service id="request" class="Request" synthetic="true"/>
7975
<service id="configurator_service" class="ConfClass" public="false">
8076
<call method="setFoo">

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ services:
5252

5353
baz:
5454
class: Baz
55-
calls:
56-
- [setFoo, ['@foo_with_inline']]
5755

5856
request:
5957
class: Request

‎src/Symfony/Component/Process/ExecutableFinder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/ExecutableFinder.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function find($name, $default = null, array $extraDirs = array())
7575
$suffixes = array('');
7676
if ('\\' === DIRECTORY_SEPARATOR) {
7777
$pathExt = getenv('PATHEXT');
78-
$suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
78+
$suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes);
7979
}
8080
foreach ($suffixes as $suffix) {
8181
foreach ($dirs as $dir) {

‎src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ public function __construct(array $attributes = null, $lowerCamelCase = true)
4444
public function normalize($propertyName)
4545
{
4646
if (null === $this->attributes || in_array($propertyName, $this->attributes)) {
47+
$lcPropertyName = lcfirst($propertyName);
4748
$snakeCasedName = '';
4849

49-
$len = strlen($propertyName);
50+
$len = strlen($lcPropertyName);
5051
for ($i = 0; $i < $len; ++$i) {
51-
if (ctype_upper($propertyName[$i])) {
52-
$snakeCasedName .= '_'.strtolower($propertyName[$i]);
52+
if (ctype_upper($lcPropertyName[$i])) {
53+
$snakeCasedName .= '_'.strtolower($lcPropertyName[$i]);
5354
} else {
54-
$snakeCasedName .= strtolower($propertyName[$i]);
55+
$snakeCasedName .= strtolower($lcPropertyName[$i]);
5556
}
5657
}
5758

‎src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php
+12-9Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,30 @@ public function testInterface()
2727
/**
2828
* @dataProvider attributeProvider
2929
*/
30-
public function testNormalize($underscored, $lowerCamelCased)
30+
public function testNormalize($underscored, $camelCased, $useLowerCamelCase)
3131
{
32-
$nameConverter = new CamelCaseToSnakeCaseNameConverter();
33-
$this->assertEquals($nameConverter->normalize($lowerCamelCased), $underscored);
32+
$nameConverter = new CamelCaseToSnakeCaseNameConverter(null, $useLowerCamelCase);
33+
$this->assertEquals($nameConverter->normalize($camelCased), $underscored);
3434
}
3535

3636
/**
3737
* @dataProvider attributeProvider
3838
*/
39-
public function testDenormalize($underscored, $lowerCamelCased)
39+
public function testDenormalize($underscored, $camelCased, $useLowerCamelCase)
4040
{
41-
$nameConverter = new CamelCaseToSnakeCaseNameConverter();
42-
$this->assertEquals($nameConverter->denormalize($underscored), $lowerCamelCased);
41+
$nameConverter = new CamelCaseToSnakeCaseNameConverter(null, $useLowerCamelCase);
42+
$this->assertEquals($nameConverter->denormalize($underscored), $camelCased);
4343
}
4444

4545
public function attributeProvider()
4646
{
4747
return array(
48-
array('coop_tilleuls', 'coopTilleuls'),
49-
array('_kevin_dunglas', '_kevinDunglas'),
50-
array('this_is_a_test', 'thisIsATest'),
48+
array('coop_tilleuls', 'coopTilleuls', true),
49+
array('_kevin_dunglas', '_kevinDunglas', true),
50+
array('this_is_a_test', 'thisIsATest', true),
51+
array('coop_tilleuls', 'CoopTilleuls', false),
52+
array('_kevin_dunglas', '_kevinDunglas', false),
53+
array('this_is_a_test', 'ThisIsATest', false),
5154
);
5255
}
5356
}

‎src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Dumper/CliDumper.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public function dumpScalar(Cursor $cursor, $type, $value)
127127
$style = 'num';
128128

129129
switch (true) {
130-
case INF === $value: $value = 'INF'; break;
130+
case INF === $value: $value = 'INF'; break;
131131
case -INF === $value: $value = '-INF'; break;
132-
case is_nan($value): $value = 'NAN'; break;
132+
case is_nan($value): $value = 'NAN'; break;
133133
default:
134134
$value = (string) $value;
135135
if (false === strpos($value, $this->decimalPoint)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.