for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace Shopware\Storefront\Event;
use Shopware\Core\Checkout\Cart\Event\CartMergedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Contracts\Translation\TranslatorInterface;
class CartMergedSubscriber implements EventSubscriberInterface
{
/**
* @var Session
*/
private $session;
* @var TranslatorInterface
private $translator;
public function __construct(
Session $session,
TranslatorInterface $translator
) {
$this->session = $session;
$this->translator = $translator;
}
public static function getSubscribedEvents(): array
return [
CartMergedEvent::class => 'addCartMergedNoticeFlash',
];
public function addCartMergedNoticeFlash(CartMergedEvent $event): void
$event
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function addCartMergedNoticeFlash(/** @scrutinizer ignore-unused */ CartMergedEvent $event): void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$this->session->getFlashBag()->add('info', $this->translator->trans('checkout.cart-merged-hint'));
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.