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 1a5af5d + e26aab4 commit 917bb6c
Show file tree
Hide file tree
Showing 38 changed files with 194 additions and 144 deletions.
48 changes: 24 additions & 24 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"shopsys/form-types-bundle": "16.0.x-dev",
"shopsys/framework": "16.0.x-dev",
"shopsys/frontend-api": "16.0.x-dev",
"shopsys/jsformvalidator-bundle": "^1.7.0",
"shopsys/jsformvalidator-bundle": "^2.0.0",
"shopsys/administration": "16.0.x-dev",
"shopsys/migrations": "16.0.x-dev",
"shopsys/plugin-interface": "16.0.x-dev",
Expand All @@ -84,31 +84,31 @@
"shopsys/s3-bridge": "16.0.x-dev",
"snc/redis-bundle": "^4.4.1",
"stof/doctrine-extensions-bundle": "^1.3.0",
"symfony-cmf/routing": "^2.0.3",
"symfony-cmf/routing-bundle": "^2.0.3",
"symfony/debug-bundle": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/error-handler": "^5.4",
"symfony-cmf/routing": "^3.0.3",
"symfony-cmf/routing-bundle": "^3.0.3",
"symfony/debug-bundle": "^6.4",
"symfony/dotenv": "^6.4",
"symfony/error-handler": "^6.4",
"symfony/flex": "^1.17",
"symfony/form": "^5.4",
"symfony/http-client": "^5.4",
"symfony/form": "^6.4",
"symfony/http-client": "^6.4",
"symfony/mailer": "^5.0",
"symfony/messenger": "^5.4",
"symfony/monolog-bridge": "^5.4",
"symfony/messenger": "^6.4",
"symfony/monolog-bridge": "^6.4",
"symfony/monolog-bundle": "^3.5.0",
"symfony/property-info": "^5.4",
"symfony/proxy-manager-bridge": "^5.4",
"symfony/runtime": "^5.4",
"symfony/security-bundle": "^5.4",
"symfony/property-info": "^6.4",
"symfony/proxy-manager-bridge": "^6.4",
"symfony/runtime": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/service-contracts": "^2.5.2",
"symfony/stopwatch": "^5.4",
"symfony/translation": "^5.4",
"symfony/twig-bundle": "^5.4",
"symfony/validator": "^5.4",
"symfony/web-link": "^5.4",
"symfony/web-profiler-bundle": "^5.4",
"symfony/stopwatch": "^6.4",
"symfony/translation": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/validator": "^6.4",
"symfony/web-link": "^6.4",
"symfony/web-profiler-bundle": "^6.4",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/workflow": "^5.4",
"symfony/workflow": "^6.4",
"tracy/tracy": "^2.4.13",
"tuscanicz/enum": "^2.1",
"twig/twig": "^3.14.0",
Expand All @@ -130,8 +130,8 @@
"shopsys/coding-standards": "16.0.x-dev",
"shopsys/http-smoke-testing": "16.0.x-dev",
"sspooky13/yaml-standards": "^9.0",
"symfony/browser-kit": "^5.4",
"symfony/var-dumper": "^5.4",
"symfony/browser-kit": "^6.4",
"symfony/var-dumper": "^6.4",
"zalas/phpunit-injector": "2.5.x-dev as 2.5.1"
},
"conflict": {
Expand Down Expand Up @@ -186,7 +186,7 @@
"public-dir": "web",
"symfony": {
"allow-contrib": true,
"require": "^5.4",
"require": "^6.4",
"docker": false
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ doctrine:
orm:
auto_generate_proxy_classes: false
auto_mapping: false
controller_resolver:
auto_mapping: false
dql:
string_functions:
bool_and: App\Component\Doctrine\BoolAndFunction
Expand Down
10 changes: 5 additions & 5 deletions app/config/packages/test/security.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
security:
# quicker password encryption in test data fixtures
encoders:
Symfony\Component\Security\Core\User\UserInterface:
algorithm: bcrypt
cost: 4
# simple login for smoke tests
firewalls:
administration:
http_basic: ~
# quicker password encryption in test data fixtures
password_hashers:
Symfony\Component\Security\Core\User\UserInterface:
algorithm: bcrypt
cost: 4
2 changes: 1 addition & 1 deletion app/config/routes/acc/shopsys_test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
shopsys_shop_tests:
prefix: /codeception-acceptance-test
resource: ../../../src/Controller/Test/
type: annotation
type: attribute
2 changes: 1 addition & 1 deletion app/config/routes/shopsys_admin.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
shopsys_shop_admin:
prefix: /%admin_url%
resource: "../../src/Controller/Admin/"
type: annotation
type: attribute
2 changes: 2 additions & 0 deletions app/config/routes/shopsys_framework.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
shopsys_administration:
prefix: /%admin_url%
resource: "@ShopsysAdministrationBundle/Controller"
type: attribute

shopsys_framework:
prefix: /%admin_url%
resource: "@ShopsysFrameworkBundle/Controller/Admin"
type: attribute
2 changes: 1 addition & 1 deletion app/config/routes/test/shopsys_test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
shopsys_shop_tests:
prefix: /test
resource: ../../../src/Controller/Test/
type: annotation
type: attribute
5 changes: 0 additions & 5 deletions app/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,6 @@ services:
Symfony\Component\DependencyInjection\ContainerInterface:
alias: service_container

Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler:
arguments:
- '@Redis'
- { 'prefix': '%env(REDIS_PREFIX)%session:', ttl: 604800 }

Symfony\Component\Validator\Constraints\FileValidator:

Symfony\Component\Validator\Constraints\ImageValidator:
Expand Down
8 changes: 8 additions & 0 deletions app/ecs-skip-rules.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

use PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff;
use PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\MethodDeclarationSniff;
use PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowMultipleAssignmentsSniff;
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToPropertyTypeFixer;
use Shopsys\CodingStandards\Sniffs\ForbiddenDoctrineInheritanceSniff;
use Shopsys\CodingStandards\Sniffs\ForbiddenDumpSniff;
Expand All @@ -18,6 +20,12 @@
return [
__DIR__ . '/tests/App/Test/Codeception/_generated/AcceptanceTesterActions.php',
RemoveUselessDefaultCommentFixer::class,
AssignmentInConditionSniff::class => [
__DIR__ . '/project-base/app/src/Kernel.php',
],
DisallowMultipleAssignmentsSniff::class => [
__DIR__ . '/project-base/app/src/Kernel.php',
],
PhpdocToPropertyTypeFixer::class => [
__DIR__ . '/src',
__DIR__ . '/app',
Expand Down
2 changes: 1 addition & 1 deletion app/src/Command/ReplaceCdnDomainUrlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
parent::__construct();
}

protected function configure()
protected function configure(): void
{
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/Component/DataBridge/DummyCronModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace App\Component\DataBridge;

use App\Component\DataBridge\Transfer\DummyImportTransferFacade;
use Monolog\Logger;
use Shopsys\Plugin\Cron\SimpleCronModuleInterface;
use Symfony\Bridge\Monolog\Logger;

class DummyCronModule implements SimpleCronModuleInterface
{
Expand All @@ -19,7 +19,7 @@ public function __construct(
}

/**
* @param \Symfony\Bridge\Monolog\Logger $logger
* @param \Monolog\Logger $logger
*/
public function setLogger(Logger $logger): void
{
Expand Down
16 changes: 8 additions & 8 deletions app/src/Component/Validator/FlysystemFileValidatorDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class FlysystemFileValidatorDecorator extends ConstraintValidator
{
private const LOCAL_TEMPORARY_DIRECTORY = 'localeFileUploads';
private const string LOCAL_TEMPORARY_DIRECTORY = 'localeFileUploads';

/**
* @param \Symfony\Component\Validator\Constraints\FileValidator $fileValidator
Expand All @@ -26,18 +26,18 @@ class FlysystemFileValidatorDecorator extends ConstraintValidator
* @param \League\Flysystem\FilesystemOperator $filesystem
*/
public function __construct(
private FileValidator $fileValidator,
private string $localTemporaryDir,
private Filesystem $symfonyFilesystem,
private MountManager $mountManager,
private FilesystemOperator $filesystem,
private readonly FileValidator $fileValidator,
private readonly string $localTemporaryDir,
private readonly Filesystem $symfonyFilesystem,
private readonly MountManager $mountManager,
private readonly FilesystemOperator $filesystem,
) {
}

/**
* {@inheritdoc}
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if ($value === null || $value === '') {
return;
Expand Down Expand Up @@ -76,7 +76,7 @@ private function getLocalTemporaryDirectory(): string
/**
* @param \Symfony\Component\Validator\Context\ExecutionContextInterface $context
*/
public function initialize(ExecutionContextInterface $context)
public function initialize(ExecutionContextInterface $context): void
{
$this->fileValidator->initialize($context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

class CustomerUserRoleGroupDataFixture extends AbstractReferenceFixture
{
public const ROLE_GROUP_OWNER = 'role_group_owner';
public const ROLE_GROUP_USER = 'role_group_user';
public const ROLE_GROUP_LIMITED_USER = 'role_group_limited_user';
public const string ROLE_GROUP_OWNER = 'role_group_owner';
public const string ROLE_GROUP_USER = 'role_group_user';
public const string ROLE_GROUP_LIMITED_USER = 'role_group_limited_user';

/**
* @param \Shopsys\FrameworkBundle\Model\Customer\User\Role\CustomerUserRoleGroupDataFactory $customerUserRoleGroupDataFactory
Expand All @@ -30,7 +30,7 @@ public function __construct(
/**
* @param \Doctrine\Persistence\ObjectManager $manager
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$this->addReferenceForDefaultRoleGroup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
/**
* @param \Doctrine\Persistence\ObjectManager $manager
*/
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$salesRepresentativeData = $this->salesRepresentativeDataFactory->create();
$salesRepresentativeData->uuid = Uuid::uuid5(self::UUID_NAMESPACE, 'JD')->toString();
Expand Down
4 changes: 2 additions & 2 deletions app/src/Form/Admin/AdministratorFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AdministratorFormTypeExtension extends AbstractTypeExtension
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builderSettingsGroup = $builder->get('settings');
$builderSettingsGroup->remove('password');
Expand Down Expand Up @@ -48,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
* @param string $scenario
* @return \Symfony\Component\Validator\Constraint[]
*/
private function getFirstPasswordConstraints($scenario)
private function getFirstPasswordConstraints(string $scenario): array
{
$constraints = [
new Constraints\Regex(['pattern' => '/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{10,}$/', 'message' => 'Password has to include uppercase letters, lowercase letters, numbers and must be longer than 10 characters.']),
Expand Down
2 changes: 1 addition & 1 deletion app/src/Form/Admin/BrandFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BrandFormTypeExtension extends AbstractTypeExtension
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/Form/Admin/CategoryFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class CategoryFormTypeExtension extends AbstractTypeExtension
{
public const DISABLED_FIELDS = [];
public const array DISABLED_FIELDS = [];

/**
* @param \Shopsys\FrameworkBundle\Component\Form\FormBuilderHelper $formBuilderHelper
Expand All @@ -37,7 +37,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->formBuilderHelper->disableFieldsByConfigurations($builder, self::DISABLED_FIELDS);

Expand Down
2 changes: 1 addition & 1 deletion app/src/Form/Admin/CspHeaderSettingFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CspHeaderSettingFormType extends AbstractType
* @param \Symfony\Component\Form\FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('cspHeader', TextareaType::class, [
'required' => false,
Expand Down
6 changes: 3 additions & 3 deletions app/src/Form/Admin/CustomerUserFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

class CustomerUserFormTypeExtension extends AbstractTypeExtension
{
private const DISABLED_FIELDS = [];
private const array DISABLED_FIELDS = [];

/**
* @param \Shopsys\FrameworkBundle\Component\Form\FormBuilderHelper $formBuilderHelper
*/
public function __construct(private FormBuilderHelper $formBuilderHelper)
public function __construct(private readonly FormBuilderHelper $formBuilderHelper)
{
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->formBuilderHelper->disableFieldsByConfigurations($builder, self::DISABLED_FIELDS);
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/Form/Admin/GrapesJsMailType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
* @param \Symfony\Component\Form\FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);

Expand All @@ -38,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
* @param \Symfony\Component\Form\FormInterface $form
* @param array $options
*/
public function buildView(FormView $view, FormInterface $form, array $options)
public function buildView(FormView $view, FormInterface $form, array $options): void
{
$view->vars['body_variables'] = $options['body_variables'];

Expand All @@ -56,7 +56,7 @@ public function getParent(): ?string
/**
* @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
$resolver
->setDefined(['body_variables'])
Expand Down
2 changes: 1 addition & 1 deletion app/src/Form/Admin/Mail/MailTemplateFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MailTemplateFormTypeExtension extends AbstractTypeExtension
* @param \Symfony\Component\Form\FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->remove('body');

Expand Down
Loading

0 comments on commit 917bb6c

Please sign in to comment.