Skip to content

Commit

Permalink
[shopsys] upgrade to Symfony 6.4 (#3584)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik authored Nov 25, 2024
2 parents f08a54e + 1d4e7ab commit 1822fc8
Show file tree
Hide file tree
Showing 167 changed files with 489 additions and 520 deletions.
33 changes: 17 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,29 @@
"scheb/2fa-email": "^6.12.0",
"scheb/2fa-google-authenticator": "^6.12.0",
"shopsys/form-types-bundle": "16.0.x-dev",
"shopsys/jsformvalidator-bundle": "^1.7.0",
"shopsys/jsformvalidator-bundle": "^2.0.0",
"shopsys/migrations": "16.0.x-dev",
"shopsys/plugin-interface": "16.0.x-dev",
"snc/redis-bundle": "^4.4.1",
"spatie/opening-hours": "^3.0",
"stof/doctrine-extensions-bundle": "^1.3.0",
"symfony/css-selector": "^5.4",
"symfony/dom-crawler": "^5.4",
"symfony/error-handler": "^5.4",
"symfony/event-dispatcher": "^5.4",
"symfony/amqp-messenger": "^6.4",
"symfony/css-selector": "^6.4",
"symfony/dom-crawler": "^6.4",
"symfony/error-handler": "^6.4",
"symfony/event-dispatcher": "^6.4",
"symfony/html-sanitizer": "^6.1.0",
"symfony/http-client": "^5.4",
"symfony/mailer": "^5.4",
"symfony/messenger": "^5.4",
"symfony/http-client": "^6.4",
"symfony/mailer": "^6.4",
"symfony/messenger": "^6.4",
"symfony/monolog-bundle": "^3.5.0",
"symfony/property-info": "^5.4",
"symfony/proxy-manager-bridge": "^5.4",
"symfony/rate-limiter": "^5.4",
"symfony/security-bundle": "^5.4",
"symfony/property-info": "^6.4",
"symfony/proxy-manager-bridge": "^6.4",
"symfony/rate-limiter": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/service-contracts": "^2.5.2",
"symfony-cmf/routing": "^2.0.3",
"symfony-cmf/routing-bundle": "^2.0.3",
"symfony-cmf/routing": "^3.0.3",
"symfony-cmf/routing-bundle": "^3.0.3",
"symfony/polyfill-php80": "^1.24.0",
"tracy/tracy": "^2.4.13",
"twig/twig": "^3.14.0",
Expand All @@ -121,11 +122,11 @@
"psr/event-dispatcher": "^1.0.0",
"shopsys/coding-standards": "16.0.x-dev",
"sspooky13/yaml-standards": "^9.0",
"symfony/var-dumper": "^5.4"
"symfony/var-dumper": "^6.4"
},
"extra": {
"symfony": {
"require": "^5.4",
"require": "^6.4",
"docker": false
}
},
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ parameters:
-
message: '#^Unsafe usage of new static\(\).#'
path: %currentWorkingDirectory%/src/*
-
message: '#^Service "twig" is private.#'
path: %currentWorkingDirectory%/src/Component/FlashMessage/FlashMessageTrait.php
excludePaths:
# Exclude "Source" folder dedicated for testing functionality connected to "shopsys:extended-classes:annotations" command
- %currentWorkingDirectory%/tests/Unit/Component/ClassExtension/Source/*
Expand Down
2 changes: 1 addition & 1 deletion src/Command/RouterDebugCommandForDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
$this
->setDefinition([
Expand Down
2 changes: 1 addition & 1 deletion src/Command/RouterMatchCommandForDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
$this
->setDefinition([
Expand Down
29 changes: 0 additions & 29 deletions src/Component/AnnotatedRouteControllerLoader.php

This file was deleted.

31 changes: 31 additions & 0 deletions src/Component/AttributeRouteControllerLoader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Shopsys\FrameworkBundle\Component;

use ReflectionClass;
use ReflectionMethod;
use Symfony\Bundle\FrameworkBundle\Routing\AttributeRouteControllerLoader as BaseAttributeRouteControllerLoader;

class AttributeRouteControllerLoader extends BaseAttributeRouteControllerLoader
{
/**
* @param \ReflectionClass $class
* @param \ReflectionMethod $method
* @return string
*/
protected function getDefaultRouteName(ReflectionClass $class, ReflectionMethod $method): string
{
return static::replacePartOfTheRouteName(parent::getDefaultRouteName($class, $method));
}

