Skip to content

Commit b175857

Browse files
committed
Merge branch '2.8' into 3.1
* 2.8: [FrameworkBundle] Fix Incorrect line break in exception message (500 debug page) [Security] Added note inside phpdoc. Minor cleanups and improvements [form] lazy trans `post_max_size_message`. [DI] Fix setting synthetic services on ContainerBuilder [ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1)
2 parents 5741aaa + 0a732a9 commit b175857

File tree

9 files changed

+28
-31
lines changed

9 files changed

+28
-31
lines changed

Compiler/RepeatedPass.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,12 @@ public function __construct(array $passes)
5656
*/
5757
public function process(ContainerBuilder $container)
5858
{
59-
$this->repeat = false;
60-
foreach ($this->passes as $pass) {
61-
$pass->process($container);
62-
}
63-
64-
if ($this->repeat) {
65-
$this->process($container);
66-
}
59+
do {
60+
$this->repeat = false;
61+
foreach ($this->passes as $pass) {
62+
$pass->process($container);
63+
}
64+
} while ($this->repeat);
6765
}
6866

6967
/**

ContainerBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ public function set($id, $service)
341341
{
342342
$id = strtolower($id);
343343

344-
if ($this->isFrozen() && (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic())) {
344+
if ($this->isFrozen() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) {
345+
// setting a synthetic service on a frozen container is alright
345346
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a frozen container is not allowed.', $id));
346347
}
347348

Dumper/GraphvizDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private function addEdges()
128128
*
129129
* @return array An array of edges
130130
*/
131-
private function findEdges($id, $arguments, $required, $name)
131+
private function findEdges($id, array $arguments, $required, $name)
132132
{
133133
$edges = array();
134134
foreach ($arguments as $argument) {
@@ -241,7 +241,7 @@ private function endDot()
241241
*
242242
* @return string A comma separated list of attributes
243243
*/
244-
private function addAttributes($attributes)
244+
private function addAttributes(array $attributes)
245245
{
246246
$code = array();
247247
foreach ($attributes as $k => $v) {
@@ -258,7 +258,7 @@ private function addAttributes($attributes)
258258
*
259259
* @return string A space separated list of options
260260
*/
261-
private function addOptions($options)
261+
private function addOptions(array $options)
262262
{
263263
$code = array();
264264
foreach ($options as $k => $v) {

Dumper/PhpDumper.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private function addServiceReturn($id, $definition)
374374
* @throws InvalidArgumentException
375375
* @throws RuntimeException
376376
*/
377-
private function addServiceInstance($id, $definition)
377+
private function addServiceInstance($id, Definition $definition)
378378
{
379379
$class = $definition->getClass();
380380

@@ -422,7 +422,7 @@ private function addServiceInstance($id, $definition)
422422
*
423423
* @return bool
424424
*/
425-
private function isSimpleInstance($id, $definition)
425+
private function isSimpleInstance($id, Definition $definition)
426426
{
427427
foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) {
428428
if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) {
@@ -446,7 +446,7 @@ private function isSimpleInstance($id, $definition)
446446
*
447447
* @return string
448448
*/
449-
private function addServiceMethodCalls($id, $definition, $variableName = 'instance')
449+
private function addServiceMethodCalls($id, Definition $definition, $variableName = 'instance')
450450
{
451451
$calls = '';
452452
foreach ($definition->getMethodCalls() as $call) {
@@ -461,7 +461,7 @@ private function addServiceMethodCalls($id, $definition, $variableName = 'instan
461461
return $calls;
462462
}
463463

464-
private function addServiceProperties($id, $definition, $variableName = 'instance')
464+
private function addServiceProperties($id, Definition $definition, $variableName = 'instance')
465465
{
466466
$code = '';
467467
foreach ($definition->getProperties() as $name => $value) {
@@ -481,7 +481,7 @@ private function addServiceProperties($id, $definition, $variableName = 'instanc
481481
*
482482
* @throws ServiceCircularReferenceException when the container contains a circular reference
483483
*/
484-
private function addServiceInlinedDefinitionsSetup($id, $definition)
484+
private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
485485
{
486486
$this->referenceVariables[$id] = new Variable('instance');
487487

@@ -525,7 +525,7 @@ private function addServiceInlinedDefinitionsSetup($id, $definition)
525525
*
526526
* @return string
527527
*/
528-
private function addServiceConfigurator($id, $definition, $variableName = 'instance')
528+
private function addServiceConfigurator($id, Definition $definition, $variableName = 'instance')
529529
{
530530
if (!$callable = $definition->getConfigurator()) {
531531
return '';
@@ -561,7 +561,7 @@ private function addServiceConfigurator($id, $definition, $variableName = 'insta
561561
*
562562
* @return string
563563
*/
564-
private function addService($id, $definition)
564+
private function addService($id, Definition $definition)
565565
{
566566
$this->definitionVariables = new \SplObjectStorage();
567567
$this->referenceVariables = array();
@@ -1032,7 +1032,7 @@ protected function getDefaultParameters()
10321032
*
10331033
* @throws InvalidArgumentException
10341034
*/
1035-
private function exportParameters($parameters, $path = '', $indent = 12)
1035+
private function exportParameters(array $parameters, $path = '', $indent = 12)
10361036
{
10371037
$php = array();
10381038
foreach ($parameters as $key => $value) {

Dumper/XmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private function addServices(\DOMElement $parent)
271271
* @param \DOMElement $parent
272272
* @param string $keyAttribute
273273
*/
274-
private function convertParameters($parameters, $type, \DOMElement $parent, $keyAttribute = 'key')
274+
private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key')
275275
{
276276
$withKeys = array_keys($parameters) !== range(0, count($parameters) - 1);
277277
foreach ($parameters as $key => $value) {
@@ -317,7 +317,7 @@ private function convertParameters($parameters, $type, \DOMElement $parent, $key
317317
*
318318
* @return array
319319
*/
320-
private function escape($arguments)
320+
private function escape(array $arguments)
321321
{
322322
$args = array();
323323
foreach ($arguments as $k => $v) {

Dumper/YamlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private function getExpressionCall($expression)
307307
*
308308
* @return array
309309
*/
310-
private function prepareParameters($parameters, $escape = true)
310+
private function prepareParameters(array $parameters, $escape = true)
311311
{
312312
$filtered = array();
313313
foreach ($parameters as $key => $value) {
@@ -330,7 +330,7 @@ private function prepareParameters($parameters, $escape = true)
330330
*
331331
* @return array
332332
*/
333-
private function escape($arguments)
333+
private function escape(array $arguments)
334334
{
335335
$args = array();
336336
foreach ($arguments as $k => $v) {

Loader/YamlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,9 @@ private function resolveServices($value)
425425
{
426426
if (is_array($value)) {
427427
$value = array_map(array($this, 'resolveServices'), $value);
428-
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
428+
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
429429
return new Expression(substr($value, 2));
430-
} elseif (is_string($value) && 0 === strpos($value, '@')) {
430+
} elseif (is_string($value) && 0 === strpos($value, '@')) {
431431
if (0 === strpos($value, '@@')) {
432432
$value = substr($value, 1);
433433
$invalidBehavior = null;

Tests/ContainerBuilderTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,14 +626,12 @@ public function testThrowsExceptionWhenSetServiceOnAFrozenContainer()
626626
$container->set('a', new \stdClass());
627627
}
628628

629-
/**
630-
* @expectedException \BadMethodCallException
631-
*/
632629
public function testThrowsExceptionWhenAddServiceOnAFrozenContainer()
633630
{
634631
$container = new ContainerBuilder();
635632
$container->compile();
636-
$container->set('a', new \stdClass());
633+
$container->set('a', $foo = new \stdClass());
634+
$this->assertSame($foo, $container->get('a'));
637635
}
638636

639637
public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer()

Tests/ContainerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testGetCircularReference()
210210

211211
/**
212212
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
213-
* @expectedExcepionMessage You have requested a synthetic service ("request"). The DIC does not know how to construct this service.
213+
* @expectedExceptionMessage You have requested a synthetic service ("request"). The DIC does not know how to construct this service.
214214
*/
215215
public function testGetSyntheticServiceAlwaysThrows()
216216
{

0 commit comments

Comments
 (0)