Skip to content

Commit 04b9ce3

Browse files
committed
bug symfony#32563 Container*::getServiceIds() should return strings (mathroc)
This PR was merged into the 3.4 branch. Discussion ---------- Container*::getServiceIds() should return strings | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | o | Tests pass? | yes | Fixed tickets | symfony#32549 | License | MIT Cast services ids to string in `Container*::getServiceIds()` Commits ------- 9c88caa Container*::getServiceIds() should return an array of string
2 parents e5bd6ff + 9c88caa commit 04b9ce3

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Symfony/Component/DependencyInjection/Container.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public function reset()
386386
/**
387387
* Gets all service ids.
388388
*
389-
* @return array An array of all defined service ids
389+
* @return string[] An array of all defined service ids
390390
*/
391391
public function getServiceIds()
392392
{
@@ -405,7 +405,7 @@ public function getServiceIds()
405405
}
406406
$ids[] = 'service_container';
407407

408-
return array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services)));
408+
return array_map('strval', array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services))));
409409
}
410410

411411
/**

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,11 @@ public function compile(/*$resolveEnvPlaceholders = false*/)
815815
}
816816

817817
/**
818-
* Gets all service ids.
819-
*
820-
* @return array An array of all defined service ids
818+
* {@inheritdoc}
821819
*/
822820
public function getServiceIds()
823821
{
824-
return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()));
822+
return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())));
825823
}
826824

827825
/**

0 commit comments

Comments
 (0)