Skip to content

Commit

Permalink
Merge pull request #1726 from spryker/feature/te-7001/master-symfony-…
Browse files Browse the repository at this point in the history
…5-support

te-7001 Symfony 5 Support
  • Loading branch information
Spryker Release Bot authored Oct 6, 2020
2 parents 153d602 + 7cb2ed9 commit 5923e72
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"spryker/event-dispatcher-extension": "^1.0.0",
"spryker/kernel": "^3.48.0",
"spryker/storage": "^3.4.0",
"spryker/symfony": "^3.1.0",
"spryker/symfony": "^3.5.0",
"spryker/twig": "^3.3.0",
"spryker/twig-extension": "^1.0.0",
"spryker/util-text": "^1.2.0"
Expand Down
3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: false
dynamicConstantNames:
- APPLICATION
- APPLICATION_ENV
Expand All @@ -11,4 +12,4 @@ parameters:
- '#Call to an undefined method Spryker\\Yves\\Kernel\\FactoryInterface#'
- '#Return typehint of method SprykerShop\\Yves\\ShopApplication\\ShopApplicationFactory::createSilexTwigServiceProvider\(\) has invalid type Silex\\Provider\\TwigServiceProvider.#'
- '#Parameter \#1 \$app of class Spryker\\Yves\\Kernel\\ControllerResolver\\YvesFragmentControllerResolver constructor expects Silex\\Application, Spryker\\Service\\Container\\ContainerInterface given.#'
reportUnmatchedIgnoredErrors: false
- '#Instantiated class .+NativePasswordEncoder not found.#'
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface;
use Spryker\Yves\Kernel\AbstractPlugin;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand All @@ -38,7 +38,7 @@ class LastVisitCookieEventDispatcherPlugin extends AbstractPlugin implements Eve
*/
public function extend(EventDispatcherInterface $eventDispatcher, ContainerInterface $container): EventDispatcherInterface
{
$eventDispatcher->addListener(KernelEvents::RESPONSE, function (FilterResponseEvent $event): void {
$eventDispatcher->addListener(KernelEvents::RESPONSE, function (ResponseEvent $event): void {
$event->getResponse()->headers->setCookie(
(Cookie::create(static::COOKIE_NAME, (string)time(), time() + static::COOKIE_LIFETIME))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Spryker\Shared\EventDispatcher\EventDispatcherInterface;
use Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface;
use Spryker\Yves\Kernel\AbstractPlugin;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand All @@ -36,8 +36,8 @@ class ShopApplicationExceptionEventDispatcherPlugin extends AbstractPlugin imple
*/
public function extend(EventDispatcherInterface $eventDispatcher, ContainerInterface $container): EventDispatcherInterface
{
$eventDispatcher->addListener(KernelEvents::EXCEPTION, function (GetResponseForExceptionEvent $event) {
throw $event->getException();
$eventDispatcher->addListener(KernelEvents::EXCEPTION, function (ExceptionEvent $event) {
throw $event->getThrowable();
}, static::PRIORITY);

return $eventDispatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Spryker\Shared\EventDispatcher\EventDispatcherInterface;
use Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface;
use Spryker\Yves\Kernel\AbstractPlugin;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand All @@ -22,7 +22,7 @@ class ShopApplicationFilterControllerEventDispatcherPlugin extends AbstractPlugi
{
/**
* {@inheritDoc}
* - Adds a listener for the FilterControllerEvent.
* - Adds a listener for the ControllerEvent.
* - Executes FilterControllerEventHandlerPluginInterface's.
*
* @api
Expand All @@ -34,19 +34,19 @@ class ShopApplicationFilterControllerEventDispatcherPlugin extends AbstractPlugi
*/
public function extend(EventDispatcherInterface $eventDispatcher, ContainerInterface $container): EventDispatcherInterface
{
$eventDispatcher->addListener(KernelEvents::CONTROLLER, function (FilterControllerEvent $event) {
$eventDispatcher->addListener(KernelEvents::CONTROLLER, function (ControllerEvent $event) {
$this->onKernelController($event);
});

return $eventDispatcher;
}

/**
* @param \Symfony\Component\HttpKernel\Event\FilterControllerEvent $event
* @param \Symfony\Component\HttpKernel\Event\ControllerEvent $event
*
* @return void
*/
protected function onKernelController(FilterControllerEvent $event)
protected function onKernelController(ControllerEvent $event)
{
foreach ($this->getFactory()->getFilterControllerEventSubscriberPlugins() as $filterControllerEventListenerPlugin) {
$filterControllerEventListenerPlugin->handle($event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Spryker\Shared\Kernel\Communication\Application as SprykerApplication;
use Spryker\Yves\Kernel\AbstractPlugin;
use SprykerShop\Yves\ShopApplication\Exception\InvalidApplicationException;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand Down Expand Up @@ -48,18 +48,18 @@ public function boot(Application $app)
));
}

$app['dispatcher']->addListener(KernelEvents::CONTROLLER, function (FilterControllerEvent $event) use ($app) {
$app['dispatcher']->addListener(KernelEvents::CONTROLLER, function (ControllerEvent $event) use ($app) {
$this->onKernelController($event, $app);
}, 0);
}

/**
* @param \Symfony\Component\HttpKernel\Event\FilterControllerEvent $event
* @param \Symfony\Component\HttpKernel\Event\ControllerEvent $event
* @param \Spryker\Shared\Kernel\Communication\Application $application
*
* @return void
*/
public function onKernelController(FilterControllerEvent $event, SprykerApplication $application)
public function onKernelController(ControllerEvent $event, SprykerApplication $application)
{
foreach ($this->getFactory()->getFilterControllerEventSubscriberPlugins() as $filterControllerEventListenerPlugin) {
$filterControllerEventListenerPlugin->handle($event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Spryker\Shared\Twig\TwigConstants;
use Spryker\Yves\Kernel\AbstractPlugin;
use SprykerShop\Yves\ShopApplication\Exception\InvalidApplicationException;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Twig\Environment;
use Twig\Loader\ChainLoader;
Expand Down Expand Up @@ -64,18 +64,18 @@ public function boot(Application $app)
->createSilexTwigServiceProvider()
->boot($app);

$app['dispatcher']->addListener(KernelEvents::VIEW, function (GetResponseForControllerResultEvent $event) use ($app) {
$app['dispatcher']->addListener(KernelEvents::VIEW, function (ViewEvent $event) use ($app) {
$this->onKernelView($event, $app);
}, 0);
}

/**
* @param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event
* @param \Symfony\Component\HttpKernel\Event\ViewEvent $event
* @param \Spryker\Shared\Kernel\Communication\Application $application
*
* @return void
*/
public function onKernelView(GetResponseForControllerResultEvent $event, SprykerApplication $application)
public function onKernelView(ViewEvent $event, SprykerApplication $application)
{
$result = $event->getControllerResult();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Spryker\Yves\Kernel\AbstractPlugin;
use Spryker\Yves\Kernel\View\ViewInterface;
use SprykerShop\Yves\ShopApplication\Exception\InvalidApplicationException;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Twig\Environment;
use Twig\TwigFunction;
Expand Down Expand Up @@ -65,7 +65,7 @@ public function boot(Application $app)
));
}

$app['dispatcher']->addListener(KernelEvents::VIEW, function (GetResponseForControllerResultEvent $event) use ($app) {
$app['dispatcher']->addListener(KernelEvents::VIEW, function (ViewEvent $event) use ($app) {
$this->onKernelView($event, $app);
}, 0);
}
Expand Down Expand Up @@ -145,12 +145,12 @@ public function findWidget(string $widgetName, array $arguments = [])
}

/**
* @param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event
* @param \Symfony\Component\HttpKernel\Event\ViewEvent $event
* @param \Spryker\Shared\Kernel\Communication\Application $application
*
* @return void
*/
protected function onKernelView(GetResponseForControllerResultEvent $event, SprykerApplication $application): void
protected function onKernelView(ViewEvent $event, SprykerApplication $application): void
{
/** @var \Spryker\Yves\Kernel\Widget\WidgetContainerInterface $result */
$result = $event->getControllerResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Silex\Application;
use Silex\ServiceProviderInterface;
use Spryker\Yves\Kernel\AbstractPlugin;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand Down Expand Up @@ -40,14 +40,14 @@ public function boot(Application $app)
}

/**
* @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event
* @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event
*
* @throws \Exception
*
* @return void
*/
public function onKernelException(GetResponseForExceptionEvent $event)
public function onKernelException(ExceptionEvent $event)
{
throw $event->getException();
throw $event->getThrowable();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Silex\Application;
use Silex\ServiceProviderInterface;
use Spryker\Yves\Kernel\AbstractPlugin;
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
use Symfony\Component\Security\Core\Encoder\NativePasswordEncoder;

/**
* @deprecated Will be removed without replacement. The `\Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder`
Expand All @@ -27,7 +27,7 @@ class YvesSecurityServiceProvider extends AbstractPlugin implements ServiceProvi
public function register(Application $app)
{
$app['security.encoder.digest'] = function ($app) {
return new BCryptPasswordEncoder(self::BCRYPT_FACTOR);
return new NativePasswordEncoder(null, null, static::BCRYPT_FACTOR);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Twig\Environment;

Expand Down Expand Up @@ -88,11 +88,11 @@ public function onControllerResolved(ControllerArgumentsEvent $event): void
}

/**
* @param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event
* @param \Symfony\Component\HttpKernel\Event\ViewEvent $event
*
* @return void
*/
public function onKernelView(GetResponseForControllerResultEvent $event): void
public function onKernelView(ViewEvent $event): void
{
$result = $event->getControllerResult();
$masterGlobalView = null;
Expand Down

0 comments on commit 5923e72

Please sign in to comment.