migration symfony 5 4 (#300)

* symfony 5.4 (diff dev)

* symfony 5.4 (working)

* symfony 5.4 (update autoload)

* symfony 5.4 (remove swiftmailer mailer implementation)

* symfony 5.4 (php doc and split Global accessor class)


### Impacted packages:

composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies

composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
bdalsass
2022-06-16 09:13:24 +02:00
committed by GitHub
parent abb13b70b9
commit 79da71ecf8
2178 changed files with 87439 additions and 59451 deletions

View File

@@ -12,56 +12,46 @@
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
/**
* Generates the router matcher and generator classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since version 3.4
* @final
*/
class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
protected $router;
private $container;
/**
* @param ContainerInterface $container
*/
public function __construct($container)
public function __construct(ContainerInterface $container)
{
// As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
if ($container instanceof ContainerInterface) {
$this->router = $container->get('router'); // For BC, the $router property must be populated in the constructor
} elseif ($container instanceof RouterInterface) {
$this->router = $container;
@trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', RouterInterface::class, __CLASS__, ContainerInterface::class), \E_USER_DEPRECATED);
} else {
throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
}
$this->container = $container;
}
/**
* Warms up the cache.
*
* @param string $cacheDir The cache directory
* {@inheritdoc}
*/
public function warmUp($cacheDir)
public function warmUp(string $cacheDir): array
{
if ($this->router instanceof WarmableInterface) {
$this->router->warmUp($cacheDir);
$router = $this->container->get('router');
if ($router instanceof WarmableInterface) {
return (array) $router->warmUp($cacheDir);
}
throw new \LogicException(sprintf('The router "%s" cannot be warmed up because it does not implement "%s".', get_debug_type($router), WarmableInterface::class));
}
/**
* Checks whether this warmer is optional or not.
*
* @return bool always true
* {@inheritdoc}
*/
public function isOptional()
public function isOptional(): bool
{
return true;
}
@@ -69,7 +59,7 @@ class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterf
/**
* {@inheritdoc}
*/
public static function getSubscribedServices()
public static function getSubscribedServices(): array
{
return [
'router' => RouterInterface::class,