Skip to content

Commit 643cced

Browse files
authored
Merge pull request #313 from monojp/fix-deprecation
Fix Symfony 5.1 deprecation
2 parents 44760c6 + b40f121 commit 643cced

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Bundle/JoseFramework/Resources/config/jku_source.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Jose\Component\KeyManagement;
1515
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
1616
use function Symfony\Component\DependencyInjection\Loader\Configurator\ref;
17+
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
18+
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
1719

1820
return function (ContainerConfigurator $container): void {
1921
$container = $container->services()->defaults()
@@ -22,19 +24,25 @@
2224
->autowire()
2325
;
2426

27+
$serviceClosure = static function (string $serviceId): ReferenceConfigurator {
28+
return function_exists('Symfony\Component\DependencyInjection\Loader\Configurator\service')
29+
? service($serviceId)
30+
: ref($serviceId);
31+
};
32+
2533
$container->set(KeyManagement\JKUFactory::class)
2634
->public()
2735
->args([
28-
ref('jose.http_client'),
29-
ref('jose.request_factory'),
36+
($serviceClosure)('jose.http_client'),
37+
($serviceClosure)('jose.request_factory'),
3038
])
3139
;
3240

3341
$container->set(KeyManagement\X5UFactory::class)
3442
->public()
3543
->args([
36-
ref('jose.http_client'),
37-
ref('jose.request_factory'),
44+
($serviceClosure)('jose.http_client'),
45+
($serviceClosure)('jose.request_factory'),
3846
])
3947
;
4048
};

0 commit comments

Comments
 (0)