Skip to content

Commit 6b3755d

Browse files
Merge branch '3.1'
* 3.1: [travis/appveyor] Wire simple-phpunit [Console] fixed PHP7 Errors are now handled and converted to Exceptions Fix #19721 Fix translation:update command count bumped Symfony version to 2.8.12 updated VERSION for 2.8.11 updated CHANGELOG for 2.8.11 bumped Symfony version to 2.7.19 updated VERSION for 2.7.18 update CONTRIBUTORS for 2.7.18 updated CHANGELOG for 2.7.18 [Security] Optimize RoleHierarchy's buildRoleMap method [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 01b1dec + b175857 commit 6b3755d

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
@@ -351,7 +351,8 @@ public function set($id, $service)
351351
{
352352
$id = strtolower($id);
353353

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

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) {
@@ -244,7 +244,7 @@ private function endDot()
244244
*
245245
* @return string A comma separated list of attributes
246246
*/
247-
private function addAttributes($attributes)
247+
private function addAttributes(array $attributes)
248248
{
249249
$code = array();
250250
foreach ($attributes as $k => $v) {
@@ -261,7 +261,7 @@ private function addAttributes($attributes)
261261
*
262262
* @return string A space separated list of options
263263
*/
264-
private function addOptions($options)
264+
private function addOptions(array $options)
265265
{
266266
$code = array();
267267
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();
@@ -1063,7 +1063,7 @@ protected function getDefaultParameters()
10631063
*
10641064
* @throws InvalidArgumentException
10651065
*/
1066-
private function exportParameters($parameters, $path = '', $indent = 12)
1066+
private function exportParameters(array $parameters, $path = '', $indent = 12)
10671067
{
10681068
$php = array();
10691069
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
@@ -452,9 +452,9 @@ private function resolveServices($value)
452452
{
453453
if (is_array($value)) {
454454
$value = array_map(array($this, 'resolveServices'), $value);
455-
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
455+
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
456456
return new Expression(substr($value, 2));
457-
} elseif (is_string($value) && 0 === strpos($value, '@')) {
457+
} elseif (is_string($value) && 0 === strpos($value, '@')) {
458458
if (0 === strpos($value, '@@')) {
459459
$value = substr($value, 1);
460460
$invalidBehavior = null;

Tests/ContainerBuilderTest.php

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

711-
/**
712-
* @expectedException \BadMethodCallException
713-
*/
714711
public function testThrowsExceptionWhenAddServiceOnAFrozenContainer()
715712
{
716713
$container = new ContainerBuilder();
717714
$container->compile();
718-
$container->set('a', new \stdClass());
715+
$container->set('a', $foo = new \stdClass());
716+
$this->assertSame($foo, $container->get('a'));
719717
}
720718

721719
public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer()

Tests/ContainerTest.php

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

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

0 commit comments

Comments
 (0)