/**
* @param string $routeName
* @return string
*/
public static function replacePartOfTheRouteName(string $routeName): string
{
return preg_replace('/^(app_|shopsys_framework_)/', '', $routeName);
}
}
4 changes: 2 additions & 2 deletions src/Component/Cron/CronFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
namespace Shopsys\FrameworkBundle\Component\Cron;

use DateTimeInterface;
use Monolog\Logger;
use Shopsys\FrameworkBundle\Component\Cron\Config\CronConfig;
use Shopsys\FrameworkBundle\Component\Cron\Config\CronModuleConfig;
use Symfony\Bridge\Monolog\Logger;
use Throwable;

class CronFacade
{
/**
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
* @param \Shopsys\FrameworkBundle\Component\Cron\Config\CronConfig $cronConfig
* @param \Shopsys\FrameworkBundle\Component\Cron\CronModuleFacade $cronModuleFacade
* @param \Shopsys\FrameworkBundle\Component\Cron\CronModuleExecutor $cronModuleExecutor
Expand Down
4 changes: 2 additions & 2 deletions src/Component/Cron/CronModuleExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

use DateInterval;
use DateTimeImmutable;
use Monolog\Logger;
use Shopsys\FrameworkBundle\Component\Bytes\BytesHelper;
use Shopsys\FrameworkBundle\Component\Cron\Config\CronConfig;
use Shopsys\FrameworkBundle\Component\Cron\Config\CronModuleConfig;
use Shopsys\Plugin\Cron\IteratedCronModuleInterface;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;

class CronModuleExecutor
{
Expand All @@ -23,7 +23,7 @@ class CronModuleExecutor

/**
* @param \Shopsys\FrameworkBundle\Component\Cron\Config\CronConfig $cronConfig
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
*/
public function __construct(
protected readonly CronConfig $cronConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Cron/DeleteOldCronModuleRunsCronModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Shopsys\FrameworkBundle\Component\Cron;

use Monolog\Logger;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;

class DeleteOldCronModuleRunsCronModule implements SimpleCronModuleInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Shopsys\FrameworkBundle\Component\Elasticsearch;

use Monolog\Logger;
use Shopsys\FrameworkBundle\Component\Domain\Domain;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

Expand All @@ -29,7 +29,7 @@ public function __construct(
}

/**
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
*/
public function setLogger(Logger $logger)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Component/Elasticsearch/AbstractExportCronModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Shopsys\FrameworkBundle\Component\Elasticsearch;

use Monolog\Logger;
use Shopsys\FrameworkBundle\Component\Domain\Domain;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;
use Symfony\Component\Console\Output\NullOutput;

abstract class AbstractExportCronModule implements SimpleCronModuleInterface
Expand All @@ -26,7 +26,7 @@ public function __construct(
}

/**
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
*/
public function setLogger(Logger $logger)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Error/ErrorPageCronModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Shopsys\FrameworkBundle\Component\Error;

use Monolog\Logger;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;

class ErrorPageCronModule implements SimpleCronModuleInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Component/FileUpload/DeleteOldUploadedFilesCronModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Shopsys\FrameworkBundle\Component\FileUpload;

use Monolog\Logger;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;

class DeleteOldUploadedFilesCronModule implements SimpleCronModuleInterface
{
Expand All @@ -19,7 +19,7 @@ public function __construct(protected readonly FileUpload $fileUpload)
}

/**
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
*/
public function setLogger(Logger $logger): void
{
Expand Down
12 changes: 6 additions & 6 deletions src/Component/Form/TimedFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

class TimedFormTypeExtension extends AbstractTypeExtension
{
public const MINIMUM_FORM_FILLING_SECONDS = 5;
public const OPTION_ENABLED = 'timed_spam_enabled';
public const OPTION_MINIMUM_SECONDS = 'timed_spam_minimum_seconds';
public const int MINIMUM_FORM_FILLING_SECONDS = 5;
public const string OPTION_ENABLED = 'timed_spam_enabled';
public const string OPTION_MINIMUM_SECONDS = 'timed_spam_minimum_seconds';

/**
* @param \Shopsys\FrameworkBundle\Component\Form\FormTimeProvider $formTimeProvider
Expand All @@ -27,7 +27,7 @@ public function __construct(protected readonly FormTimeProvider $formTimeProvide
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (!$options[self::OPTION_ENABLED]) {
return;
Expand All @@ -44,7 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
* @param \Symfony\Component\Form\FormInterface $form
* @param array $options
*/
public function finishView(FormView $view, FormInterface $form, array $options)
public function finishView(FormView $view, FormInterface $form, array $options): void
{
if ($options[self::OPTION_ENABLED] && !$view->parent && $options['compound']) {
$this->formTimeProvider->generateFormTime($form->getName());
Expand All @@ -54,7 +54,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
/**
* @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
self::OPTION_ENABLED => false,
Expand Down
2 changes: 2 additions & 0 deletions src/Component/HttpKernel/Profiler/FileProfilerStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function write(Profile $profile): bool
$profile->getTime(),
$profile->getParentToken(),
$profile->getStatusCode(),
$profile->getVirtualType(),
]);
fclose($file);
}
Expand Down Expand Up @@ -120,6 +121,7 @@ protected function getDataByProfile(Profile $profile): string
'url' => $profile->getUrl(),
'time' => $profile->getTime(),
'status_code' => $profile->getStatusCode(),
'virtual_type' => $profile->getVirtualType(),
];

$data = serialize($data);
Expand Down
4 changes: 2 additions & 2 deletions src/Component/Log/SlowLogSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shopsys\FrameworkBundle\Component\Log;

use Symfony\Bridge\Monolog\Logger;
use Monolog\Logger;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\TerminateEvent;
Expand All @@ -17,7 +17,7 @@ class SlowLogSubscriber implements EventSubscriberInterface
protected float $startTime;

/**
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
*/
public function __construct(protected readonly Logger $logger)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Packetery/PacketeryCronModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Shopsys\FrameworkBundle\Component\Packetery;

use Monolog\Logger;
use Shopsys\FrameworkBundle\Model\Order\OrderFacade;
use Shopsys\FrameworkBundle\Model\Transport\TransportTypeEnum;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;

class PacketeryCronModule implements SimpleCronModuleInterface
{
Expand Down
5 changes: 4 additions & 1 deletion src/Component/Router/CurrentDomainRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ public function add($router, $priority = 0): void
*/
public function all(): array
{
return $this->getDomainRouter()->all();
/** @var \Symfony\Component\Routing\RouterInterface[] $allRouters */
$allRouters = $this->getDomainRouter()->all();

return $allRouters;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/PricingGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function listAction()
* @param int $id
*/
#[Route(path: '/pricing/group/delete/{id}', requirements: ['id' => '\d+'])]
public function deleteAction(Request $request, $id)
public function deleteAction(Request $request, int $id)
{
$newId = $request->get('newId');
$newId = $newId !== null ? (int)$newId : null;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function listAction(Request $request)

// Cannot call $form->handleRequest() because the GET forms are not handled in POST request.
// See: https://github.com/symfony/symfony/issues/12244
$quickSearchForm->submit($request->query->get($quickSearchForm->getName()));
$quickSearchForm->submit($request->get($quickSearchForm->getName()));

$massActionForm = $this->createForm(ProductMassActionFormType::class);
$massActionForm->handleRequest($request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
/**
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition($this->validatorFactoryServiceId)) {
return;
Expand Down
Loading

0 comments on commit 1822fc8

Please sign in to comment.