Skip to content

Commit 6298bfa

Browse files
minor symfony#59277 [Security] Sync Security\ExpressionLanguage constructor with parent (kor3k)
This PR was merged into the 7.3 branch. Discussion ---------- [Security] Sync Security\ExpressionLanguage constructor with parent | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? |no | Issues | - | License | MIT change typehint array -> iterable in `\Symfony\Component\Security\Core\Authorization\ExpressionLanguage::__construct` Commits ------- e9a26fc Sync Security\ExpressionLanguage constructor with parent
2 parents fa602c7 + e9a26fc commit 6298bfa

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)