Skip to content

Commit ad44c46

Browse files
javiereguiluzfabpot
authored andcommitted
Minor cleanups and improvements
1 parent 9aa93ec commit ad44c46

File tree

6 files changed

+23
-25
lines changed

6 files changed

+23
-25
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
/**

Dumper/GraphvizDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private function addEdges()
130130
*
131131
* @return array An array of edges
132132
*/
133-
private function findEdges($id, $arguments, $required, $name)
133+
private function findEdges($id, array $arguments, $required, $name)
134134
{
135135
$edges = array();
136136
foreach ($arguments as $argument) {
@@ -246,7 +246,7 @@ private function endDot()
246246
*
247247
* @return string A comma separated list of attributes
248248
*/
249-
private function addAttributes($attributes)
249+
private function addAttributes(array $attributes)
250250
{
251251
$code = array();
252252
foreach ($attributes as $k => $v) {
@@ -263,7 +263,7 @@ private function addAttributes($attributes)
263263
*
264264
* @return string A space separated list of options
265265
*/
266-
private function addOptions($options)
266+
private function addOptions(array $options)
267267
{
268268
$code = array();
269269
foreach ($options as $k => $v) {

Dumper/PhpDumper.php

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

@@ -425,7 +425,7 @@ private function addServiceInstance($id, $definition)
425425
*
426426
* @return bool
427427
*/
428-
private function isSimpleInstance($id, $definition)
428+
private function isSimpleInstance($id, Definition $definition)
429429
{
430430
foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) {
431431
if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) {
@@ -449,7 +449,7 @@ private function isSimpleInstance($id, $definition)
449449
*
450450
* @return string
451451
*/
452-
private function addServiceMethodCalls($id, $definition, $variableName = 'instance')
452+
private function addServiceMethodCalls($id, Definition $definition, $variableName = 'instance')
453453
{
454454
$calls = '';
455455
foreach ($definition->getMethodCalls() as $call) {
@@ -464,7 +464,7 @@ private function addServiceMethodCalls($id, $definition, $variableName = 'instan
464464
return $calls;
465465
}
466466

467-
private function addServiceProperties($id, $definition, $variableName = 'instance')
467+
private function addServiceProperties($id, Definition $definition, $variableName = 'instance')
468468
{
469469
$code = '';
470470
foreach ($definition->getProperties() as $name => $value) {
@@ -484,7 +484,7 @@ private function addServiceProperties($id, $definition, $variableName = 'instanc
484484
*
485485
* @throws ServiceCircularReferenceException when the container contains a circular reference
486486
*/
487-
private function addServiceInlinedDefinitionsSetup($id, $definition)
487+
private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
488488
{
489489
$this->referenceVariables[$id] = new Variable('instance');
490490

@@ -528,7 +528,7 @@ private function addServiceInlinedDefinitionsSetup($id, $definition)
528528
*
529529
* @return string
530530
*/
531-
private function addServiceConfigurator($id, $definition, $variableName = 'instance')
531+
private function addServiceConfigurator($id, Definition $definition, $variableName = 'instance')
532532
{
533533
if (!$callable = $definition->getConfigurator()) {
534534
return '';
@@ -560,7 +560,7 @@ private function addServiceConfigurator($id, $definition, $variableName = 'insta
560560
*
561561
* @return string
562562
*/
563-
private function addService($id, $definition)
563+
private function addService($id, Definition $definition)
564564
{
565565
$this->definitionVariables = new \SplObjectStorage();
566566
$this->referenceVariables = array();
@@ -1124,7 +1124,7 @@ protected function getDefaultParameters()
11241124
*
11251125
* @throws InvalidArgumentException
11261126
*/
1127-
private function exportParameters($parameters, $path = '', $indent = 12)
1127+
private function exportParameters(array $parameters, $path = '', $indent = 12)
11281128
{
11291129
$php = array();
11301130
foreach ($parameters as $key => $value) {

Dumper/XmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ private function addServices(\DOMElement $parent)
262262
* @param \DOMElement $parent
263263
* @param string $keyAttribute
264264
*/
265-
private function convertParameters($parameters, $type, \DOMElement $parent, $keyAttribute = 'key')
265+
private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key')
266266
{
267267
$withKeys = array_keys($parameters) !== range(0, count($parameters) - 1);
268268
foreach ($parameters as $key => $value) {
@@ -311,7 +311,7 @@ private function convertParameters($parameters, $type, \DOMElement $parent, $key
311311
*
312312
* @return array
313313
*/
314-
private function escape($arguments)
314+
private function escape(array $arguments)
315315
{
316316
$args = array();
317317
foreach ($arguments as $k => $v) {

Dumper/YamlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function getExpressionCall($expression)
304304
*
305305
* @return array
306306
*/
307-
private function prepareParameters($parameters, $escape = true)
307+
private function prepareParameters(array $parameters, $escape = true)
308308
{
309309
$filtered = array();
310310
foreach ($parameters as $key => $value) {
@@ -327,7 +327,7 @@ private function prepareParameters($parameters, $escape = true)
327327
*
328328
* @return array
329329
*/
330-
private function escape($arguments)
330+
private function escape(array $arguments)
331331
{
332332
$args = array();
333333
foreach ($arguments as $k => $v) {

Loader/YamlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ private function resolveServices($value)
386386
{
387387
if (is_array($value)) {
388388
$value = array_map(array($this, 'resolveServices'), $value);
389-
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
389+
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
390390
return new Expression(substr($value, 2));
391-
} elseif (is_string($value) && 0 === strpos($value, '@')) {
391+
} elseif (is_string($value) && 0 === strpos($value, '@')) {
392392
if (0 === strpos($value, '@@')) {
393393
$value = substr($value, 1);
394394
$invalidBehavior = null;

0 commit comments

Comments
 (0)