Skip to content

Commit e9a26fc

Browse files
kor3knicolas-grekas
authored andcommitted
Sync Security\ExpressionLanguage constructor with parent
change typehint array -> iterable
1 parent b23badd commit e9a26fc

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Symfony/Component/DependencyInjection/ExpressionLanguage.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@
2727
*/
2828
class ExpressionLanguage extends BaseExpressionLanguage
2929
{
30-
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [], ?callable $serviceCompiler = null, ?\Closure $getEnv = null)
30+
public function __construct(?CacheItemPoolInterface $cache = null, iterable $providers = [], ?callable $serviceCompiler = null, ?\Closure $getEnv = null)
3131
{
32+
if (!\is_array($providers)) {
33+
$providers = iterator_to_array($providers, false);
34+
}
35+
3236
// prepend the default provider to let users override it easily
3337
array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler, $getEnv));
3438

src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ class_exists(ExpressionLanguageProvider::class);
2929
*/
3030
class ExpressionLanguage extends BaseExpressionLanguage
3131
{
32-
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [])
32+
public function __construct(?CacheItemPoolInterface $cache = null, iterable $providers = [])
3333
{
34+
if (!\is_array($providers)) {
35+
$providers = iterator_to_array($providers, false);
36+
}
37+
3438
// prepend the default provider to let users override it easily
3539
array_unshift($providers, new ExpressionLanguageProvider());
3640

0 commit comments

Comments
 (0)