Skip to content

Commit

Permalink
bug #32563 Container*::getServiceIds() should return strings (mathroc)
Browse files Browse the repository at this point in the history
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 | #32549
| License       | MIT

Cast services ids to string in `Container*::getServiceIds()`

Commits
-------

9c88caa Container*::getServiceIds() should return an array of string
  • Loading branch information
fabpot committed Jul 17, 2019
2 parents e5bd6ff + 9c88caa commit 04b9ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/DependencyInjection/Container.php
Expand Up @@ -386,7 +386,7 @@ public function reset()
/**
* Gets all service ids.
*
* @return array An array of all defined service ids
* @return string[] An array of all defined service ids
*/
public function getServiceIds()
{
Expand All @@ -405,7 +405,7 @@ public function getServiceIds()
}
$ids[] = 'service_container';

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

/**
Expand Down
Expand Up @@ -815,13 +815,11 @@ public function compile(/*$resolveEnvPlaceholders = false*/)
}

/**
* Gets all service ids.
*
* @return array An array of all defined service ids
* {@inheritdoc}
*/
public function getServiceIds()
{
return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()));
return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())));
}

/**
Expand Down

0 comments on commit 04b9ce3

Please sign in to comment.