Skip to content

Commit 4921306

Browse files
committed
Fix Symfony 7.0 deprecations in Kernel, MockTranslator and ProvideConsent
- Remove MockTranslator::transChoice() which was removed from TranslatorInterface in Symfony 6 and would throw a fatal error if called - Modernize Kernel::configureContainer() to the Symfony 7 MicroKernelTrait signature (ContainerConfigurator, LoaderInterface, ContainerBuilder), replacing $loader->load() glob calls with $container->import() and dropping the now-redundant FileResource/addResource tracking - Remove dead null-guard on Request::getSession() in ProvideConsent; Symfony 7 throws SessionNotFoundException instead of returning null
1 parent 508fd28 commit 4921306

3 files changed

Lines changed: 6 additions & 17 deletions

File tree

library/EngineBlock/Corto/Module/Service/ProvideConsent.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ public function serve($serviceName, Request $httpRequest)
139139
$authenticationState = $this->_authenticationStateHelper->getAuthenticationState();
140140

141141
$session = $httpRequest->getSession();
142-
if($session === null){
143-
throw new EngineBlock_Exception('Discovery override failure: No session available.');
144-
}
145142
$idpDiscovery = $this->discoverySelectionService->getDiscoveryFromRequest($session, $identityProvider);
146143

147144

src/Kernel.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
2222
use Symfony\Component\Config\Loader\LoaderInterface;
23-
use Symfony\Component\Config\Resource\FileResource;
2423
use Symfony\Component\DependencyInjection\ContainerBuilder;
24+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2525
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
2626
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
2727
use function dirname;
@@ -47,16 +47,14 @@ public function getProjectDir(): string
4747
return dirname(__DIR__);
4848
}
4949

50-
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
50+
protected function configureContainer(ContainerConfigurator $container, LoaderInterface $loader, ContainerBuilder $builder): void
5151
{
52-
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
53-
5452
$confDir = $this->getProjectDir().'/config';
5553

56-
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
57-
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
58-
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
59-
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
54+
$container->import($confDir.'/{packages}/*'.self::CONFIG_EXTS);
55+
$container->import($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS);
56+
$container->import($confDir.'/{services}'.self::CONFIG_EXTS);
57+
$container->import($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS);
6058
}
6159

6260
protected function configureRoutes(RoutingConfigurator $routes): void

src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockTranslator.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ public function trans(string $id, array $parameters = [], ?string $domain = null
6464
return $this->translator->trans($id, $parameters, $domain, $locale);
6565
}
6666

67-
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
68-
{
69-
$this->translator->getCatalogue($locale)->add($this->translations);
70-
return $this->translator->transChoice($id, $number, $parameters, $domain, $locale);
71-
}
72-
7367
public function setLocale(string $locale): void
7468
{
7569
$this->translator->setLocale($locale);

0 commit comments

Comments
 (0)