Skip to content

Commit

Permalink
Remove broken methods from Sylius < 1.3 old Kernel class (Sylius#13524)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmenozzi committed Jan 25, 2022
1 parent 55c7699 commit b477812
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 147 deletions.
8 changes: 0 additions & 8 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never",
"Symfony\\Bundle\\DebugBundle\\DebugBundle",
"Symfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle",
"Symfony\\Bundle\\WebServerBundle\\WebServerBundle",
"Doctrine\\Bundle\\DoctrineCacheBundle\\DoctrineCacheBundle",
"Doctrine\\Bundle\\FixturesBundle\\DoctrineFixturesBundle",
"Sonata\\CoreBundle\\SonataCoreBundle",
"Sonata\\IntlBundle\\SonataIntlBundle",
"PSS\\SymfonyMockerContainer\\DependencyInjection\\MockerContainer",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent",
"Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener",
"Swift_Message",
Expand Down
142 changes: 3 additions & 139 deletions src/Sylius/Bundle/CoreBundle/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,13 @@

namespace Sylius\Bundle\CoreBundle\Application;

use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
use Webmozart\Assert\Assert;

class Kernel extends HttpKernel
{
use MicroKernelTrait;

public const VERSION = '1.12.0-DEV';

public const VERSION_ID = '11200';
Expand All @@ -49,129 +38,4 @@ public function __construct(string $environment, bool $debug)

parent::__construct($environment, $debug);
}

public function registerBundles(): array
{
$bundles = [
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new \Symfony\Bundle\MonologBundle\MonologBundle(),
new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
new \Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new \Symfony\Bundle\TwigBundle\TwigBundle(),
new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),

new \Sylius\Bundle\OrderBundle\SyliusOrderBundle(),
new \Sylius\Bundle\MoneyBundle\SyliusMoneyBundle(),
new \Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle(),
new \Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(),
new \Sylius\Bundle\ProductBundle\SyliusProductBundle(),
new \Sylius\Bundle\ChannelBundle\SyliusChannelBundle(),
new \Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new \Sylius\Bundle\TaxationBundle\SyliusTaxationBundle(),
new \Sylius\Bundle\ShippingBundle\SyliusShippingBundle(),
new \Sylius\Bundle\PaymentBundle\SyliusPaymentBundle(),
new \Sylius\Bundle\MailerBundle\SyliusMailerBundle(),
new \Sylius\Bundle\PromotionBundle\SyliusPromotionBundle(),
new \Sylius\Bundle\AddressingBundle\SyliusAddressingBundle(),
new \Sylius\Bundle\InventoryBundle\SyliusInventoryBundle(),
new \Sylius\Bundle\TaxonomyBundle\SyliusTaxonomyBundle(),
new \Sylius\Bundle\UserBundle\SyliusUserBundle(),
new \Sylius\Bundle\CustomerBundle\SyliusCustomerBundle(),
new \Sylius\Bundle\UiBundle\SyliusUiBundle(),
new \Sylius\Bundle\ReviewBundle\SyliusReviewBundle(),
new \Sylius\Bundle\CoreBundle\SyliusCoreBundle(),
new \Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new \Sylius\Bundle\GridBundle\SyliusGridBundle(),
new \winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(),

new \Sonata\CoreBundle\SonataCoreBundle(),
new \Sonata\BlockBundle\SonataBlockBundle(),
new \Sonata\IntlBundle\SonataIntlBundle(),
new \Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new \JMS\SerializerBundle\JMSSerializerBundle(),
new \FOS\RestBundle\FOSRestBundle(),

new \Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
new \Knp\Bundle\MenuBundle\KnpMenuBundle(),
new \Liip\ImagineBundle\LiipImagineBundle(),
new \Payum\Bundle\PayumBundle\PayumBundle(),
new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new \BabDev\PagerfantaBundle\BabDevPagerfantaBundle(),

new \Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new \Sylius\Bundle\FixturesBundle\SyliusFixturesBundle(),
new \Sylius\Bundle\PayumBundle\SyliusPayumBundle(), // must be added after PayumBundle.
new \Sylius\Bundle\ThemeBundle\SyliusThemeBundle(), // must be added after FrameworkBundle
];

if (in_array($this->getEnvironment(), ['dev', 'test', 'test_cached'], true)) {
$bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new \Symfony\Bundle\WebServerBundle\WebServerBundle();
}

return $bundles;
}

protected function getContainerBaseClass(): string
{
if (in_array($this->getEnvironment(), ['test', 'test_cached'], true)) {
return MockerContainer::class;
}

return parent::getContainerBaseClass();
}

protected function getContainerLoader(ContainerInterface $container): LoaderInterface
{
/** @var ContainerBuilder $container */
Assert::isInstanceOf($container, ContainerBuilder::class);

$locator = new FileLocator($this, $this->getRootDir() . '/Resources');
$resolver = new LoaderResolver([
new XmlFileLoader($container, $locator),
new YamlFileLoader($container, $locator),
new IniFileLoader($container, $locator),
new PhpFileLoader($container, $locator),
new DirectoryLoader($container, $locator),
new ClosureLoader($container),
]);

return new DelegatingLoader($resolver);
}

public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');

$file = $this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.local.yml';
if (is_file($file)) {
$loader->load($file);
}
}

public function getCacheDir(): string
{
if ($this->isVagrantEnvironment()) {
return '/dev/shm/sylius/cache/' . $this->getEnvironment();
}

return dirname($this->getRootDir()) . '/var/cache/' . $this->getEnvironment();
}

public function getLogDir(): string
{
if ($this->isVagrantEnvironment()) {
return '/dev/shm/sylius/logs';
}

return dirname($this->getRootDir()) . '/var/logs';
}

protected function isVagrantEnvironment(): bool
{
return (getenv('HOME') === '/home/vagrant' || getenv('VAGRANT') === 'VAGRANT') && is_dir('/dev/shm');
}
}

0 comments on commit b477812

Please sign in to comment.