From c908af15571378fc25aac7aae723914ac4ac52c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Tue, 5 Nov 2024 09:40:55 +0100 Subject: [PATCH 01/14] updated symfony to 6.4 --- composer.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 90926560cd..4217bbf68e 100644 --- a/composer.json +++ b/composer.json @@ -84,28 +84,28 @@ "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/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", @@ -121,11 +121,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 } }, From 70be759623a497a9bcf31b809349d6264eb67f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Tue, 5 Nov 2024 10:34:40 +0100 Subject: [PATCH 02/14] added missing FlashBag to services --- src/Resources/config/services.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 11dc3998ba..ed33ac8468 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -1006,6 +1006,11 @@ services: Symfony\Component\Config\Loader\LoaderInterface: alias: routing.loader + Symfony\Component\HttpFoundation\Session\Flash\FlashBag: ~ + + Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface: + class: Symfony\Component\HttpFoundation\Session\Flash\FlashBag + Symfony\Component\Translation\IdentityTranslator: ~ Symfony\Component\Validator\Constraints\FileValidator: From bb5cb0756f5626be5e92f6a3c68a30556990d905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Tue, 5 Nov 2024 12:43:00 +0100 Subject: [PATCH 03/14] fixed types and wrong usages reported by PHPStan --- phpstan.neon | 3 +++ src/Component/Cron/CronFacade.php | 4 ++-- src/Component/Cron/CronModuleExecutor.php | 4 ++-- .../DeleteOldCronModuleRunsCronModule.php | 2 +- .../AbstractExportChangedCronModule.php | 4 ++-- .../AbstractExportCronModule.php | 4 ++-- src/Component/Error/ErrorPageCronModule.php | 2 +- .../DeleteOldUploadedFilesCronModule.php | 4 ++-- src/Component/Log/SlowLogSubscriber.php | 4 ++-- .../Packetery/PacketeryCronModule.php | 2 +- src/Component/Router/CurrentDomainRouter.php | 5 ++++- .../Cart/Item/DeleteOldCartsCronModule.php | 2 +- ...stomerUserRefreshTokenChainsCronModule.php | 4 ++-- src/Model/Feed/FeedCronModule.php | 2 +- .../GoPayAvailablePaymentsCronModule.php | 4 ++-- .../OrderGoPayStatusUpdateCronModule.php | 4 ++-- .../ImageSitemap/ImageSitemapCronModule.php | 2 +- .../Pricing/Vat/VatDeletionCronModule.php | 2 +- .../ProductRecalculationCronModule.php | 2 +- .../List/RemoveOldProductListsCronModule.php | 2 +- src/Model/Security/AdministratorChecker.php | 2 +- src/Model/Sitemap/SitemapCronModule.php | 2 +- .../TransferIssueLogCleanerCronModule.php | 4 ++-- src/Model/Transfer/TransferLoggerFactory.php | 4 ++-- .../Translation/PhpFileExtractorTest.php | 8 ++++---- .../Translation/Resources/Controller.php | 17 +++++++++++------ tests/Unit/Model/Customer/Mock/TokenMock.php | 19 +++++++++++++++---- .../Unit/Model/Security/LoginListenerTest.php | 2 -- 28 files changed, 70 insertions(+), 50 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index d631586c8f..cfdd16ea97 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -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/* diff --git a/src/Component/Cron/CronFacade.php b/src/Component/Cron/CronFacade.php index 9d3c29b288..5ae478f970 100644 --- a/src/Component/Cron/CronFacade.php +++ b/src/Component/Cron/CronFacade.php @@ -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 diff --git a/src/Component/Cron/CronModuleExecutor.php b/src/Component/Cron/CronModuleExecutor.php index 48b32cd57a..2f28b4cb91 100644 --- a/src/Component/Cron/CronModuleExecutor.php +++ b/src/Component/Cron/CronModuleExecutor.php @@ -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 { @@ -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, diff --git a/src/Component/Cron/DeleteOldCronModuleRunsCronModule.php b/src/Component/Cron/DeleteOldCronModuleRunsCronModule.php index e56727af69..31352aeca0 100644 --- a/src/Component/Cron/DeleteOldCronModuleRunsCronModule.php +++ b/src/Component/Cron/DeleteOldCronModuleRunsCronModule.php @@ -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 { diff --git a/src/Component/Elasticsearch/AbstractExportChangedCronModule.php b/src/Component/Elasticsearch/AbstractExportChangedCronModule.php index 9b419092f8..0c1774dfc1 100644 --- a/src/Component/Elasticsearch/AbstractExportChangedCronModule.php +++ b/src/Component/Elasticsearch/AbstractExportChangedCronModule.php @@ -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; @@ -29,7 +29,7 @@ public function __construct( } /** - * @param \Symfony\Bridge\Monolog\Logger $logger + * @param \Monolog\Logger $logger */ public function setLogger(Logger $logger) { diff --git a/src/Component/Elasticsearch/AbstractExportCronModule.php b/src/Component/Elasticsearch/AbstractExportCronModule.php index 54b39f61ae..8fcc60ba2f 100644 --- a/src/Component/Elasticsearch/AbstractExportCronModule.php +++ b/src/Component/Elasticsearch/AbstractExportCronModule.php @@ -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 @@ -26,7 +26,7 @@ public function __construct( } /** - * @param \Symfony\Bridge\Monolog\Logger $logger + * @param \Monolog\Logger $logger */ public function setLogger(Logger $logger) { diff --git a/src/Component/Error/ErrorPageCronModule.php b/src/Component/Error/ErrorPageCronModule.php index 3638750fc0..a7c5f9ce7e 100644 --- a/src/Component/Error/ErrorPageCronModule.php +++ b/src/Component/Error/ErrorPageCronModule.php @@ -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 { diff --git a/src/Component/FileUpload/DeleteOldUploadedFilesCronModule.php b/src/Component/FileUpload/DeleteOldUploadedFilesCronModule.php index 5ba4db472b..90c20b77a0 100644 --- a/src/Component/FileUpload/DeleteOldUploadedFilesCronModule.php +++ b/src/Component/FileUpload/DeleteOldUploadedFilesCronModule.php @@ -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 { @@ -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 { diff --git a/src/Component/Log/SlowLogSubscriber.php b/src/Component/Log/SlowLogSubscriber.php index 797f0dd1f0..73b736fd38 100644 --- a/src/Component/Log/SlowLogSubscriber.php +++ b/src/Component/Log/SlowLogSubscriber.php @@ -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; @@ -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) { diff --git a/src/Component/Packetery/PacketeryCronModule.php b/src/Component/Packetery/PacketeryCronModule.php index 0b2bea9b39..25f25377fb 100644 --- a/src/Component/Packetery/PacketeryCronModule.php +++ b/src/Component/Packetery/PacketeryCronModule.php @@ -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 { diff --git a/src/Component/Router/CurrentDomainRouter.php b/src/Component/Router/CurrentDomainRouter.php index 621bdea27b..bea9ce0725 100644 --- a/src/Component/Router/CurrentDomainRouter.php +++ b/src/Component/Router/CurrentDomainRouter.php @@ -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; } /** diff --git a/src/Model/Cart/Item/DeleteOldCartsCronModule.php b/src/Model/Cart/Item/DeleteOldCartsCronModule.php index 110756b79f..70bd525654 100644 --- a/src/Model/Cart/Item/DeleteOldCartsCronModule.php +++ b/src/Model/Cart/Item/DeleteOldCartsCronModule.php @@ -4,9 +4,9 @@ namespace Shopsys\FrameworkBundle\Model\Cart\Item; +use Monolog\Logger; use Shopsys\FrameworkBundle\Model\Cart\CartFacade; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class DeleteOldCartsCronModule implements SimpleCronModuleInterface { diff --git a/src/Model/Customer/User/RemoveOldCustomerUserRefreshTokenChainsCronModule.php b/src/Model/Customer/User/RemoveOldCustomerUserRefreshTokenChainsCronModule.php index 79d463cb3a..f27183ae0e 100644 --- a/src/Model/Customer/User/RemoveOldCustomerUserRefreshTokenChainsCronModule.php +++ b/src/Model/Customer/User/RemoveOldCustomerUserRefreshTokenChainsCronModule.php @@ -4,8 +4,8 @@ namespace Shopsys\FrameworkBundle\Model\Customer\User; +use Monolog\Logger; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class RemoveOldCustomerUserRefreshTokenChainsCronModule implements SimpleCronModuleInterface { @@ -20,7 +20,7 @@ public function __construct( } /** - * @param \Symfony\Bridge\Monolog\Logger $logger + * @param \Monolog\Logger $logger */ public function setLogger(Logger $logger): void { diff --git a/src/Model/Feed/FeedCronModule.php b/src/Model/Feed/FeedCronModule.php index 4ade6acdde..ee05854a2c 100644 --- a/src/Model/Feed/FeedCronModule.php +++ b/src/Model/Feed/FeedCronModule.php @@ -4,11 +4,11 @@ namespace Shopsys\FrameworkBundle\Model\Feed; +use Monolog\Logger; use Shopsys\FrameworkBundle\Component\Domain\Domain; use Shopsys\FrameworkBundle\Component\Setting\Setting; use Shopsys\FrameworkBundle\Model\Feed\Exception\FeedNotFoundException; use Shopsys\Plugin\Cron\IteratedCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class FeedCronModule implements IteratedCronModuleInterface { diff --git a/src/Model/GoPay/GoPayAvailablePaymentsCronModule.php b/src/Model/GoPay/GoPayAvailablePaymentsCronModule.php index 3973fab485..2691bcdcc5 100644 --- a/src/Model/GoPay/GoPayAvailablePaymentsCronModule.php +++ b/src/Model/GoPay/GoPayAvailablePaymentsCronModule.php @@ -6,13 +6,13 @@ use Doctrine\ORM\EntityManagerInterface; use Exception; +use Monolog\Logger; use Shopsys\FrameworkBundle\Component\Domain\Domain; use Shopsys\FrameworkBundle\Model\GoPay\Exception\GoPayNotConfiguredException; use Shopsys\FrameworkBundle\Model\GoPay\Exception\GoPayNotEnabledOnDomainException; use Shopsys\FrameworkBundle\Model\GoPay\Exception\GoPayPaymentDownloadException; use Shopsys\FrameworkBundle\Model\GoPay\PaymentMethod\GoPayPaymentMethodFacade; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class GoPayAvailablePaymentsCronModule implements SimpleCronModuleInterface { @@ -31,7 +31,7 @@ public function __construct( } /** - * @param \Symfony\Bridge\Monolog\Logger $logger + * @param \Monolog\Logger $logger */ public function setLogger(Logger $logger): void { diff --git a/src/Model/GoPay/OrderGoPayStatusUpdateCronModule.php b/src/Model/GoPay/OrderGoPayStatusUpdateCronModule.php index 9d10d8ea9d..6ce79f245d 100644 --- a/src/Model/GoPay/OrderGoPayStatusUpdateCronModule.php +++ b/src/Model/GoPay/OrderGoPayStatusUpdateCronModule.php @@ -7,11 +7,11 @@ use DateInterval; use DateTime; use Doctrine\ORM\EntityManagerInterface; +use Monolog\Logger; use Shopsys\FrameworkBundle\Model\GoPay\Exception\GoPayPaymentDownloadException; use Shopsys\FrameworkBundle\Model\Order\Mail\OrderMailFacade; use Shopsys\FrameworkBundle\Model\Payment\Service\PaymentServiceFacade; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class OrderGoPayStatusUpdateCronModule implements SimpleCronModuleInterface { @@ -95,7 +95,7 @@ public function run(): void } /** - * @param \Symfony\Bridge\Monolog\Logger $logger + * @param \Monolog\Logger $logger */ public function setLogger(Logger $logger): void { diff --git a/src/Model/ImageSitemap/ImageSitemapCronModule.php b/src/Model/ImageSitemap/ImageSitemapCronModule.php index 99a3fc5045..cd017085cf 100644 --- a/src/Model/ImageSitemap/ImageSitemapCronModule.php +++ b/src/Model/ImageSitemap/ImageSitemapCronModule.php @@ -4,8 +4,8 @@ namespace Shopsys\FrameworkBundle\Model\ImageSitemap; +use Monolog\Logger; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class ImageSitemapCronModule implements SimpleCronModuleInterface { diff --git a/src/Model/Pricing/Vat/VatDeletionCronModule.php b/src/Model/Pricing/Vat/VatDeletionCronModule.php index fff6c59813..db43c83356 100644 --- a/src/Model/Pricing/Vat/VatDeletionCronModule.php +++ b/src/Model/Pricing/Vat/VatDeletionCronModule.php @@ -4,9 +4,9 @@ namespace Shopsys\FrameworkBundle\Model\Pricing\Vat; +use Monolog\Logger; use Shopsys\FrameworkBundle\Model\Product\Pricing\ProductInputPriceFacade; use Shopsys\Plugin\Cron\IteratedCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class VatDeletionCronModule implements IteratedCronModuleInterface { diff --git a/src/Model/Product/Elasticsearch/ProductRecalculationCronModule.php b/src/Model/Product/Elasticsearch/ProductRecalculationCronModule.php index e4fc701643..8e68292a5d 100644 --- a/src/Model/Product/Elasticsearch/ProductRecalculationCronModule.php +++ b/src/Model/Product/Elasticsearch/ProductRecalculationCronModule.php @@ -4,9 +4,9 @@ namespace Shopsys\FrameworkBundle\Model\Product\Elasticsearch; +use Monolog\Logger; use Shopsys\FrameworkBundle\Model\Product\Recalculation\ProductRecalculationDispatcher; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class ProductRecalculationCronModule implements SimpleCronModuleInterface { diff --git a/src/Model/Product/List/RemoveOldProductListsCronModule.php b/src/Model/Product/List/RemoveOldProductListsCronModule.php index 340b4b5f34..fea199b70b 100644 --- a/src/Model/Product/List/RemoveOldProductListsCronModule.php +++ b/src/Model/Product/List/RemoveOldProductListsCronModule.php @@ -5,8 +5,8 @@ namespace Shopsys\FrameworkBundle\Model\Product\List; use DateTimeImmutable; +use Monolog\Logger; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class RemoveOldProductListsCronModule implements SimpleCronModuleInterface { diff --git a/src/Model/Security/AdministratorChecker.php b/src/Model/Security/AdministratorChecker.php index dc29435d8a..138101ba1b 100644 --- a/src/Model/Security/AdministratorChecker.php +++ b/src/Model/Security/AdministratorChecker.php @@ -22,7 +22,7 @@ public function __construct( } /** - * @param \Symfony\Component\Security\Core\User\UserInterface $user + * @param \Shopsys\FrameworkBundle\Model\Administrator\Administrator $user */ public function checkPostAuth(UserInterface $user) { diff --git a/src/Model/Sitemap/SitemapCronModule.php b/src/Model/Sitemap/SitemapCronModule.php index 34e08210c1..eef0747e2c 100644 --- a/src/Model/Sitemap/SitemapCronModule.php +++ b/src/Model/Sitemap/SitemapCronModule.php @@ -4,8 +4,8 @@ namespace Shopsys\FrameworkBundle\Model\Sitemap; +use Monolog\Logger; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class SitemapCronModule implements SimpleCronModuleInterface { diff --git a/src/Model/Transfer/Issue/TransferIssueLogCleanerCronModule.php b/src/Model/Transfer/Issue/TransferIssueLogCleanerCronModule.php index f74d863169..cc1a836c9a 100644 --- a/src/Model/Transfer/Issue/TransferIssueLogCleanerCronModule.php +++ b/src/Model/Transfer/Issue/TransferIssueLogCleanerCronModule.php @@ -4,8 +4,8 @@ namespace Shopsys\FrameworkBundle\Model\Transfer\Issue; +use Monolog\Logger; use Shopsys\Plugin\Cron\SimpleCronModuleInterface; -use Symfony\Bridge\Monolog\Logger; class TransferIssueLogCleanerCronModule implements SimpleCronModuleInterface { @@ -20,7 +20,7 @@ public function __construct( } /** - * @param \Symfony\Bridge\Monolog\Logger $logger + * @param \Monolog\Logger $logger */ public function setLogger(Logger $logger): void { diff --git a/src/Model/Transfer/TransferLoggerFactory.php b/src/Model/Transfer/TransferLoggerFactory.php index 80b2bd5d02..a75819022e 100644 --- a/src/Model/Transfer/TransferLoggerFactory.php +++ b/src/Model/Transfer/TransferLoggerFactory.php @@ -4,10 +4,10 @@ namespace Shopsys\FrameworkBundle\Model\Transfer; +use Monolog\Logger; use Shopsys\FrameworkBundle\Model\Transfer\Exception\UnknownServiceTransferException; use Shopsys\FrameworkBundle\Model\Transfer\Issue\TransferIssueDataFactory; use Shopsys\FrameworkBundle\Model\Transfer\Issue\TransferIssueFacade; -use Symfony\Bridge\Monolog\Logger; class TransferLoggerFactory { @@ -17,7 +17,7 @@ class TransferLoggerFactory protected array $transferLoggers = []; /** - * @param \Symfony\Bridge\Monolog\Logger $defaultLogger + * @param \Monolog\Logger $defaultLogger * @param \Shopsys\FrameworkBundle\Model\Transfer\TransferFacade $transferFacade * @param \Shopsys\FrameworkBundle\Model\Transfer\Issue\TransferIssueFacade $transferIssueFacade * @param \Shopsys\FrameworkBundle\Model\Transfer\Issue\TransferIssueDataFactory $transferIssueDataFactory diff --git a/tests/Unit/Component/Translation/PhpFileExtractorTest.php b/tests/Unit/Component/Translation/PhpFileExtractorTest.php index 934df49045..8438583fe6 100644 --- a/tests/Unit/Component/Translation/PhpFileExtractorTest.php +++ b/tests/Unit/Component/Translation/PhpFileExtractorTest.php @@ -28,19 +28,19 @@ public function testExtractController() $expected = new MessageCatalogue(); $message = new Message('trans test', Translator::DEFAULT_TRANSLATION_DOMAIN); - $message->addSource(new FileSource($fileName, 18)); + $message->addSource(new FileSource($fileName, 23)); $expected->add($message); $message = new Message('trans test with domain', 'testDomain'); - $message->addSource(new FileSource($fileName, 19)); + $message->addSource(new FileSource($fileName, 24)); $expected->add($message); $message = new Message('t test', Translator::DEFAULT_TRANSLATION_DOMAIN); - $message->addSource(new FileSource($fileName, 21)); + $message->addSource(new FileSource($fileName, 26)); $expected->add($message); $message = new Message('t test with domain', 'testDomain'); - $message->addSource(new FileSource($fileName, 22)); + $message->addSource(new FileSource($fileName, 27)); $expected->add($message); $this->assertEquals($expected, $catalogue); diff --git a/tests/Unit/Component/Translation/Resources/Controller.php b/tests/Unit/Component/Translation/Resources/Controller.php index 1021362f01..160bb54d2a 100644 --- a/tests/Unit/Component/Translation/Resources/Controller.php +++ b/tests/Unit/Component/Translation/Resources/Controller.php @@ -10,13 +10,18 @@ class Controller extends AbstractController { + /** + * @param \Shopsys\FrameworkBundle\Component\Translation\Translator $translator + */ + public function __construct( + protected readonly Translator $translator, + ) { + } + public function indexAction() { - /** @var \Shopsys\FrameworkBundle\Component\Translation\Translator $translator */ - $translator = $this->get(Translator::class); - - $translator->trans('trans test'); - $translator->trans('trans test with domain', [], 'testDomain'); + $this->translator->trans('trans test'); + $this->translator->trans('trans test with domain', [], 'testDomain'); t('t test'); t('t test with domain', [], 'testDomain'); @@ -24,6 +29,6 @@ public function indexAction() /** @Ignore */ t('ignored'); /** @Ignore */ - $translator->trans('ignored'); + $this->translator->trans('ignored'); } } diff --git a/tests/Unit/Model/Customer/Mock/TokenMock.php b/tests/Unit/Model/Customer/Mock/TokenMock.php index cfa13a227d..fcc17fab51 100644 --- a/tests/Unit/Model/Customer/Mock/TokenMock.php +++ b/tests/Unit/Model/Customer/Mock/TokenMock.php @@ -4,8 +4,10 @@ namespace Tests\FrameworkBundle\Unit\Model\Customer\Mock; +use InvalidArgumentException; use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUser; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\User\UserInterface; class TokenMock implements TokenInterface { @@ -45,7 +47,10 @@ public function getCredentials() { } - public function getUser() + /** + * @return \Symfony\Component\Security\Core\User\UserInterface|null + */ + public function getUser(): ?UserInterface { return $this->customerUser; } @@ -73,7 +78,10 @@ public function eraseCredentials() { } - public function getAttributes() + /** + * @return array + */ + public function getAttributes(): array { return []; } @@ -87,17 +95,20 @@ public function setAttributes(array $attributes) /** * @param string $name + * @return bool */ - public function hasAttribute(string $name) + public function hasAttribute(string $name): bool { return true; } /** * @param string $name + * @return mixed */ - public function getAttribute(string $name) + public function getAttribute(string $name): mixed { + throw new InvalidArgumentException(); } /** diff --git a/tests/Unit/Model/Security/LoginListenerTest.php b/tests/Unit/Model/Security/LoginListenerTest.php index 89fe750219..1abe3ae284 100644 --- a/tests/Unit/Model/Security/LoginListenerTest.php +++ b/tests/Unit/Model/Security/LoginListenerTest.php @@ -9,8 +9,6 @@ use Shopsys\FrameworkBundle\Model\Administrator\Activity\AdministratorActivityFacade; use Shopsys\FrameworkBundle\Model\Administrator\Administrator; use Shopsys\FrameworkBundle\Model\Security\LoginListener; -use Shopsys\FrameworkBundle\Model\Security\TimelimitLoginInterface; -use Shopsys\FrameworkBundle\Model\Security\UniqueLoginInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; From 6520e3d834efde46e13352fc7073e7424bac5655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Tue, 5 Nov 2024 12:53:10 +0100 Subject: [PATCH 04/14] added missing depedency for symfony/amqp-messenger --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 4217bbf68e..90d441eb68 100644 --- a/composer.json +++ b/composer.json @@ -90,6 +90,7 @@ "snc/redis-bundle": "^4.4.1", "spatie/opening-hours": "^3.0", "stof/doctrine-extensions-bundle": "^1.3.0", + "symfony/amqp-messenger": "^6.4", "symfony/css-selector": "^6.4", "symfony/dom-crawler": "^6.4", "symfony/error-handler": "^6.4", From 4e3055e6f3df60968a3fdd0258ba7b00c321b826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Wed, 6 Nov 2024 11:17:46 +0100 Subject: [PATCH 05/14] fixed not working shorter versions of route names without app_ and shopsys_framework_ in them after update to Symfony 6.4 --- .../AnnotatedRouteControllerLoader.php | 29 ----------------- .../AttributeRouteControllerLoader.php | 31 +++++++++++++++++++ src/Resources/config/routing.yaml | 2 +- src/Resources/config/services.yaml | 7 +++-- 4 files changed, 36 insertions(+), 33 deletions(-) delete mode 100644 src/Component/AnnotatedRouteControllerLoader.php create mode 100644 src/Component/AttributeRouteControllerLoader.php diff --git a/src/Component/AnnotatedRouteControllerLoader.php b/src/Component/AnnotatedRouteControllerLoader.php deleted file mode 100644 index ad5af5ae84..0000000000 --- a/src/Component/AnnotatedRouteControllerLoader.php +++ /dev/null @@ -1,29 +0,0 @@ - Date: Thu, 7 Nov 2024 11:02:38 +0100 Subject: [PATCH 06/14] fixed UrlListType to work with Symfony 6.4 --- src/Form/UrlListType.php | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Form/UrlListType.php b/src/Form/UrlListType.php index 53d972694e..18eda2a213 100644 --- a/src/Form/UrlListType.php +++ b/src/Form/UrlListType.php @@ -62,23 +62,28 @@ public function buildForm(FormBuilderInterface $builder, array $options) ); foreach ($friendlyUrlsByDomain as $domainId => $friendlyUrls) { - $builder->get('toDelete')->add($domainId, ChoiceType::class, [ - 'required' => false, - 'multiple' => true, - 'expanded' => true, - 'choices' => $friendlyUrls, - 'choice_label' => 'slug', - 'choice_value' => 'slug', - ]); - $builder->get('mainFriendlyUrlsByDomainId')->add($domainId, ChoiceType::class, [ - 'required' => true, - 'multiple' => false, - 'expanded' => true, - 'choices' => $friendlyUrls, - 'choice_label' => 'slug', - 'choice_value' => 'slug', - 'invalid_message' => 'Previously selected main URL dos not exist any more', - ]); + $builder->get('toDelete')->add( + $builder->create((string)$domainId, ChoiceType::class, [ + 'required' => false, + 'multiple' => true, + 'expanded' => true, + 'choices' => $friendlyUrls, + 'choice_label' => 'slug', + 'choice_value' => 'slug', + ]), + ); + + $builder->get('mainFriendlyUrlsByDomainId')->add( + $builder->create((string)$domainId, ChoiceType::class, [ + 'required' => true, + 'multiple' => false, + 'expanded' => true, + 'choices' => $friendlyUrls, + 'choice_label' => 'slug', + 'choice_value' => 'slug', + 'invalid_message' => 'Previously selected main URL dos not exist any more', + ]), + ); } } From 3599d3619b24a70090790af558e7ca5c9af8409a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Fri, 8 Nov 2024 11:51:42 +0100 Subject: [PATCH 07/14] fixed UniqueSlugsOnDomainsValidatorTest after upgrade to Symfony 6.4 - Router::match() now must return array --- .../Component/Constraints/UniqueSlugsOnDomainsValidatorTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Unit/Component/Constraints/UniqueSlugsOnDomainsValidatorTest.php b/tests/Unit/Component/Constraints/UniqueSlugsOnDomainsValidatorTest.php index 04a3f24ae2..dddcaf5e64 100644 --- a/tests/Unit/Component/Constraints/UniqueSlugsOnDomainsValidatorTest.php +++ b/tests/Unit/Component/Constraints/UniqueSlugsOnDomainsValidatorTest.php @@ -38,6 +38,8 @@ protected function createValidator() if ($path !== '/existing-url/') { throw new ResourceNotFoundException(); } + + return []; }); $domainRouterFactoryMock = $this->getMockBuilder(DomainRouterFactory::class) From dbaf55652aec920a9d76657d516bc62a9a0b7464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Fri, 8 Nov 2024 11:56:59 +0100 Subject: [PATCH 08/14] fixed LoginListenerTest now returns correctly object of Symfony\Component\Security\Core\User\UserInterface --- tests/Unit/Model/Security/LoginListenerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Model/Security/LoginListenerTest.php b/tests/Unit/Model/Security/LoginListenerTest.php index 1abe3ae284..eb2047a51e 100644 --- a/tests/Unit/Model/Security/LoginListenerTest.php +++ b/tests/Unit/Model/Security/LoginListenerTest.php @@ -23,7 +23,7 @@ public function testOnSecurityInteractiveLoginUnique(): void ->getMock(); $emMock->expects($this->once())->method('flush'); - $userMock = $this->createMock(UniqueLoginInterface::class); + $userMock = $this->createMock(Administrator::class); $userMock->expects($this->once())->method('setLoginToken'); $tokenMock = $this->createMock(TokenInterface::class); @@ -43,7 +43,7 @@ public function testOnSecurityInteractiveLoginTimeLimit(): void ->getMock(); $emMock->expects($this->atLeastOnce())->method('flush'); - $userMock = $this->createMock(TimelimitLoginInterface::class); + $userMock = $this->createMock(Administrator::class); $userMock->expects($this->once())->method('setLastActivity'); $tokenMock = $this->createMock(TokenInterface::class); From 356515ebcbac8d7c4d0bf46b365f022100e70c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Fri, 8 Nov 2024 13:10:17 +0100 Subject: [PATCH 09/14] fixed profiler after update to Symfony 6.4 --- src/Component/HttpKernel/Profiler/FileProfilerStorage.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Component/HttpKernel/Profiler/FileProfilerStorage.php index 7f4a2a07b7..a8338523d9 100644 --- a/src/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -58,6 +58,7 @@ public function write(Profile $profile): bool $profile->getTime(), $profile->getParentToken(), $profile->getStatusCode(), + $profile->getVirtualType(), ]); fclose($file); } @@ -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); From c3f1da577453949e5394e12d01171099b51df800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Mon, 11 Nov 2024 11:13:57 +0100 Subject: [PATCH 10/14] Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler is marked as lazy to prevent calling Redis during builds on CI that do not actually need Redis --- src/Resources/config/services.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 78d195fccb..273c8bf306 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -1011,6 +1011,12 @@ services: Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface: class: Symfony\Component\HttpFoundation\Session\Flash\FlashBag + Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler: + arguments: + - '@Redis' + - { 'prefix': '%env(REDIS_PREFIX)%session:', ttl: 604800 } + lazy: true + Symfony\Component\Translation\IdentityTranslator: ~ Symfony\Component\Validator\Constraints\FileValidator: From 0c4bc5c244eac5191bc57e92fff040779b0dae54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Mon, 11 Nov 2024 13:00:41 +0100 Subject: [PATCH 11/14] LoginListener now uses LoginSuccessEvent --- src/Model/Security/LoginListener.php | 8 +-- src/Resources/config/services.yaml | 2 +- .../Unit/Model/Security/LoginListenerTest.php | 71 ++++++++----------- 3 files changed, 36 insertions(+), 45 deletions(-) diff --git a/src/Model/Security/LoginListener.php b/src/Model/Security/LoginListener.php index 154ef9b186..3fc5069aec 100644 --- a/src/Model/Security/LoginListener.php +++ b/src/Model/Security/LoginListener.php @@ -8,7 +8,7 @@ use Doctrine\ORM\EntityManagerInterface; use Shopsys\FrameworkBundle\Model\Administrator\Activity\AdministratorActivityFacade; use Shopsys\FrameworkBundle\Model\Administrator\Administrator; -use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; class LoginListener { @@ -23,11 +23,11 @@ public function __construct( } /** - * @param \Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event + * @param \Symfony\Component\Security\Http\Event\LoginSuccessEvent $event */ - public function onSecurityInteractiveLogin(InteractiveLoginEvent $event) + public function onSecurityInteractiveLogin(LoginSuccessEvent $event) { - $token = $event->getAuthenticationToken(); + $token = $event->getAuthenticatedToken(); $user = $token->getUser(); if ($user instanceof TimelimitLoginInterface) { diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 273c8bf306..4e29701db1 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -953,7 +953,7 @@ services: Shopsys\FrameworkBundle\Model\Security\LoginListener: tags: - - { name: kernel.event_listener, event: security.interactive_login, method: onSecurityInteractiveLogin } + - { name: kernel.event_listener, event: Symfony\Component\Security\Http\Event\LoginSuccessEvent, method: onSecurityInteractiveLogin } Shopsys\FrameworkBundle\Model\Security\MenuItemsGrantedRolesSetting: ~ diff --git a/tests/Unit/Model/Security/LoginListenerTest.php b/tests/Unit/Model/Security/LoginListenerTest.php index eb2047a51e..134106c0ba 100644 --- a/tests/Unit/Model/Security/LoginListenerTest.php +++ b/tests/Unit/Model/Security/LoginListenerTest.php @@ -10,61 +10,40 @@ use Shopsys\FrameworkBundle\Model\Administrator\Administrator; use Shopsys\FrameworkBundle\Model\Security\LoginListener; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; class LoginListenerTest extends TestCase { - public function testOnSecurityInteractiveLoginUnique(): void + public function testOnSecurityInteractiveLoginTimeLimit(): void { - $emMock = $this->getMockBuilder(EntityManager::class) - ->onlyMethods(['__construct', 'persist', 'flush']) - ->disableOriginalConstructor() - ->getMock(); - $emMock->expects($this->once())->method('flush'); - - $userMock = $this->createMock(Administrator::class); - $userMock->expects($this->once())->method('setLoginToken'); - - $tokenMock = $this->createMock(TokenInterface::class); - $tokenMock->expects($this->once())->method('getUser')->willReturn($userMock); - - $administratorActivityFacadeMock = $this->createMock(AdministratorActivityFacade::class); + $administratorMock = $this->createMock(Administrator::class); + $administratorMock->expects($this->once())->method('setLastActivity'); - $loginListener = new LoginListener($emMock, $administratorActivityFacadeMock); - $loginListener->onSecurityInteractiveLogin(new InteractiveLoginEvent(new Request(), $tokenMock)); + $this->callOnSecurityInteractiveLogin($administratorMock); } - public function testOnSecurityInteractiveLoginTimeLimit(): void + public function testOnSecurityInteractiveLoginAdministrator(): void { - $emMock = $this->getMockBuilder(EntityManager::class) - ->onlyMethods(['__construct', 'persist', 'flush']) - ->disableOriginalConstructor() - ->getMock(); - $emMock->expects($this->atLeastOnce())->method('flush'); - - $userMock = $this->createMock(Administrator::class); - $userMock->expects($this->once())->method('setLastActivity'); - - $tokenMock = $this->createMock(TokenInterface::class); - $tokenMock->expects($this->once())->method('getUser')->willReturn($userMock); - - $administratorActivityFacadeMock = $this->createMock(AdministratorActivityFacade::class); + $administratorMock = $this->createMock(Administrator::class); + $administratorMock->expects($this->once())->method('setLoginToken'); - $loginListener = new LoginListener($emMock, $administratorActivityFacadeMock); - $loginListener->onSecurityInteractiveLogin(new InteractiveLoginEvent(new Request(), $tokenMock)); + $this->callOnSecurityInteractiveLogin($administratorMock); } - public function testOnSecurityInteractiveLoginAdministrator(): void + /** + * @param \Shopsys\FrameworkBundle\Model\Administrator\Administrator $administratorMock + * @return \Shopsys\FrameworkBundle\Model\Security\LoginListener + */ + protected function callOnSecurityInteractiveLogin(Administrator $administratorMock): LoginListener { $emMock = $this->getMockBuilder(EntityManager::class) ->onlyMethods(['__construct', 'persist', 'flush']) ->disableOriginalConstructor() ->getMock(); - $emMock->expects($this->once())->method('flush'); - - $administratorMock = $this->createMock(Administrator::class); - $administratorMock->expects($this->once())->method('setLoginToken'); $tokenMock = $this->createMock(TokenInterface::class); $tokenMock->expects($this->once())->method('getUser')->willReturn($administratorMock); @@ -73,9 +52,21 @@ public function testOnSecurityInteractiveLoginAdministrator(): void ->onlyMethods(['create']) ->disableOriginalConstructor() ->getMock(); - $administratorActivityFacadeMock->expects($this->once())->method('create'); $loginListener = new LoginListener($emMock, $administratorActivityFacadeMock); - $loginListener->onSecurityInteractiveLogin(new InteractiveLoginEvent(new Request(), $tokenMock)); + + $authenticatorMock = $this->getMockBuilder(AuthenticatorInterface::class) + ->getMock(); + + $passportMock = $this->getMockBuilder(Passport::class) + ->disableOriginalConstructor() + ->getMock(); + + $responseMock = $this->getMockBuilder(Response::class) + ->getMock(); + + $loginListener->onSecurityInteractiveLogin(new LoginSuccessEvent($authenticatorMock, $passportMock, $tokenMock, new Request(), $responseMock, 'test-firewall')); + + return $loginListener; } } From 6bcf7ae9980d5fcdf7bd5ac8479d36c1c79f8762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Tue, 12 Nov 2024 16:32:32 +0100 Subject: [PATCH 12/14] resolved missing typehints reported to be introduced in next package versions --- src/Command/RouterDebugCommandForDomain.php | 2 +- src/Command/RouterMatchCommandForDomain.php | 2 +- src/Component/Form/TimedFormTypeExtension.php | 12 ++++---- .../Compiler/AddConstraintValidatorsPass.php | 2 +- .../RegisterCronModulesCompilerPass.php | 2 +- .../RegisterExtendedEntitiesCompilerPass.php | 2 +- ...ultiDesignFilesystemLoaderCompilerPass.php | 2 +- ...gisterPluginCrudExtensionsCompilerPass.php | 9 ++++-- ...RegisterPluginDataFixturesCompilerPass.php | 4 +-- .../ShopsysFrameworkExtension.php | 4 +-- src/Form/AbstractMultiplePickerType.php | 4 +-- .../Administrator/AdministratorFormType.php | 10 +++---- .../AdministratorRoleGroupFormType.php | 4 +-- src/Form/Admin/Advert/AdvertFormType.php | 19 ++++-------- src/Form/Admin/Article/ArticleFormType.php | 10 +++---- .../BestsellingProductFormType.php | 4 +-- src/Form/Admin/Category/CategoryFormType.php | 10 +++---- .../TopCategory/TopCategoriesFormType.php | 4 +-- .../Complaint/Status/ComplaintItemsType.php | 2 +- .../ContactFormSettingsFormType.php | 4 +-- .../BillingAddressAndRelatedInfoFormType.php | 4 +-- .../Admin/Customer/BillingAddressFormType.php | 6 ++-- .../Customer/DeliveryAddressFormType.php | 4 +-- .../CustomerUserRoleGroupFormType.php | 4 +-- .../Customer/User/CustomerUserFormType.php | 4 +-- .../User/CustomerUserUpdateFormType.php | 4 +-- src/Form/Admin/Domain/DomainFormType.php | 6 ++-- .../HeurekaShopCertificationFormType.php | 4 +-- .../LegalConditionsSettingFormType.php | 4 +-- src/Form/Admin/Login/LoginFormType.php | 4 +-- src/Form/Admin/Mail/MailSettingFormType.php | 4 +-- src/Form/Admin/Mail/MailTemplateFormType.php | 10 +++---- src/Form/Admin/Module/ModulesFormType.php | 4 +-- .../Navigation/NavigationItemFormType.php | 6 ++-- src/Form/Admin/Order/OrderFormType.php | 6 ++-- src/Form/Admin/Order/OrderItemFormType.php | 6 ++-- src/Form/Admin/Order/OrderPaymentFormType.php | 4 +-- .../Admin/Order/OrderTransportFormType.php | 4 +-- .../Order/Status/OrderStatusFormType.php | 4 +-- .../PaymentTransactionsType.php | 4 +-- .../PersonalData/PersonalDataFormType.php | 2 +- .../Pricing/Currency/CurrencyFormType.php | 5 ++-- .../Currency/CurrencySettingsFormType.php | 4 +-- .../Pricing/Group/PricingGroupFormType.php | 4 +-- .../Group/PricingGroupSettingsFormType.php | 4 +-- .../Admin/Product/Brand/BrandFormType.php | 4 +-- src/Form/Admin/Product/Flag/FlagFormType.php | 4 +-- .../ProductParameterValueFormType.php | 4 +-- .../ParameterValueConversionFormType.php | 6 ++-- .../SliderParameterValuesUpdateFormType.php | 4 +-- .../Product/ProductMassActionFormType.php | 4 +-- .../TopProduct/TopProductsFormType.php | 4 +-- src/Form/Admin/Product/Unit/UnitFormType.php | 4 +-- .../Product/Unit/UnitSettingFormType.php | 4 +-- src/Form/Admin/Product/VariantFormType.php | 8 ++--- .../Constraint/UniqueFlagsValidator.php | 2 +- .../Admin/PromoCode/PromoCodeFormType.php | 2 +- .../Admin/PromoCode/PromoCodeLimitType.php | 4 +-- .../Admin/QuickSearch/QuickSearchFormType.php | 4 +-- .../SalesRepresentativeFormType.php | 12 ++++---- src/Form/Admin/Slider/SliderItemFormType.php | 8 ++--- .../Superadmin/InputPriceTypeFormType.php | 4 +-- .../Transport/Price/PriceWithLimitType.php | 12 +------- .../Admin/Transport/TransportFormType.php | 4 +-- ...TransportAndPaymentPriceLimitsFormType.php | 14 ++++----- .../UploadedFile/UploadedFileFormType.php | 4 +-- src/Form/Admin/Vat/VatFormType.php | 8 ++--- src/Form/Admin/Vat/VatSettingsFormType.php | 4 +-- src/Form/BasicFileUploadType.php | 4 +-- src/Form/CategoriesType.php | 6 ++-- src/Form/CategoryCheckboxType.php | 4 +-- src/Form/CollectionTypeExtension.php | 4 +-- src/Form/Constraints/ContainsValidator.php | 2 +- src/Form/Constraints/Country.php | 5 ++-- src/Form/Constraints/CountryValidator.php | 2 +- src/Form/Constraints/EmailValidator.php | 4 +-- .../FieldsAreNotIdenticalValidator.php | 4 +-- .../FileAbstractFilesystemValidator.php | 2 +- .../FileAllowedExtensionValidator.php | 2 +- .../FileExtensionMaxLengthValidator.php | 2 +- .../ImageAbstractFilesystemValidator.php | 2 +- src/Form/Constraints/MoneyRangeValidator.php | 2 +- .../NotIdenticalToEmailLocalPartValidator.php | 2 +- src/Form/Constraints/NotInArray.php | 3 -- src/Form/Constraints/NotInArrayValidator.php | 2 +- .../NotNegativeMoneyAmountValidator.php | 2 +- .../NotSelectedDomainToShowValidator.php | 4 +-- src/Form/Constraints/UniqueBillingAddress.php | 5 ++-- .../UniqueBillingAddressValidator.php | 3 +- .../Constraints/UniqueCollectionValidator.php | 12 ++++---- src/Form/Constraints/UniqueEmailValidator.php | 2 +- .../UniqueProductCatnumValidator.php | 2 +- .../UniqueProductParametersValidator.php | 2 +- .../UniqueSlugsOnDomainsValidator.php | 4 +-- .../Constraints/WhitelistPatternValidator.php | 2 +- src/Form/CustomerUserListType.php | 13 ++------ src/Form/DatePickerType.php | 5 ++-- src/Form/DeliveryAddressListType.php | 13 ++------ src/Form/DisplayOnlyCompanyNameType.php | 4 +-- src/Form/DisplayOnlyCustomerType.php | 4 +-- src/Form/DisplayOnlyDomainIconType.php | 4 +-- src/Form/DisplayOnlyType.php | 11 +------ src/Form/DisplayOnlyUrlType.php | 4 +-- src/Form/DisplayVariablesType.php | 13 ++------ src/Form/DomainsType.php | 2 +- src/Form/EmptyMessageChoiceTypeExtension.php | 4 +-- src/Form/FileUploadType.php | 2 +- src/Form/FilesType.php | 2 +- .../FormRenderingConfigurationExtension.php | 6 ++-- src/Form/FriendlyUrlType.php | 4 +-- src/Form/GrapesJsType.php | 6 ++-- src/Form/GroupType.php | 2 +- src/Form/HoneyPotType.php | 2 +- src/Form/ImageUploadType.php | 10 +++---- src/Form/InvertChoiceTypeExtension.php | 6 ++-- src/Form/Locale/LocalizedType.php | 4 +-- src/Form/MoneyTypeExtension.php | 8 ++--- src/Form/MultiLocaleBasicFileUploadType.php | 2 +- src/Form/MultiLocaleFileUploadType.php | 5 +++- src/Form/OrderItemsType.php | 6 ++-- src/Form/ProductType.php | 6 ++-- src/Form/ProductsType.php | 6 ++-- src/Form/RolesType.php | 2 +- src/Form/SingleCheckboxChoiceType.php | 5 ++-- src/Form/SortableValuesType.php | 4 +-- src/Form/UrlListType.php | 30 +++++++++---------- src/Form/WarningMessageType.php | 2 +- src/Model/Administrator/Administrator.php | 2 +- src/Model/Customer/User/CustomerUser.php | 2 +- src/Model/Security/AdministratorChecker.php | 2 +- 130 files changed, 291 insertions(+), 357 deletions(-) diff --git a/src/Command/RouterDebugCommandForDomain.php b/src/Command/RouterDebugCommandForDomain.php index 0ae1b1a1fd..1e3496fd17 100644 --- a/src/Command/RouterDebugCommandForDomain.php +++ b/src/Command/RouterDebugCommandForDomain.php @@ -40,7 +40,7 @@ public function __construct( /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setDefinition([ diff --git a/src/Command/RouterMatchCommandForDomain.php b/src/Command/RouterMatchCommandForDomain.php index 4b261a2e1b..7dab3e2374 100644 --- a/src/Command/RouterMatchCommandForDomain.php +++ b/src/Command/RouterMatchCommandForDomain.php @@ -38,7 +38,7 @@ public function __construct( /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setDefinition([ diff --git a/src/Component/Form/TimedFormTypeExtension.php b/src/Component/Form/TimedFormTypeExtension.php index e6b936caef..e6b5cb082c 100644 --- a/src/Component/Form/TimedFormTypeExtension.php +++ b/src/Component/Form/TimedFormTypeExtension.php @@ -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 @@ -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; @@ -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()); @@ -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, diff --git a/src/DependencyInjection/Compiler/AddConstraintValidatorsPass.php b/src/DependencyInjection/Compiler/AddConstraintValidatorsPass.php index 02404b97b6..dbf68afef7 100644 --- a/src/DependencyInjection/Compiler/AddConstraintValidatorsPass.php +++ b/src/DependencyInjection/Compiler/AddConstraintValidatorsPass.php @@ -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; diff --git a/src/DependencyInjection/Compiler/RegisterCronModulesCompilerPass.php b/src/DependencyInjection/Compiler/RegisterCronModulesCompilerPass.php index 0d345db411..66b86d9866 100644 --- a/src/DependencyInjection/Compiler/RegisterCronModulesCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegisterCronModulesCompilerPass.php @@ -15,7 +15,7 @@ class RegisterCronModulesCompilerPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $cronConfigDefinition = $container->findDefinition(CronConfig::class); diff --git a/src/DependencyInjection/Compiler/RegisterExtendedEntitiesCompilerPass.php b/src/DependencyInjection/Compiler/RegisterExtendedEntitiesCompilerPass.php index 7e6e7ea33e..b0d12d05b7 100644 --- a/src/DependencyInjection/Compiler/RegisterExtendedEntitiesCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegisterExtendedEntitiesCompilerPass.php @@ -13,7 +13,7 @@ class RegisterExtendedEntitiesCompilerPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { /** @var \Doctrine\ORM\Mapping\Driver\AnnotationDriver $annotationReader */ $annotationReader = $container->get('doctrine.orm.default_metadata_driver'); diff --git a/src/DependencyInjection/Compiler/RegisterMultiDesignFilesystemLoaderCompilerPass.php b/src/DependencyInjection/Compiler/RegisterMultiDesignFilesystemLoaderCompilerPass.php index 2fe7ccbdf0..fe9654d562 100644 --- a/src/DependencyInjection/Compiler/RegisterMultiDesignFilesystemLoaderCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegisterMultiDesignFilesystemLoaderCompilerPass.php @@ -14,7 +14,7 @@ class RegisterMultiDesignFilesystemLoaderCompilerPass implements CompilerPassInt /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $twigFilesystemLoaderDefinition = $container->getDefinition('twig.loader.native_filesystem'); $twigFilesystemLoaderDefinition->setClass(FilesystemLoader::class); diff --git a/src/DependencyInjection/Compiler/RegisterPluginCrudExtensionsCompilerPass.php b/src/DependencyInjection/Compiler/RegisterPluginCrudExtensionsCompilerPass.php index 8db1d69535..37c5b2270a 100644 --- a/src/DependencyInjection/Compiler/RegisterPluginCrudExtensionsCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegisterPluginCrudExtensionsCompilerPass.php @@ -15,7 +15,7 @@ class RegisterPluginCrudExtensionsCompilerPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $pluginCrudExtensionRegistryDefinition = $container->findDefinition( PluginCrudExtensionRegistry::class, @@ -35,8 +35,11 @@ public function process(ContainerBuilder $container) * @param string $serviceId * @param string $type */ - private function registerPluginCrudExtension(Definition $pluginCrudExtensionRegistryDefinition, $serviceId, $type) - { + private function registerPluginCrudExtension( + Definition $pluginCrudExtensionRegistryDefinition, + string $serviceId, + string $type, + ): void { PluginCrudExtensionRegistry::assertTypeIsKnown($type); $pluginCrudExtensionRegistryDefinition->addMethodCall( diff --git a/src/DependencyInjection/Compiler/RegisterPluginDataFixturesCompilerPass.php b/src/DependencyInjection/Compiler/RegisterPluginDataFixturesCompilerPass.php index fc2c75a6fa..74e83e265c 100644 --- a/src/DependencyInjection/Compiler/RegisterPluginDataFixturesCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegisterPluginDataFixturesCompilerPass.php @@ -15,7 +15,7 @@ class RegisterPluginDataFixturesCompilerPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $pluginDataFixtureRegistryDefinition = $container->findDefinition( PluginDataFixtureRegistry::class, @@ -31,7 +31,7 @@ public function process(ContainerBuilder $container) * @param \Symfony\Component\DependencyInjection\Definition $pluginDataFixtureRegistryDefinition * @param string $serviceId */ - private function registerDataFixture(Definition $pluginDataFixtureRegistryDefinition, $serviceId) + private function registerDataFixture(Definition $pluginDataFixtureRegistryDefinition, string $serviceId): void { $pluginDataFixtureRegistryDefinition->addMethodCall('registerDataFixture', [new Reference($serviceId)]); } diff --git a/src/DependencyInjection/ShopsysFrameworkExtension.php b/src/DependencyInjection/ShopsysFrameworkExtension.php index faebc555fd..19cff4732d 100644 --- a/src/DependencyInjection/ShopsysFrameworkExtension.php +++ b/src/DependencyInjection/ShopsysFrameworkExtension.php @@ -25,7 +25,7 @@ class ShopsysFrameworkExtension extends Extension implements PrependExtensionInt /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('directories.yaml'); @@ -87,7 +87,7 @@ protected function configureVarDumperTwigExtension(ContainerBuilder $container): /** * {@inheritdoc} */ - public function prepend(ContainerBuilder $container) + public function prepend(ContainerBuilder $container): void { $container->prependExtensionConfig('doctrine_migrations', [ 'migrations_paths' => [ diff --git a/src/Form/AbstractMultiplePickerType.php b/src/Form/AbstractMultiplePickerType.php index 5f549286d6..9e14ca359e 100644 --- a/src/Form/AbstractMultiplePickerType.php +++ b/src/Form/AbstractMultiplePickerType.php @@ -25,7 +25,7 @@ public function __construct( /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $itemRoute = $options['item_route']; @@ -52,7 +52,7 @@ public function buildView(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([ 'entry_type' => HiddenType::class, diff --git a/src/Form/Admin/Administrator/AdministratorFormType.php b/src/Form/Admin/Administrator/AdministratorFormType.php index 796419be74..dc4ccee521 100644 --- a/src/Form/Admin/Administrator/AdministratorFormType.php +++ b/src/Form/Admin/Administrator/AdministratorFormType.php @@ -28,8 +28,8 @@ class AdministratorFormType extends AbstractType { - public const SCENARIO_CREATE = 'create'; - public const SCENARIO_EDIT = 'edit'; + public const string SCENARIO_CREATE = 'create'; + public const string SCENARIO_EDIT = 'edit'; /** * @param \Symfony\Component\Security\Core\Security $security @@ -47,7 +47,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 { $builderSettingsGroup = $builder->create('settings', GroupType::class, [ 'label' => t('Settings'), @@ -172,7 +172,7 @@ private function getAdministratorRolesList(Administrator $administrator): string * @param string $scenario * @return \Symfony\Component\Validator\Constraint[] */ - private function getFirstPasswordConstraints($scenario) + private function getFirstPasswordConstraints(string $scenario): array { $constraints = [ new Constraints\Length( @@ -192,7 +192,7 @@ private function getFirstPasswordConstraints($scenario) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['administrator', 'scenario']) diff --git a/src/Form/Admin/Administrator/AdministratorRoleGroupFormType.php b/src/Form/Admin/Administrator/AdministratorRoleGroupFormType.php index 02aad5f9de..010e2a71c3 100644 --- a/src/Form/Admin/Administrator/AdministratorRoleGroupFormType.php +++ b/src/Form/Admin/Administrator/AdministratorRoleGroupFormType.php @@ -19,7 +19,7 @@ class AdministratorRoleGroupFormType 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('name', TextType::class, [ 'constraints' => [ @@ -40,7 +40,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ diff --git a/src/Form/Admin/Advert/AdvertFormType.php b/src/Form/Admin/Advert/AdvertFormType.php index 8f82186de4..9da9cd4320 100644 --- a/src/Form/Admin/Advert/AdvertFormType.php +++ b/src/Form/Admin/Advert/AdvertFormType.php @@ -28,10 +28,10 @@ class AdvertFormType extends AbstractType { - public const VALIDATION_GROUP_TYPE_IMAGE = 'typeImage'; - public const VALIDATION_GROUP_TYPE_CODE = 'typeCode'; - public const SCENARIO_CREATE = 'create'; - public const SCENARIO_EDIT = 'edit'; + public const string VALIDATION_GROUP_TYPE_IMAGE = 'typeImage'; + public const string VALIDATION_GROUP_TYPE_CODE = 'typeCode'; + public const string SCENARIO_CREATE = 'create'; + public const string SCENARIO_EDIT = 'edit'; /** * @param \Shopsys\FrameworkBundle\Model\Advert\AdvertPositionRegistry $advertPositionRegistry @@ -47,15 +47,8 @@ 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 { - $imageConstraints = [ - new Constraints\NotBlank([ - 'message' => 'Choose image', - 'groups' => [static::VALIDATION_GROUP_TYPE_IMAGE], - ]), - ]; - $builderSettingsGroup = $builder->create('settings', GroupType::class, [ 'label' => t('Settings'), ]); @@ -214,7 +207,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['scenario', 'advert', 'web_image_exists', 'mobile_image_exists']) diff --git a/src/Form/Admin/Article/ArticleFormType.php b/src/Form/Admin/Article/ArticleFormType.php index 9b8f1e2e69..9c04001dce 100644 --- a/src/Form/Admin/Article/ArticleFormType.php +++ b/src/Form/Admin/Article/ArticleFormType.php @@ -30,8 +30,8 @@ class ArticleFormType extends AbstractType { - private const VALIDATION_GROUP_TYPE_SITE = 'typeSite'; - private const VALIDATION_GROUP_TYPE_LINK = 'typeLink'; + private const string VALIDATION_GROUP_TYPE_SITE = 'typeSite'; + private const string VALIDATION_GROUP_TYPE_LINK = 'typeLink'; /** * @param \Shopsys\FrameworkBundle\Model\Seo\SeoSettingFacade $seoSettingFacade @@ -49,7 +49,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 { $seoMetaDescriptionAttributes = $this->getSeoMetaDescriptionAttributes($options); @@ -193,7 +193,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['article', 'domain_id']) @@ -223,7 +223,7 @@ public function configureOptions(OptionsResolver $resolver) * @param array $options * @return string[] */ - private function getSeoMetaDescriptionAttributes(array $options) + private function getSeoMetaDescriptionAttributes(array $options): array { $seoMetaDescriptionAttributes = []; diff --git a/src/Form/Admin/BestsellingProduct/BestsellingProductFormType.php b/src/Form/Admin/BestsellingProduct/BestsellingProductFormType.php index d44a6e2e4a..41af073b22 100644 --- a/src/Form/Admin/BestsellingProduct/BestsellingProductFormType.php +++ b/src/Form/Admin/BestsellingProduct/BestsellingProductFormType.php @@ -19,7 +19,7 @@ class BestsellingProductFormType 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('products', FormType::class, [ @@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => [ diff --git a/src/Form/Admin/Category/CategoryFormType.php b/src/Form/Admin/Category/CategoryFormType.php index 0faf8a2b3b..5de4faacb8 100644 --- a/src/Form/Admin/Category/CategoryFormType.php +++ b/src/Form/Admin/Category/CategoryFormType.php @@ -34,8 +34,8 @@ class CategoryFormType extends AbstractType { - public const SCENARIO_CREATE = 'create'; - public const SCENARIO_EDIT = 'edit'; + public const string SCENARIO_CREATE = 'create'; + public const string SCENARIO_EDIT = 'edit'; /** * @param \Shopsys\FrameworkBundle\Model\Category\CategoryFacade $categoryFacade @@ -59,7 +59,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 { $seoTitlesOptionsByDomainId = []; $seoMetaDescriptionsOptionsByDomainId = []; @@ -240,7 +240,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['scenario', 'category']) @@ -257,7 +257,7 @@ public function configureOptions(OptionsResolver $resolver) * @param \Shopsys\FrameworkBundle\Model\Category\Category|null $category * @return string */ - private function getCategoryNameForPlaceholder(DomainConfig $domainConfig, ?Category $category = null) + private function getCategoryNameForPlaceholder(DomainConfig $domainConfig, ?Category $category = null): string { $domainLocale = $domainConfig->getLocale(); diff --git a/src/Form/Admin/Category/TopCategory/TopCategoriesFormType.php b/src/Form/Admin/Category/TopCategory/TopCategoriesFormType.php index 0cd5e8f239..d3ce13895c 100644 --- a/src/Form/Admin/Category/TopCategory/TopCategoriesFormType.php +++ b/src/Form/Admin/Category/TopCategory/TopCategoriesFormType.php @@ -31,7 +31,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 { $categoryPaths = $this->categoryFacade->getFullPathsIndexedByIdsForDomain( $options['domain_id'], @@ -54,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['domain_id', 'locale']) diff --git a/src/Form/Admin/Complaint/Status/ComplaintItemsType.php b/src/Form/Admin/Complaint/Status/ComplaintItemsType.php index 3c9516a8b1..1cdccb077f 100644 --- a/src/Form/Admin/Complaint/Status/ComplaintItemsType.php +++ b/src/Form/Admin/Complaint/Status/ComplaintItemsType.php @@ -12,7 +12,7 @@ class ComplaintItemsType extends AbstractType /** * {@inheritdoc} */ - public function getParent() + public function getParent(): ?string { return CollectionType::class; } diff --git a/src/Form/Admin/ContactForm/ContactFormSettingsFormType.php b/src/Form/Admin/ContactForm/ContactFormSettingsFormType.php index 522a9ae86b..8d0ec9f1f4 100644 --- a/src/Form/Admin/ContactForm/ContactFormSettingsFormType.php +++ b/src/Form/Admin/ContactForm/ContactFormSettingsFormType.php @@ -18,7 +18,7 @@ class ContactFormSettingsFormType 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 { $builderSettingsGroup = $builder->create('settings', GroupType::class, [ 'label' => t('Settings'), @@ -38,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => ContactFormSettingsData::class, diff --git a/src/Form/Admin/Customer/BillingAddressAndRelatedInfoFormType.php b/src/Form/Admin/Customer/BillingAddressAndRelatedInfoFormType.php index 59b6729baf..eac7571f9e 100644 --- a/src/Form/Admin/Customer/BillingAddressAndRelatedInfoFormType.php +++ b/src/Form/Admin/Customer/BillingAddressAndRelatedInfoFormType.php @@ -20,7 +20,7 @@ class BillingAddressAndRelatedInfoFormType 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('customerUsers', CustomerUserListType::class, [ @@ -46,7 +46,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['customer', 'domain_id']) diff --git a/src/Form/Admin/Customer/BillingAddressFormType.php b/src/Form/Admin/Customer/BillingAddressFormType.php index a458f16b84..d936bab70c 100644 --- a/src/Form/Admin/Customer/BillingAddressFormType.php +++ b/src/Form/Admin/Customer/BillingAddressFormType.php @@ -20,7 +20,7 @@ class BillingAddressFormType extends AbstractType { - public const VALIDATION_GROUP_COMPANY_CUSTOMER = 'companyCustomer'; + public const string VALIDATION_GROUP_COMPANY_CUSTOMER = 'companyCustomer'; /** * @param \Shopsys\FrameworkBundle\Model\Country\CountryFacade $countryFacade @@ -33,7 +33,7 @@ public function __construct(private readonly CountryFacade $countryFacade) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $countries = $this->countryFacade->getAllEnabledOnDomain($options['domain_id']); @@ -168,7 +168,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('domain_id') diff --git a/src/Form/Admin/Customer/DeliveryAddressFormType.php b/src/Form/Admin/Customer/DeliveryAddressFormType.php index 10410ae2b7..ecd69a2de0 100644 --- a/src/Form/Admin/Customer/DeliveryAddressFormType.php +++ b/src/Form/Admin/Customer/DeliveryAddressFormType.php @@ -27,7 +27,7 @@ public function __construct(private readonly CountryFacade $countryFacade) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $countries = $this->countryFacade->getAllEnabledOnDomain($options['domain_id']); @@ -120,7 +120,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('domain_id') diff --git a/src/Form/Admin/Customer/RoleGroup/CustomerUserRoleGroupFormType.php b/src/Form/Admin/Customer/RoleGroup/CustomerUserRoleGroupFormType.php index 8524913786..fec68eff58 100644 --- a/src/Form/Admin/Customer/RoleGroup/CustomerUserRoleGroupFormType.php +++ b/src/Form/Admin/Customer/RoleGroup/CustomerUserRoleGroupFormType.php @@ -27,7 +27,7 @@ public function __construct(protected readonly CustomerUserRole $customerUserRol * @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('names', LocalizedType::class, [ 'required' => true, @@ -55,7 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ diff --git a/src/Form/Admin/Customer/User/CustomerUserFormType.php b/src/Form/Admin/Customer/User/CustomerUserFormType.php index 345226cb31..e9da6d0571 100644 --- a/src/Form/Admin/Customer/User/CustomerUserFormType.php +++ b/src/Form/Admin/Customer/User/CustomerUserFormType.php @@ -63,7 +63,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 { $this->customerUser = $options['customerUser']; $domain = $this->domain->getDomainConfigById($options['domain_id']); @@ -263,7 +263,7 @@ public function validateUniqueEmail(?string $email, ExecutionContextInterface $c /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['customerUser', 'domain_id']) diff --git a/src/Form/Admin/Customer/User/CustomerUserUpdateFormType.php b/src/Form/Admin/Customer/User/CustomerUserUpdateFormType.php index dd72ac562f..cdaa2959e5 100644 --- a/src/Form/Admin/Customer/User/CustomerUserUpdateFormType.php +++ b/src/Form/Admin/Customer/User/CustomerUserUpdateFormType.php @@ -33,7 +33,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 { $builder ->add('customerUserData', CustomerUserFormType::class, [ @@ -69,7 +69,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['customerUser', 'domain_id']) diff --git a/src/Form/Admin/Domain/DomainFormType.php b/src/Form/Admin/Domain/DomainFormType.php index 23a997f27b..e02572c3e7 100644 --- a/src/Form/Admin/Domain/DomainFormType.php +++ b/src/Form/Admin/Domain/DomainFormType.php @@ -13,13 +13,13 @@ class DomainFormType extends AbstractType { - public const FIELD_ICON = 'icon'; + public const string FIELD_ICON = 'icon'; /** * @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(self::FIELD_ICON, ImageUploadType::class, [ @@ -41,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Heureka/HeurekaShopCertificationFormType.php b/src/Form/Admin/Heureka/HeurekaShopCertificationFormType.php index 49030b7081..2d53f7970d 100644 --- a/src/Form/Admin/Heureka/HeurekaShopCertificationFormType.php +++ b/src/Form/Admin/Heureka/HeurekaShopCertificationFormType.php @@ -19,7 +19,7 @@ class HeurekaShopCertificationFormType 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 { $builderSettingsGroup = $builder->create('settings', GroupType::class, [ 'label' => t('Settings'), @@ -59,7 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('server_name') diff --git a/src/Form/Admin/LegalConditions/LegalConditionsSettingFormType.php b/src/Form/Admin/LegalConditions/LegalConditionsSettingFormType.php index 2b6dcafaae..35b55f44ca 100644 --- a/src/Form/Admin/LegalConditions/LegalConditionsSettingFormType.php +++ b/src/Form/Admin/LegalConditions/LegalConditionsSettingFormType.php @@ -25,7 +25,7 @@ public function __construct(private readonly ArticleFacade $articleFacade) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $articles = $this->articleFacade->getAllByDomainId($options['domain_id']); @@ -71,7 +71,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('domain_id') diff --git a/src/Form/Admin/Login/LoginFormType.php b/src/Form/Admin/Login/LoginFormType.php index bc33da7007..659109516d 100644 --- a/src/Form/Admin/Login/LoginFormType.php +++ b/src/Form/Admin/Login/LoginFormType.php @@ -19,7 +19,7 @@ class LoginFormType 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('username', TextType::class, [ @@ -46,7 +46,7 @@ public function getBlockPrefix(): string /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => Administrator::class, diff --git a/src/Form/Admin/Mail/MailSettingFormType.php b/src/Form/Admin/Mail/MailSettingFormType.php index 00e0d4a0bd..f112d59cf0 100644 --- a/src/Form/Admin/Mail/MailSettingFormType.php +++ b/src/Form/Admin/Mail/MailSettingFormType.php @@ -21,7 +21,7 @@ class MailSettingFormType 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 { $builderSettingsGroup = $builder->create('settings', GroupType::class, [ 'label' => t('Settings'), @@ -74,7 +74,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Mail/MailTemplateFormType.php b/src/Form/Admin/Mail/MailTemplateFormType.php index 475921bafe..e0afcc733c 100644 --- a/src/Form/Admin/Mail/MailTemplateFormType.php +++ b/src/Form/Admin/Mail/MailTemplateFormType.php @@ -24,13 +24,13 @@ class MailTemplateFormType extends AbstractType { - public const VALIDATION_GROUP_SEND_MAIL = 'sendMail'; + public const string VALIDATION_GROUP_SEND_MAIL = 'sendMail'; /** * @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('subject', TextType::class, [ @@ -87,7 +87,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) * @param array $options * @return \Symfony\Component\Validator\Constraint[] */ - private function getSubjectConstraints(array $options) + private function getSubjectConstraints(array $options): array { $subjectConstraints = []; @@ -115,7 +115,7 @@ private function getSubjectConstraints(array $options) * @param array $options * @return \Symfony\Component\Validator\Constraint[] */ - private function getBodyConstraints(array $options) + private function getBodyConstraints(array $options): array { $bodyConstraints = []; @@ -138,7 +138,7 @@ private function getBodyConstraints(array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['required_subject_variables', 'required_body_variables', 'entity', 'allow_disable_sending']) diff --git a/src/Form/Admin/Module/ModulesFormType.php b/src/Form/Admin/Module/ModulesFormType.php index 653a7c13b5..0edf196cbc 100644 --- a/src/Form/Admin/Module/ModulesFormType.php +++ b/src/Form/Admin/Module/ModulesFormType.php @@ -18,7 +18,7 @@ class ModulesFormType 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('modules', FormType::class) @@ -38,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('module_list') diff --git a/src/Form/Admin/Navigation/NavigationItemFormType.php b/src/Form/Admin/Navigation/NavigationItemFormType.php index 8f262f3200..32f269bff8 100644 --- a/src/Form/Admin/Navigation/NavigationItemFormType.php +++ b/src/Form/Admin/Navigation/NavigationItemFormType.php @@ -43,7 +43,7 @@ public function __construct( /** * @return string */ - public function getName() + public function getName(): string { return 'navigation_item_form'; } @@ -53,7 +53,7 @@ public function getName() * @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('domainId', DomainType::class, [ @@ -81,7 +81,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('navigationItem') diff --git a/src/Form/Admin/Order/OrderFormType.php b/src/Form/Admin/Order/OrderFormType.php index e537681ab3..2bc4ad0137 100644 --- a/src/Form/Admin/Order/OrderFormType.php +++ b/src/Form/Admin/Order/OrderFormType.php @@ -38,7 +38,7 @@ class OrderFormType extends AbstractType { - public const VALIDATION_GROUP_DELIVERY_ADDRESS_SAME_AS_BILLING_ADDRESS = 'deliveryAddressSameAsBillingAddress'; + public const string VALIDATION_GROUP_DELIVERY_ADDRESS_SAME_AS_BILLING_ADDRESS = 'deliveryAddressSameAsBillingAddress'; /** * @param \Shopsys\FrameworkBundle\Model\Country\CountryFacade $countryFacade @@ -58,7 +58,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 { /** @var \Shopsys\FrameworkBundle\Model\Order\Order $order */ $order = $options['order']; @@ -82,7 +82,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('order') diff --git a/src/Form/Admin/Order/OrderItemFormType.php b/src/Form/Admin/Order/OrderItemFormType.php index ad7fae6342..363259e089 100644 --- a/src/Form/Admin/Order/OrderItemFormType.php +++ b/src/Form/Admin/Order/OrderItemFormType.php @@ -22,7 +22,7 @@ class OrderItemFormType extends AbstractType { - public const VALIDATION_GROUP_NOT_USING_PRICE_CALCULATION = 'notUsingPriceCalculation'; + public const string VALIDATION_GROUP_NOT_USING_PRICE_CALCULATION = 'notUsingPriceCalculation'; /** * @param \Shopsys\FrameworkBundle\Model\Order\Item\OrderItemDataFactory $orderItemDataFactory @@ -36,7 +36,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 { $builder ->add('name', TextType::class, [ @@ -120,7 +120,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => OrderItemData::class, diff --git a/src/Form/Admin/Order/OrderPaymentFormType.php b/src/Form/Admin/Order/OrderPaymentFormType.php index 126f082431..d5b10a418c 100644 --- a/src/Form/Admin/Order/OrderPaymentFormType.php +++ b/src/Form/Admin/Order/OrderPaymentFormType.php @@ -23,7 +23,7 @@ class OrderPaymentFormType 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('payment', ChoiceType::class, [ @@ -68,7 +68,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('payments') diff --git a/src/Form/Admin/Order/OrderTransportFormType.php b/src/Form/Admin/Order/OrderTransportFormType.php index b370035b07..934f64b75d 100644 --- a/src/Form/Admin/Order/OrderTransportFormType.php +++ b/src/Form/Admin/Order/OrderTransportFormType.php @@ -23,7 +23,7 @@ class OrderTransportFormType 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('transport', ChoiceType::class, [ @@ -68,7 +68,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('transports') diff --git a/src/Form/Admin/Order/Status/OrderStatusFormType.php b/src/Form/Admin/Order/Status/OrderStatusFormType.php index 37900cb78f..b019415459 100644 --- a/src/Form/Admin/Order/Status/OrderStatusFormType.php +++ b/src/Form/Admin/Order/Status/OrderStatusFormType.php @@ -17,7 +17,7 @@ class OrderStatusFormType 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('name', LocalizedType::class, [ @@ -35,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => OrderStatusData::class, diff --git a/src/Form/Admin/PaymentTransaction/PaymentTransactionsType.php b/src/Form/Admin/PaymentTransaction/PaymentTransactionsType.php index 812e095906..0d9fd89620 100644 --- a/src/Form/Admin/PaymentTransaction/PaymentTransactionsType.php +++ b/src/Form/Admin/PaymentTransaction/PaymentTransactionsType.php @@ -16,7 +16,7 @@ class PaymentTransactionsType extends AbstractType /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); @@ -29,7 +29,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['order']) diff --git a/src/Form/Admin/PersonalData/PersonalDataFormType.php b/src/Form/Admin/PersonalData/PersonalDataFormType.php index 4ac3e0669b..6eac0e46b2 100644 --- a/src/Form/Admin/PersonalData/PersonalDataFormType.php +++ b/src/Form/Admin/PersonalData/PersonalDataFormType.php @@ -15,7 +15,7 @@ class PersonalDataFormType 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('personalDataDisplaySiteContent', CKEditorType::class, [ diff --git a/src/Form/Admin/Pricing/Currency/CurrencyFormType.php b/src/Form/Admin/Pricing/Currency/CurrencyFormType.php index e18d328616..7c418a5f3c 100644 --- a/src/Form/Admin/Pricing/Currency/CurrencyFormType.php +++ b/src/Form/Admin/Pricing/Currency/CurrencyFormType.php @@ -33,9 +33,8 @@ 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 { - /** @var \CommerceGuys\Intl\Currency\Currency[] $intlCurrencies */ $intlCurrencies = $this->intlCurrencyRepository->getAll($this->localization->getLocale()); $possibleCurrencyCodes = []; @@ -97,7 +96,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('is_default_currency') diff --git a/src/Form/Admin/Pricing/Currency/CurrencySettingsFormType.php b/src/Form/Admin/Pricing/Currency/CurrencySettingsFormType.php index f21c968a85..163a64ac84 100644 --- a/src/Form/Admin/Pricing/Currency/CurrencySettingsFormType.php +++ b/src/Form/Admin/Pricing/Currency/CurrencySettingsFormType.php @@ -26,7 +26,7 @@ public function __construct(private readonly CurrencyFacade $currencyFacade) * @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('defaultCurrency', ChoiceType::class, [ @@ -57,7 +57,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Pricing/Group/PricingGroupFormType.php b/src/Form/Admin/Pricing/Group/PricingGroupFormType.php index 657061736d..68b47181e0 100644 --- a/src/Form/Admin/Pricing/Group/PricingGroupFormType.php +++ b/src/Form/Admin/Pricing/Group/PricingGroupFormType.php @@ -17,7 +17,7 @@ class PricingGroupFormType 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('name', TextType::class, [ @@ -31,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => PricingGroupData::class, diff --git a/src/Form/Admin/Pricing/Group/PricingGroupSettingsFormType.php b/src/Form/Admin/Pricing/Group/PricingGroupSettingsFormType.php index ab162728ec..fe53351a2e 100644 --- a/src/Form/Admin/Pricing/Group/PricingGroupSettingsFormType.php +++ b/src/Form/Admin/Pricing/Group/PricingGroupSettingsFormType.php @@ -25,7 +25,7 @@ public function __construct(private readonly PricingGroupFacade $pricingGroupFac * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $pricingGroups = $this->pricingGroupFacade->getByDomainId($options['domain_id']); @@ -45,7 +45,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('domain_id') diff --git a/src/Form/Admin/Product/Brand/BrandFormType.php b/src/Form/Admin/Product/Brand/BrandFormType.php index 2a86c7aa45..c2aab9be2f 100644 --- a/src/Form/Admin/Product/Brand/BrandFormType.php +++ b/src/Form/Admin/Product/Brand/BrandFormType.php @@ -38,7 +38,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 { /** @var \Shopsys\FrameworkBundle\Model\Product\Brand\Brand|null $brand */ $brand = $options['brand']; @@ -170,7 +170,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('brand') diff --git a/src/Form/Admin/Product/Flag/FlagFormType.php b/src/Form/Admin/Product/Flag/FlagFormType.php index 8e95d85604..23d9c0fd50 100644 --- a/src/Form/Admin/Product/Flag/FlagFormType.php +++ b/src/Form/Admin/Product/Flag/FlagFormType.php @@ -19,7 +19,7 @@ class FlagFormType 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('name', LocalizedType::class, [ @@ -48,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => FlagData::class, diff --git a/src/Form/Admin/Product/Parameter/ProductParameterValueFormType.php b/src/Form/Admin/Product/Parameter/ProductParameterValueFormType.php index 90f5fdc0ed..fd4ccb67c7 100644 --- a/src/Form/Admin/Product/Parameter/ProductParameterValueFormType.php +++ b/src/Form/Admin/Product/Parameter/ProductParameterValueFormType.php @@ -34,7 +34,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 { $builder ->add('parameter', ChoiceType::class, [ @@ -69,7 +69,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Product/Parameter/Value/ParameterValueConversionFormType.php b/src/Form/Admin/Product/Parameter/Value/ParameterValueConversionFormType.php index 40b5151e7b..b4a0e1f6b9 100644 --- a/src/Form/Admin/Product/Parameter/Value/ParameterValueConversionFormType.php +++ b/src/Form/Admin/Product/Parameter/Value/ParameterValueConversionFormType.php @@ -20,7 +20,7 @@ class ParameterValueConversionFormType extends AbstractType * @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 { parent::buildView($view, $form, $options); @@ -31,7 +31,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $constraints = [ new Constraints\Length( @@ -61,7 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Product/Parameter/Value/SliderParameterValuesUpdateFormType.php b/src/Form/Admin/Product/Parameter/Value/SliderParameterValuesUpdateFormType.php index d84444d3f6..7a02f5ff0e 100644 --- a/src/Form/Admin/Product/Parameter/Value/SliderParameterValuesUpdateFormType.php +++ b/src/Form/Admin/Product/Parameter/Value/SliderParameterValuesUpdateFormType.php @@ -15,7 +15,7 @@ class SliderParameterValuesUpdateFormType 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($builder->create('parameterValues', ParameterValueConversionListType::class, [ @@ -37,7 +37,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => [ diff --git a/src/Form/Admin/Product/ProductMassActionFormType.php b/src/Form/Admin/Product/ProductMassActionFormType.php index 6ee0d46f58..13f40a8579 100644 --- a/src/Form/Admin/Product/ProductMassActionFormType.php +++ b/src/Form/Admin/Product/ProductMassActionFormType.php @@ -17,7 +17,7 @@ class ProductMassActionFormType 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('selectType', ChoiceType::class, [ @@ -52,7 +52,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => [ diff --git a/src/Form/Admin/Product/TopProduct/TopProductsFormType.php b/src/Form/Admin/Product/TopProduct/TopProductsFormType.php index e3437de803..6a00a8d70c 100644 --- a/src/Form/Admin/Product/TopProduct/TopProductsFormType.php +++ b/src/Form/Admin/Product/TopProduct/TopProductsFormType.php @@ -24,7 +24,7 @@ public function __construct(private readonly RemoveDuplicatesFromArrayTransforme * @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( @@ -41,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => [ diff --git a/src/Form/Admin/Product/Unit/UnitFormType.php b/src/Form/Admin/Product/Unit/UnitFormType.php index 7d8fee6d69..71f4ce1b4c 100644 --- a/src/Form/Admin/Product/Unit/UnitFormType.php +++ b/src/Form/Admin/Product/Unit/UnitFormType.php @@ -17,7 +17,7 @@ class UnitFormType 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('name', LocalizedType::class, [ @@ -36,7 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => UnitData::class, diff --git a/src/Form/Admin/Product/Unit/UnitSettingFormType.php b/src/Form/Admin/Product/Unit/UnitSettingFormType.php index cd7e51b389..a944dd4b47 100644 --- a/src/Form/Admin/Product/Unit/UnitSettingFormType.php +++ b/src/Form/Admin/Product/Unit/UnitSettingFormType.php @@ -25,7 +25,7 @@ public function __construct(private readonly UnitFacade $unitFacade) * @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('defaultUnit', ChoiceType::class, [ @@ -44,7 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Product/VariantFormType.php b/src/Form/Admin/Product/VariantFormType.php index f28f3959f4..5cd88857bf 100644 --- a/src/Form/Admin/Product/VariantFormType.php +++ b/src/Form/Admin/Product/VariantFormType.php @@ -15,14 +15,14 @@ class VariantFormType extends AbstractType { - public const MAIN_VARIANT = 'mainVariant'; - public const VARIANTS = 'variants'; + public const string MAIN_VARIANT = 'mainVariant'; + public const string VARIANTS = 'variants'; /** * @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(self::MAIN_VARIANT, ProductType::class, [ @@ -53,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/PromoCode/Constraint/UniqueFlagsValidator.php b/src/Form/Admin/PromoCode/Constraint/UniqueFlagsValidator.php index a9f41d19d3..aacddd2425 100644 --- a/src/Form/Admin/PromoCode/Constraint/UniqueFlagsValidator.php +++ b/src/Form/Admin/PromoCode/Constraint/UniqueFlagsValidator.php @@ -14,7 +14,7 @@ class UniqueFlagsValidator extends ConstraintValidator * @param \Shopsys\FrameworkBundle\Model\Order\PromoCode\PromoCodeFlag\PromoCodeFlag[] $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint): void + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof UniqueFlags) { throw new UnexpectedTypeException($constraint, UniqueFlags::class); diff --git a/src/Form/Admin/PromoCode/PromoCodeFormType.php b/src/Form/Admin/PromoCode/PromoCodeFormType.php index 11eb9f6310..9b8f84ae91 100644 --- a/src/Form/Admin/PromoCode/PromoCodeFormType.php +++ b/src/Form/Admin/PromoCode/PromoCodeFormType.php @@ -59,7 +59,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 { $this->promoCode = $options['promo_code']; diff --git a/src/Form/Admin/PromoCode/PromoCodeLimitType.php b/src/Form/Admin/PromoCode/PromoCodeLimitType.php index 1cbe1ffb81..f64aa2deab 100644 --- a/src/Form/Admin/PromoCode/PromoCodeLimitType.php +++ b/src/Form/Admin/PromoCode/PromoCodeLimitType.php @@ -24,7 +24,7 @@ public function __construct(private PromoCodeLimitTransformer $promoCodeLimitTra /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('discount') ->addAllowedTypes('discount', 'array'); @@ -34,7 +34,7 @@ public function configureOptions(OptionsResolver $resolver) * @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('fromPriceWithVat', IntegerType::class, [ 'constraints' => [ diff --git a/src/Form/Admin/QuickSearch/QuickSearchFormType.php b/src/Form/Admin/QuickSearch/QuickSearchFormType.php index 05cd67a6c0..7b9fec7353 100644 --- a/src/Form/Admin/QuickSearch/QuickSearchFormType.php +++ b/src/Form/Admin/QuickSearch/QuickSearchFormType.php @@ -16,7 +16,7 @@ class QuickSearchFormType 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 ->setMethod('GET') @@ -29,7 +29,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/SalesRepresentative/SalesRepresentativeFormType.php b/src/Form/Admin/SalesRepresentative/SalesRepresentativeFormType.php index 1c0032445b..e7e30b76f6 100644 --- a/src/Form/Admin/SalesRepresentative/SalesRepresentativeFormType.php +++ b/src/Form/Admin/SalesRepresentative/SalesRepresentativeFormType.php @@ -21,24 +21,22 @@ class SalesRepresentativeFormType extends AbstractType { - private ?SalesRepresentative $salesRepresentative = null; - /** * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { - $this->salesRepresentative = $options['salesRepresentative']; + $salesRepresentative = $options['salesRepresentative']; - if ($this->salesRepresentative instanceof SalesRepresentative) { + if ($salesRepresentative instanceof SalesRepresentative) { $builderSystemDataGroup = $builder->create('systemData', GroupType::class, [ 'label' => t('System data'), ]); $builderSystemDataGroup->add('formId', DisplayOnlyType::class, [ 'label' => t('ID'), - 'data' => $this->salesRepresentative->getId(), + 'data' => $salesRepresentative->getId(), ]); $builder @@ -124,7 +122,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['salesRepresentative']) diff --git a/src/Form/Admin/Slider/SliderItemFormType.php b/src/Form/Admin/Slider/SliderItemFormType.php index 607c0a40a1..613474bfd6 100644 --- a/src/Form/Admin/Slider/SliderItemFormType.php +++ b/src/Form/Admin/Slider/SliderItemFormType.php @@ -25,14 +25,14 @@ class SliderItemFormType extends AbstractType { - public const SCENARIO_CREATE = 'create'; - public const SCENARIO_EDIT = 'edit'; + public const string SCENARIO_CREATE = 'create'; + public const string SCENARIO_EDIT = 'edit'; /** * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $imageConstraints = []; @@ -159,7 +159,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['scenario', 'slider_item']) diff --git a/src/Form/Admin/Superadmin/InputPriceTypeFormType.php b/src/Form/Admin/Superadmin/InputPriceTypeFormType.php index 8511561d25..52fb0b0300 100644 --- a/src/Form/Admin/Superadmin/InputPriceTypeFormType.php +++ b/src/Form/Admin/Superadmin/InputPriceTypeFormType.php @@ -18,7 +18,7 @@ class InputPriceTypeFormType 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('type', ChoiceType::class, [ @@ -36,7 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/Transport/Price/PriceWithLimitType.php b/src/Form/Admin/Transport/Price/PriceWithLimitType.php index 0d6e6f039a..7d17c96de4 100644 --- a/src/Form/Admin/Transport/Price/PriceWithLimitType.php +++ b/src/Form/Admin/Transport/Price/PriceWithLimitType.php @@ -8,7 +8,6 @@ use Shopsys\FrameworkBundle\Model\Transport\PriceWithLimitData; use Shopsys\FrameworkBundle\Twig\InputPriceLabelExtension; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\MoneyType; @@ -51,7 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ #[Override] - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ @@ -63,15 +62,6 @@ public function configureOptions(OptionsResolver $resolver) ->setAllowedTypes('current_transport_prices_indexed_by_id', 'array'); } - /** - * @return string - */ - #[Override] - public function getParent(): string - { - return FormType::class; - } - /** * {@inheritdoc} */ diff --git a/src/Form/Admin/Transport/TransportFormType.php b/src/Form/Admin/Transport/TransportFormType.php index 2f2dba30ef..c33ab61323 100644 --- a/src/Form/Admin/Transport/TransportFormType.php +++ b/src/Form/Admin/Transport/TransportFormType.php @@ -56,7 +56,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 { /** @var \Shopsys\FrameworkBundle\Model\Transport\Transport $transport */ $transport = $options['transport']; @@ -241,7 +241,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('transport') ->setAllowedTypes('transport', [Transport::class, 'null']) diff --git a/src/Form/Admin/TransportAndPayment/FreeTransportAndPaymentPriceLimitsFormType.php b/src/Form/Admin/TransportAndPayment/FreeTransportAndPaymentPriceLimitsFormType.php index 96cdda967d..417b5b45f4 100644 --- a/src/Form/Admin/TransportAndPayment/FreeTransportAndPaymentPriceLimitsFormType.php +++ b/src/Form/Admin/TransportAndPayment/FreeTransportAndPaymentPriceLimitsFormType.php @@ -18,10 +18,10 @@ class FreeTransportAndPaymentPriceLimitsFormType extends AbstractType { - public const DOMAINS_SUBFORM_NAME = 'priceLimits'; - public const FIELD_ENABLED = 'enabled'; - public const FIELD_PRICE_LIMIT = 'priceLimit'; - public const VALIDATION_GROUP_PRICE_LIMIT_ENABLED = 'priceLimitEnabled'; + public const string DOMAINS_SUBFORM_NAME = 'priceLimits'; + public const string FIELD_ENABLED = 'enabled'; + public const string FIELD_PRICE_LIMIT = 'priceLimit'; + public const string VALIDATION_GROUP_PRICE_LIMIT_ENABLED = 'priceLimitEnabled'; /** * @param \Shopsys\FrameworkBundle\Component\Domain\Domain $domain @@ -34,7 +34,7 @@ public function __construct(private readonly Domain $domain) * @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($this->getPriceLimitsBuilder($builder)) @@ -45,7 +45,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @return \Symfony\Component\Form\FormBuilderInterface */ - private function getPriceLimitsBuilder(FormBuilderInterface $builder) + private function getPriceLimitsBuilder(FormBuilderInterface $builder): FormBuilderInterface { $formBuilderForDomains = $builder->create(self::DOMAINS_SUBFORM_NAME, null, ['compound' => true]); @@ -89,7 +89,7 @@ private function getPriceLimitsBuilder(FormBuilderInterface $builder) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/Admin/UploadedFile/UploadedFileFormType.php b/src/Form/Admin/UploadedFile/UploadedFileFormType.php index 1fe80e094f..f94874c5fc 100644 --- a/src/Form/Admin/UploadedFile/UploadedFileFormType.php +++ b/src/Form/Admin/UploadedFile/UploadedFileFormType.php @@ -22,7 +22,7 @@ class UploadedFileFormType 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('name', TextType::class, [ 'label' => t('Filename'), @@ -76,7 +76,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => UploadedFileFormData::class, diff --git a/src/Form/Admin/Vat/VatFormType.php b/src/Form/Admin/Vat/VatFormType.php index a7922e5afa..c47dac8aa1 100644 --- a/src/Form/Admin/Vat/VatFormType.php +++ b/src/Form/Admin/Vat/VatFormType.php @@ -14,14 +14,14 @@ class VatFormType extends AbstractType { - public const SCENARIO_CREATE = 'create'; - public const SCENARIO_EDIT = 'edit'; + public const string SCENARIO_CREATE = 'create'; + public const string SCENARIO_EDIT = 'edit'; /** * @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('name', TextType::class, [ @@ -50,7 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('scenario') diff --git a/src/Form/Admin/Vat/VatSettingsFormType.php b/src/Form/Admin/Vat/VatSettingsFormType.php index d4a4c53f0f..424d49faf2 100644 --- a/src/Form/Admin/Vat/VatSettingsFormType.php +++ b/src/Form/Admin/Vat/VatSettingsFormType.php @@ -30,7 +30,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 { $builderSettingsGroup = $builder->create('settings', GroupType::class, [ 'label' => t('Settings'), @@ -59,7 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'attr' => ['novalidate' => 'novalidate'], diff --git a/src/Form/BasicFileUploadType.php b/src/Form/BasicFileUploadType.php index 3a707a632b..3b44f8b225 100644 --- a/src/Form/BasicFileUploadType.php +++ b/src/Form/BasicFileUploadType.php @@ -34,7 +34,7 @@ public function __construct( /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => UploadedFileData::class, @@ -60,7 +60,7 @@ public function buildView(FormView $view, FormInterface $form, array $options): * @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->resetModelTransformers(); diff --git a/src/Form/CategoriesType.php b/src/Form/CategoriesType.php index d5500b5ac7..32c54267b8 100644 --- a/src/Form/CategoriesType.php +++ b/src/Form/CategoriesType.php @@ -30,7 +30,7 @@ public function __construct(CategoriesTypeTransformer $categoryTransformer) * @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['domain_id'] = $options['domain_id']; $view->vars['display_as_row'] = $options['display_as_row']; @@ -40,7 +40,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) * @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->addViewTransformer($this->categoriesTypeTransformer); } @@ -48,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $entryOptionsNormalizer = function (Options $options, $value) { $value['domain_id'] = $value['domain_id'] ?? $options['domain_id']; diff --git a/src/Form/CategoryCheckboxType.php b/src/Form/CategoryCheckboxType.php index 91cbd06a6f..595ec1e7ba 100644 --- a/src/Form/CategoryCheckboxType.php +++ b/src/Form/CategoryCheckboxType.php @@ -25,7 +25,7 @@ public function __construct(private readonly CategoryFacade $categoryFacade) * @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 { $categoryId = $form->getName(); @@ -47,7 +47,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired('domain_id') diff --git a/src/Form/CollectionTypeExtension.php b/src/Form/CollectionTypeExtension.php index 746d07318c..fdc5095adf 100644 --- a/src/Form/CollectionTypeExtension.php +++ b/src/Form/CollectionTypeExtension.php @@ -20,7 +20,7 @@ class CollectionTypeExtension 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 { $this->removeOriginalResizeFormListener($builder->getEventDispatcher()); @@ -46,7 +46,7 @@ public static function getExtendedTypes(): iterable /** * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher */ - private function removeOriginalResizeFormListener(EventDispatcherInterface $eventDispatcher) + private function removeOriginalResizeFormListener(EventDispatcherInterface $eventDispatcher): void { $listenersByEventName = $eventDispatcher->getListeners(); diff --git a/src/Form/Constraints/ContainsValidator.php b/src/Form/Constraints/ContainsValidator.php index 1018e290a4..431f98387a 100644 --- a/src/Form/Constraints/ContainsValidator.php +++ b/src/Form/Constraints/ContainsValidator.php @@ -14,7 +14,7 @@ class ContainsValidator extends ConstraintValidator * @param string $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof Contains) { throw new UnexpectedTypeException($constraint, Contains::class); diff --git a/src/Form/Constraints/Country.php b/src/Form/Constraints/Country.php index ac978eec8a..9a6c0068cd 100644 --- a/src/Form/Constraints/Country.php +++ b/src/Form/Constraints/Country.php @@ -11,15 +11,14 @@ */ class Country extends Constraint { - public const INVALID_COUNTRY_ERROR = '9080a4de-347f-48c7-a41a-b4cc46a5146d'; + public const string INVALID_COUNTRY_ERROR = '9080a4de-347f-48c7-a41a-b4cc46a5146d'; public string $message = 'Country with code {{ country_code }} does not exists. Available country codes are {{ available_country_codes }}.'; /** * @var array - * @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint */ - protected static $errorNames = [ + protected const array ERROR_NAMES = [ self::INVALID_COUNTRY_ERROR => 'INVALID_COUNTRY_ERROR', ]; diff --git a/src/Form/Constraints/CountryValidator.php b/src/Form/Constraints/CountryValidator.php index a7aac757aa..5a89b46e74 100644 --- a/src/Form/Constraints/CountryValidator.php +++ b/src/Form/Constraints/CountryValidator.php @@ -26,7 +26,7 @@ public function __construct( * @param mixed $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof Country) { throw new UnexpectedTypeException($constraint, Country::class); diff --git a/src/Form/Constraints/EmailValidator.php b/src/Form/Constraints/EmailValidator.php index d428e2f247..39b8efc911 100644 --- a/src/Form/Constraints/EmailValidator.php +++ b/src/Form/Constraints/EmailValidator.php @@ -13,7 +13,7 @@ class EmailValidator extends ConstraintValidator /** * {@inheritdoc} */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof Email) { throw new UnexpectedTypeException($constraint, Email::class); @@ -39,7 +39,7 @@ public function validate($value, Constraint $constraint) * @param string $value * @return bool */ - protected function isEmail($value) + protected function isEmail($value): bool { $atom = "[-a-z0-9!#$%&'*+/=?^_`{|}~]"; // RFC 5322 unquoted characters in local-part $alpha = "a-z\x80-\xFF"; // superset of IDN diff --git a/src/Form/Constraints/FieldsAreNotIdenticalValidator.php b/src/Form/Constraints/FieldsAreNotIdenticalValidator.php index 3de4769379..39995ddb34 100644 --- a/src/Form/Constraints/FieldsAreNotIdenticalValidator.php +++ b/src/Form/Constraints/FieldsAreNotIdenticalValidator.php @@ -15,7 +15,7 @@ class FieldsAreNotIdenticalValidator extends ConstraintValidator * @param array $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint) + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof FieldsAreNotIdentical) { throw new UnexpectedTypeException($constraint, FieldsAreNotIdentical::class); @@ -29,8 +29,6 @@ public function validate($values, Constraint $constraint) $this->context->buildViolation($constraint->message) ->atPath($constraint->errorPath) ->addViolation(); - - return; } } } diff --git a/src/Form/Constraints/FileAbstractFilesystemValidator.php b/src/Form/Constraints/FileAbstractFilesystemValidator.php index 270fbcfe99..edf8839c9e 100644 --- a/src/Form/Constraints/FileAbstractFilesystemValidator.php +++ b/src/Form/Constraints/FileAbstractFilesystemValidator.php @@ -29,7 +29,7 @@ public function __construct( /** * {@inheritdoc} */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { $abstractPath = $this->fileUpload->getTemporaryFilepath($value->getFilename()); $localFileUniqueName = $this->fileUpload->getTemporaryFilepath(uniqid() . $value->getFilename()); diff --git a/src/Form/Constraints/FileAllowedExtensionValidator.php b/src/Form/Constraints/FileAllowedExtensionValidator.php index 5f82a62dca..bf7f2f7db8 100644 --- a/src/Form/Constraints/FileAllowedExtensionValidator.php +++ b/src/Form/Constraints/FileAllowedExtensionValidator.php @@ -17,7 +17,7 @@ class FileAllowedExtensionValidator extends ConstraintValidator * @param string|\Symfony\Component\HttpFoundation\File\File $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof FileAllowedExtension) { throw new UnexpectedTypeException($constraint, FileAllowedExtension::class); diff --git a/src/Form/Constraints/FileExtensionMaxLengthValidator.php b/src/Form/Constraints/FileExtensionMaxLengthValidator.php index 67b6be916d..16639880d0 100644 --- a/src/Form/Constraints/FileExtensionMaxLengthValidator.php +++ b/src/Form/Constraints/FileExtensionMaxLengthValidator.php @@ -17,7 +17,7 @@ class FileExtensionMaxLengthValidator extends ConstraintValidator * @param string|\Symfony\Component\HttpFoundation\File\File $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof FileExtensionMaxLength) { throw new UnexpectedTypeException($constraint, FileExtensionMaxLength::class); diff --git a/src/Form/Constraints/ImageAbstractFilesystemValidator.php b/src/Form/Constraints/ImageAbstractFilesystemValidator.php index bc08778145..6e97f8354c 100644 --- a/src/Form/Constraints/ImageAbstractFilesystemValidator.php +++ b/src/Form/Constraints/ImageAbstractFilesystemValidator.php @@ -29,7 +29,7 @@ public function __construct( /** * {@inheritdoc} */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { $abstractPath = $this->fileUpload->getTemporaryFilepath($value->getFilename()); $localFileUniqueName = $this->fileUpload->getTemporaryFilepath(uniqid() . $value->getFilename()); diff --git a/src/Form/Constraints/MoneyRangeValidator.php b/src/Form/Constraints/MoneyRangeValidator.php index c860acdd6a..feadb5ab2d 100644 --- a/src/Form/Constraints/MoneyRangeValidator.php +++ b/src/Form/Constraints/MoneyRangeValidator.php @@ -16,7 +16,7 @@ class MoneyRangeValidator extends ConstraintValidator * @param \Shopsys\FrameworkBundle\Component\Money\Money|null $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof MoneyRange) { throw new UnexpectedTypeException($constraint, MoneyRange::class); diff --git a/src/Form/Constraints/NotIdenticalToEmailLocalPartValidator.php b/src/Form/Constraints/NotIdenticalToEmailLocalPartValidator.php index e323115b18..489c40449d 100644 --- a/src/Form/Constraints/NotIdenticalToEmailLocalPartValidator.php +++ b/src/Form/Constraints/NotIdenticalToEmailLocalPartValidator.php @@ -15,7 +15,7 @@ class NotIdenticalToEmailLocalPartValidator extends ConstraintValidator * @param array $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint) + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof NotIdenticalToEmailLocalPart) { throw new UnexpectedTypeException($constraint, NotIdenticalToEmailLocalPart::class); diff --git a/src/Form/Constraints/NotInArray.php b/src/Form/Constraints/NotInArray.php index bcb7b76fcf..03ef907693 100644 --- a/src/Form/Constraints/NotInArray.php +++ b/src/Form/Constraints/NotInArray.php @@ -15,9 +15,6 @@ class NotInArray extends Constraint { public string $message = 'Value must not be neither of following: {{ array }}'; - /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification - */ public array|Traversable|ArrayAccess $array = []; /** diff --git a/src/Form/Constraints/NotInArrayValidator.php b/src/Form/Constraints/NotInArrayValidator.php index e9d1e984f2..24e8ca9d3e 100644 --- a/src/Form/Constraints/NotInArrayValidator.php +++ b/src/Form/Constraints/NotInArrayValidator.php @@ -16,7 +16,7 @@ class NotInArrayValidator extends ConstraintValidator * @param string $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof NotInArray) { throw new UnexpectedTypeException($constraint, NotInArray::class); diff --git a/src/Form/Constraints/NotNegativeMoneyAmountValidator.php b/src/Form/Constraints/NotNegativeMoneyAmountValidator.php index 420d8a9116..39aba3d645 100644 --- a/src/Form/Constraints/NotNegativeMoneyAmountValidator.php +++ b/src/Form/Constraints/NotNegativeMoneyAmountValidator.php @@ -16,7 +16,7 @@ class NotNegativeMoneyAmountValidator extends ConstraintValidator * @param \Shopsys\FrameworkBundle\Component\Money\Money|null $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof NotNegativeMoneyAmount) { throw new UnexpectedTypeException($constraint, NotNegativeMoneyAmount::class); diff --git a/src/Form/Constraints/NotSelectedDomainToShowValidator.php b/src/Form/Constraints/NotSelectedDomainToShowValidator.php index e0116516b7..25ed81c8da 100644 --- a/src/Form/Constraints/NotSelectedDomainToShowValidator.php +++ b/src/Form/Constraints/NotSelectedDomainToShowValidator.php @@ -22,7 +22,7 @@ public function __construct(protected readonly Domain $domain) * @param array $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint) + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof NotSelectedDomainToShow) { throw new UnexpectedTypeException($constraint, NotSelectedDomainToShow::class); @@ -32,8 +32,6 @@ public function validate($values, Constraint $constraint) if (count($allDomains) === count($values)) { $this->context->addViolation($constraint->message); - - return; } } } diff --git a/src/Form/Constraints/UniqueBillingAddress.php b/src/Form/Constraints/UniqueBillingAddress.php index 0a5b335539..ab3973c3ef 100644 --- a/src/Form/Constraints/UniqueBillingAddress.php +++ b/src/Form/Constraints/UniqueBillingAddress.php @@ -11,7 +11,7 @@ */ class UniqueBillingAddress extends Constraint { - public const DUPLICATE_BILLING_ADDRESS = 'dc6b5879-cb7a-423b-bd97-d9c667d96fd5'; + public const string DUPLICATE_BILLING_ADDRESS = 'dc6b5879-cb7a-423b-bd97-d9c667d96fd5'; public string $message = 'Billing address company number {{ company_number }} already exists for domain {{ domain_id }}.'; @@ -19,9 +19,8 @@ class UniqueBillingAddress extends Constraint /** * @var array - * @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint */ - protected static $errorNames = [ + protected const array ERROR_NAMES = [ self::DUPLICATE_BILLING_ADDRESS => 'DUPLICATE_BILLING_ADDRESS', ]; } diff --git a/src/Form/Constraints/UniqueBillingAddressValidator.php b/src/Form/Constraints/UniqueBillingAddressValidator.php index cf0a10957c..31b9af5b18 100644 --- a/src/Form/Constraints/UniqueBillingAddressValidator.php +++ b/src/Form/Constraints/UniqueBillingAddressValidator.php @@ -32,7 +32,7 @@ public function __construct( * @param mixed $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof UniqueBillingAddress) { throw new UnexpectedTypeException($constraint, UniqueBillingAddress::class); @@ -73,7 +73,6 @@ public function validate($value, Constraint $constraint) /** * @param \Shopsys\FrameworkBundle\Model\Customer\BillingAddressData $billingAddressData * @param int $domainId - * @throws \Shopsys\FrameworkBundle\Model\Customer\Exception\BillingAddressCompanyNumberIsNotUniqueException */ protected function checkUniqueBillingAddress( BillingAddressData $billingAddressData, diff --git a/src/Form/Constraints/UniqueCollectionValidator.php b/src/Form/Constraints/UniqueCollectionValidator.php index e21af1c860..f44fa6a5e0 100644 --- a/src/Form/Constraints/UniqueCollectionValidator.php +++ b/src/Form/Constraints/UniqueCollectionValidator.php @@ -16,7 +16,7 @@ class UniqueCollectionValidator extends ConstraintValidator * @param array $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint) + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof UniqueCollection) { throw new UnexpectedTypeException($constraint, UniqueCollection::class); @@ -55,7 +55,7 @@ public function validate($values, Constraint $constraint) * @param mixed $value2 * @return bool */ - protected function areValuesEqual(UniqueCollection $constraint, $value1, $value2) + protected function areValuesEqual(UniqueCollection $constraint, $value1, $value2): bool { if ($constraint->allowEmpty) { if ($value1 === null || $value2 === null) { @@ -76,7 +76,7 @@ protected function areValuesEqual(UniqueCollection $constraint, $value1, $value2 * @param mixed $value2 * @return bool */ - protected function areValuesEqualInFields(array $fields, $value1, $value2) + protected function areValuesEqualInFields(array $fields, $value1, $value2): bool { foreach ($fields as $field) { $fieldValue1 = $this->getFieldValue($value1, $field); @@ -95,10 +95,8 @@ protected function areValuesEqualInFields(array $fields, $value1, $value2) * @param string $field * @return mixed */ - protected function getFieldValue($value, $field) + protected function getFieldValue(mixed $value, string $field): mixed { - $propertyAccessor = PropertyAccess::createPropertyAccessor(); - - return $propertyAccessor->getValue($value, $field); + return PropertyAccess::createPropertyAccessor()->getValue($value, $field); } } diff --git a/src/Form/Constraints/UniqueEmailValidator.php b/src/Form/Constraints/UniqueEmailValidator.php index df28414e03..abfb4d3e94 100644 --- a/src/Form/Constraints/UniqueEmailValidator.php +++ b/src/Form/Constraints/UniqueEmailValidator.php @@ -26,7 +26,7 @@ public function __construct( * @param mixed $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof UniqueEmail) { throw new UnexpectedTypeException($constraint, UniqueCollection::class); diff --git a/src/Form/Constraints/UniqueProductCatnumValidator.php b/src/Form/Constraints/UniqueProductCatnumValidator.php index afd94acc12..c0e783a77e 100644 --- a/src/Form/Constraints/UniqueProductCatnumValidator.php +++ b/src/Form/Constraints/UniqueProductCatnumValidator.php @@ -23,7 +23,7 @@ public function __construct( * @param mixed $value * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof UniqueProductCatnum) { throw new UnexpectedTypeException($constraint, UniqueProductCatnum::class); diff --git a/src/Form/Constraints/UniqueProductParametersValidator.php b/src/Form/Constraints/UniqueProductParametersValidator.php index e887ae0fdf..e50d2c063b 100644 --- a/src/Form/Constraints/UniqueProductParametersValidator.php +++ b/src/Form/Constraints/UniqueProductParametersValidator.php @@ -14,7 +14,7 @@ class UniqueProductParametersValidator extends ConstraintValidator * @param array $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint) + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof UniqueProductParameters) { throw new UnexpectedTypeException($constraint, UniqueCollection::class); diff --git a/src/Form/Constraints/UniqueSlugsOnDomainsValidator.php b/src/Form/Constraints/UniqueSlugsOnDomainsValidator.php index cc75b99824..1f11608911 100644 --- a/src/Form/Constraints/UniqueSlugsOnDomainsValidator.php +++ b/src/Form/Constraints/UniqueSlugsOnDomainsValidator.php @@ -28,7 +28,7 @@ public function __construct( * @param array $values * @param \Symfony\Component\Validator\Constraint $constraint */ - public function validate($values, Constraint $constraint) + public function validate(mixed $values, Constraint $constraint): void { if (!$constraint instanceof UniqueSlugsOnDomains) { throw new UnexpectedTypeException($constraint, UniqueSlugsOnDomains::class); @@ -42,7 +42,7 @@ public function validate($values, Constraint $constraint) * @param array $values * @param \Shopsys\FrameworkBundle\Form\Constraints\UniqueSlugsOnDomains $constraint */ - protected function validateDuplication(array $values, UniqueSlugsOnDomains $constraint) + protected function validateDuplication(array $values, UniqueSlugsOnDomains $constraint): void { $slugsCountByDomainId = $this->getSlugsCountIndexedByDomainId($values); diff --git a/src/Form/Constraints/WhitelistPatternValidator.php b/src/Form/Constraints/WhitelistPatternValidator.php index db56683a6f..f5390a3981 100644 --- a/src/Form/Constraints/WhitelistPatternValidator.php +++ b/src/Form/Constraints/WhitelistPatternValidator.php @@ -13,7 +13,7 @@ class WhitelistPatternValidator extends ConstraintValidator /** * {@inheritdoc} */ - public function validate($value, Constraint $constraint): void + public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof WhitelistPattern) { throw new UnexpectedTypeException($constraint, WhitelistPattern::class); diff --git a/src/Form/CustomerUserListType.php b/src/Form/CustomerUserListType.php index ff0eb50e2f..aa479c3270 100644 --- a/src/Form/CustomerUserListType.php +++ b/src/Form/CustomerUserListType.php @@ -7,7 +7,6 @@ use Shopsys\FrameworkBundle\Model\Customer\Customer; use Shopsys\FrameworkBundle\Model\Customer\CustomerFacade; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -24,7 +23,7 @@ public function __construct(private readonly CustomerFacade $customerFacade) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired(['customer']) ->setDefined(['allowDelete', 'deleteConfirmMessage', 'allowEdit', 'allowAdd']) @@ -47,7 +46,7 @@ public function configureOptions(OptionsResolver $resolver) * @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 { parent::buildView($view, $form, $options); @@ -59,12 +58,4 @@ public function buildView(FormView $view, FormInterface $form, array $options) $view->vars['customer'] = $options['customer']; $view->vars['showActionColumn'] = $options['allowEdit'] || $options['allowDelete']; } - - /** - * {@inheritdoc} - */ - public function getParent(): ?string - { - return FormType::class; - } } diff --git a/src/Form/DatePickerType.php b/src/Form/DatePickerType.php index 834bd384a9..4dfa23d726 100644 --- a/src/Form/DatePickerType.php +++ b/src/Form/DatePickerType.php @@ -11,8 +11,7 @@ class DatePickerType extends AbstractType { - protected const FORMAT_PHP = 'dd.MM.yyyy'; - public const FORMAT_JS = 'dd.mm.yy'; + protected const string FORMAT_PHP = 'dd.MM.yyyy'; /** * @param \Shopsys\FrameworkBundle\Component\Localization\DisplayTimeZoneProviderInterface $displayTimeZoneProvider @@ -24,7 +23,7 @@ public function __construct(protected readonly DisplayTimeZoneProviderInterface /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $defaults = [ 'widget' => 'single_text', diff --git a/src/Form/DeliveryAddressListType.php b/src/Form/DeliveryAddressListType.php index 82fbfd28ac..5b5cef06ee 100644 --- a/src/Form/DeliveryAddressListType.php +++ b/src/Form/DeliveryAddressListType.php @@ -8,7 +8,6 @@ use Shopsys\FrameworkBundle\Model\Customer\Customer; use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUser; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -18,7 +17,7 @@ class DeliveryAddressListType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefined(['customer', 'customerUser', 'allowDelete', 'deleteConfirmMessage', 'allowEdit', 'allowAdd']) ->setAllowedTypes('customer', [Customer::class, 'null']) @@ -43,7 +42,7 @@ public function configureOptions(OptionsResolver $resolver) * @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 { parent::buildView($view, $form, $options); @@ -70,12 +69,4 @@ public function buildView(FormView $view, FormInterface $form, array $options) $view->vars['customer'] = $options['customer']; $view->vars['showActionColumn'] = $options['allowEdit'] || $options['allowDelete']; } - - /** - * {@inheritdoc} - */ - public function getParent(): ?string - { - return FormType::class; - } } diff --git a/src/Form/DisplayOnlyCompanyNameType.php b/src/Form/DisplayOnlyCompanyNameType.php index d31a3f8770..d856753ca3 100644 --- a/src/Form/DisplayOnlyCompanyNameType.php +++ b/src/Form/DisplayOnlyCompanyNameType.php @@ -15,7 +15,7 @@ class DisplayOnlyCompanyNameType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['customer']) @@ -32,7 +32,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/DisplayOnlyCustomerType.php b/src/Form/DisplayOnlyCustomerType.php index a2c1cb5de3..7d9dad5fc8 100644 --- a/src/Form/DisplayOnlyCustomerType.php +++ b/src/Form/DisplayOnlyCustomerType.php @@ -15,7 +15,7 @@ class DisplayOnlyCustomerType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['user']) @@ -32,7 +32,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/DisplayOnlyDomainIconType.php b/src/Form/DisplayOnlyDomainIconType.php index 8f67f6033a..820f3b91c9 100644 --- a/src/Form/DisplayOnlyDomainIconType.php +++ b/src/Form/DisplayOnlyDomainIconType.php @@ -16,7 +16,7 @@ class DisplayOnlyDomainIconType extends AbstractType * @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['data'] = (int)$options['data']; } @@ -24,7 +24,7 @@ public function buildView(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([ 'mapped' => false, diff --git a/src/Form/DisplayOnlyType.php b/src/Form/DisplayOnlyType.php index 5f2b0b19df..4f17d0fd6b 100644 --- a/src/Form/DisplayOnlyType.php +++ b/src/Form/DisplayOnlyType.php @@ -5,7 +5,6 @@ namespace Shopsys\FrameworkBundle\Form; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\OptionsResolver\OptionsResolver; class DisplayOnlyType extends AbstractType @@ -13,7 +12,7 @@ class DisplayOnlyType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ @@ -27,12 +26,4 @@ public function configureOptions(OptionsResolver $resolver) ], ]); } - - /** - * {@inheritdoc} - */ - public function getParent(): ?string - { - return FormType::class; - } } diff --git a/src/Form/DisplayOnlyUrlType.php b/src/Form/DisplayOnlyUrlType.php index 2d64b6d92b..2eda737a9f 100644 --- a/src/Form/DisplayOnlyUrlType.php +++ b/src/Form/DisplayOnlyUrlType.php @@ -14,7 +14,7 @@ class DisplayOnlyUrlType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['route', 'route_params', 'route_label', 'domain_id']) @@ -37,7 +37,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/DisplayVariablesType.php b/src/Form/DisplayVariablesType.php index 63e0569697..754a0226ae 100644 --- a/src/Form/DisplayVariablesType.php +++ b/src/Form/DisplayVariablesType.php @@ -5,7 +5,6 @@ namespace Shopsys\FrameworkBundle\Form; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -15,7 +14,7 @@ class DisplayVariablesType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ @@ -36,18 +35,10 @@ public function configureOptions(OptionsResolver $resolver) * @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['variables'] = $options['variables']; parent::buildView($view, $form, $options); } - - /** - * @return string|null - */ - public function getParent(): ?string - { - return FormType::class; - } } diff --git a/src/Form/DomainsType.php b/src/Form/DomainsType.php index ad986c62f2..df213262e8 100644 --- a/src/Form/DomainsType.php +++ b/src/Form/DomainsType.php @@ -22,7 +22,7 @@ public function __construct(private readonly Domain $domain) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { foreach ($this->domain->getAdminEnabledDomains() as $domainConfig) { $builder->add((string)$domainConfig->getId(), CheckboxType::class, [ diff --git a/src/Form/EmptyMessageChoiceTypeExtension.php b/src/Form/EmptyMessageChoiceTypeExtension.php index 999c3b6daa..fa6cdbc278 100644 --- a/src/Form/EmptyMessageChoiceTypeExtension.php +++ b/src/Form/EmptyMessageChoiceTypeExtension.php @@ -17,7 +17,7 @@ class EmptyMessageChoiceTypeExtension extends AbstractTypeExtension * @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 { parent::buildView($view, $form, $options); @@ -27,7 +27,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('empty_message') ->setAllowedTypes('empty_message', 'string') diff --git a/src/Form/FileUploadType.php b/src/Form/FileUploadType.php index e5335f7037..1dc08fa119 100644 --- a/src/Form/FileUploadType.php +++ b/src/Form/FileUploadType.php @@ -67,7 +67,7 @@ public function buildView(FormView $view, FormInterface $form, array $options): * @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->resetModelTransformers(); diff --git a/src/Form/FilesType.php b/src/Form/FilesType.php index 8999bda3f9..5dddd0e92d 100644 --- a/src/Form/FilesType.php +++ b/src/Form/FilesType.php @@ -28,7 +28,7 @@ public function __construct( /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer($this->filesIdsToFilesTransformer); } diff --git a/src/Form/FormRenderingConfigurationExtension.php b/src/Form/FormRenderingConfigurationExtension.php index c709a4180f..8359ea3b85 100644 --- a/src/Form/FormRenderingConfigurationExtension.php +++ b/src/Form/FormRenderingConfigurationExtension.php @@ -12,14 +12,14 @@ class FormRenderingConfigurationExtension extends AbstractTypeExtension { - public const DISPLAY_FORMAT_MULTIDOMAIN_ROWS_NO_PADDING = 'multidomain_form_rows_no_padding'; + public const string DISPLAY_FORMAT_MULTIDOMAIN_ROWS_NO_PADDING = 'multidomain_form_rows_no_padding'; /** * @param \Symfony\Component\Form\FormView $view * @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 { parent::buildView($view, $form, $options); @@ -33,7 +33,7 @@ public function buildView(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([ diff --git a/src/Form/FriendlyUrlType.php b/src/Form/FriendlyUrlType.php index f90df4d7cd..1f77353b3a 100644 --- a/src/Form/FriendlyUrlType.php +++ b/src/Form/FriendlyUrlType.php @@ -12,13 +12,13 @@ class FriendlyUrlType extends AbstractType { - protected const SLUG_REGEX = '/^[\w_\-\/]+$/'; + protected const string SLUG_REGEX = '/^[\w_\-\/]+$/'; /** * @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(UrlListData::FIELD_DOMAIN, DomainType::class, [ 'displayUrl' => true, diff --git a/src/Form/GrapesJsType.php b/src/Form/GrapesJsType.php index 1c730cdeec..7bb8164ead 100644 --- a/src/Form/GrapesJsType.php +++ b/src/Form/GrapesJsType.php @@ -28,7 +28,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); @@ -40,7 +40,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['allow_products'] = $options['allow_products']; @@ -58,7 +58,7 @@ public function getParent(): ?string /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefined(['allow_products']) ->setAllowedTypes('allow_products', 'boolean') diff --git a/src/Form/GroupType.php b/src/Form/GroupType.php index 2e46791a5b..8f1f404914 100644 --- a/src/Form/GroupType.php +++ b/src/Form/GroupType.php @@ -12,7 +12,7 @@ class GroupType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setAllowedTypes('label', 'string') diff --git a/src/Form/HoneyPotType.php b/src/Form/HoneyPotType.php index 632f69a378..a4affe2416 100644 --- a/src/Form/HoneyPotType.php +++ b/src/Form/HoneyPotType.php @@ -22,7 +22,7 @@ public function getParent(): ?string /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'mapped' => false, diff --git a/src/Form/ImageUploadType.php b/src/Form/ImageUploadType.php index b68eb34868..d7ed5048ca 100644 --- a/src/Form/ImageUploadType.php +++ b/src/Form/ImageUploadType.php @@ -40,7 +40,7 @@ public function __construct( /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => ImageUploadData::class, @@ -74,7 +74,7 @@ function (Options $options, $fileConstraints) { * @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['entity'] = $options['entity']; $view->vars['images_by_id'] = $this->getImagesIndexedById($options); @@ -87,7 +87,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) * @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->resetModelTransformers(); @@ -151,7 +151,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) * @param array $options * @return \Shopsys\FrameworkBundle\Component\Image\Image[] */ - private function getImagesIndexedById(array $options) + private function getImagesIndexedById(array $options): array { if ($options['entity'] === null) { return []; @@ -164,7 +164,7 @@ private function getImagesIndexedById(array $options) * @param array $options * @return bool */ - private function isMultiple(array $options) + private function isMultiple(array $options): bool { if ($options['multiple'] !== null) { return $options['multiple']; diff --git a/src/Form/InvertChoiceTypeExtension.php b/src/Form/InvertChoiceTypeExtension.php index 8024fc4791..52c710af16 100644 --- a/src/Form/InvertChoiceTypeExtension.php +++ b/src/Form/InvertChoiceTypeExtension.php @@ -13,7 +13,7 @@ class InvertChoiceTypeExtension extends AbstractTypeExtension { - protected const INVERT_OPTION = 'invert'; + protected const string INVERT_OPTION = 'invert'; /** * {@inheritdoc} @@ -26,7 +26,7 @@ public static function getExtendedTypes(): iterable /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { parent::buildForm($builder, $options); @@ -44,7 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); diff --git a/src/Form/Locale/LocalizedType.php b/src/Form/Locale/LocalizedType.php index 67a45385ea..fbc4348a31 100644 --- a/src/Form/Locale/LocalizedType.php +++ b/src/Form/Locale/LocalizedType.php @@ -24,7 +24,7 @@ public function __construct(private readonly Localization $localization) * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { Utils::setArrayDefaultValue($options['entry_options'], 'required', $options['required']); Utils::setArrayDefaultValue($options['entry_options'], 'constraints', []); @@ -60,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'compound' => true, diff --git a/src/Form/MoneyTypeExtension.php b/src/Form/MoneyTypeExtension.php index d62edb8a55..032bd81992 100644 --- a/src/Form/MoneyTypeExtension.php +++ b/src/Form/MoneyTypeExtension.php @@ -30,7 +30,7 @@ public function __construct( /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer(new NumericToMoneyTransformer($options['scale'])); $builder->addViewTransformer(new RemoveWhitespacesTransformer()); @@ -39,7 +39,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['money_pattern'] = $this->getPattern(); @@ -56,7 +56,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); @@ -78,7 +78,7 @@ public static function getExtendedTypes(): iterable * @return string * @see \Symfony\Component\Form\Extension\Core\Type\MoneyType::getPattern() */ - private function getPattern() + private function getPattern(): string { return '{{ widget }}'; } diff --git a/src/Form/MultiLocaleBasicFileUploadType.php b/src/Form/MultiLocaleBasicFileUploadType.php index cdd8dca3f8..a1d37c545d 100644 --- a/src/Form/MultiLocaleBasicFileUploadType.php +++ b/src/Form/MultiLocaleBasicFileUploadType.php @@ -33,7 +33,7 @@ public function __construct( /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'multiple' => false, diff --git a/src/Form/MultiLocaleFileUploadType.php b/src/Form/MultiLocaleFileUploadType.php index 8c7ce04089..24696d8487 100644 --- a/src/Form/MultiLocaleFileUploadType.php +++ b/src/Form/MultiLocaleFileUploadType.php @@ -48,7 +48,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add($builder->create('relationsNames', CollectionType::class, $namesOptions)); } - public function getParent() + /** + * @return string + */ + public function getParent(): string { return FileUploadType::class; } diff --git a/src/Form/OrderItemsType.php b/src/Form/OrderItemsType.php index 426f4e8507..ff094a1490 100644 --- a/src/Form/OrderItemsType.php +++ b/src/Form/OrderItemsType.php @@ -32,7 +32,7 @@ public function __construct( /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { /** @var \Shopsys\FrameworkBundle\Model\Order\Order $order */ $order = $options['order']; @@ -67,7 +67,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); @@ -93,7 +93,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['order']) diff --git a/src/Form/ProductType.php b/src/Form/ProductType.php index bb8029b8c9..706c341a9c 100644 --- a/src/Form/ProductType.php +++ b/src/Form/ProductType.php @@ -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 { $builder->addModelTransformer($this->productIdToProductTransformer); } @@ -36,7 +36,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 { parent::buildView($view, $form, $options); @@ -64,7 +64,7 @@ public function getParent(): ?string /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'placeholder' => t('Choose product'), diff --git a/src/Form/ProductsType.php b/src/Form/ProductsType.php index 5ae88eb8eb..2f667a97cc 100644 --- a/src/Form/ProductsType.php +++ b/src/Form/ProductsType.php @@ -25,7 +25,7 @@ public function __construct(private readonly ProductsIdsToProductsTransformer $p /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer($this->productsIdsToProductsTransformer); } @@ -33,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['products'] = $form->getData(); $view->vars['main_product'] = $options['main_product']; @@ -47,7 +47,7 @@ public function buildView(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([ 'entry_type' => HiddenType::class, diff --git a/src/Form/RolesType.php b/src/Form/RolesType.php index 610d3adabb..7c1af47c80 100644 --- a/src/Form/RolesType.php +++ b/src/Form/RolesType.php @@ -33,7 +33,7 @@ public function __construct(Roles $roles) /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'required' => false, diff --git a/src/Form/SingleCheckboxChoiceType.php b/src/Form/SingleCheckboxChoiceType.php index 4d9cf4b86d..29749e452c 100644 --- a/src/Form/SingleCheckboxChoiceType.php +++ b/src/Form/SingleCheckboxChoiceType.php @@ -23,7 +23,7 @@ public function getParent(): ?string /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'multiple' => false, @@ -35,11 +35,10 @@ public function configureOptions(OptionsResolver $resolver) * @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); - /** @var \Symfony\Component\Form\FormBuilderInterface $child */ foreach ($builder->all() as $i => $child) { $options = $child->getOptions(); $builder->remove($i); diff --git a/src/Form/SortableValuesType.php b/src/Form/SortableValuesType.php index 2b70c042c8..0c73c1d797 100644 --- a/src/Form/SortableValuesType.php +++ b/src/Form/SortableValuesType.php @@ -16,7 +16,7 @@ class SortableValuesType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'entry_type' => HiddenType::class, @@ -39,7 +39,7 @@ public function getParent(): ?string /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['labels_by_value'] = $options['labels_by_value']; $view->vars['placeholder'] = $options['placeholder']; diff --git a/src/Form/UrlListType.php b/src/Form/UrlListType.php index 18eda2a213..30ff912384 100644 --- a/src/Form/UrlListType.php +++ b/src/Form/UrlListType.php @@ -38,7 +38,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 { if ($options['route_name'] === null) { throw new MissingRouteNameException(); @@ -92,7 +92,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 { $absoluteUrlsByDomainIdAndSlug = $this->getAbsoluteUrlsIndexedByDomainIdAndSlug( $options['route_name'], @@ -112,7 +112,7 @@ public function buildView(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([ 'data_class' => UrlListData::class, @@ -127,20 +127,18 @@ public function configureOptions(OptionsResolver $resolver) * @param int $entityId * @return \Shopsys\FrameworkBundle\Component\Router\FriendlyUrl\FriendlyUrl[][] */ - private function getFriendlyUrlsIndexedByDomain($routeName, $entityId) + private function getFriendlyUrlsIndexedByDomain(string $routeName, int $entityId): array { $friendlyUrlsByDomain = []; - if ($entityId !== null) { - $friendlyUrls = $this->friendlyUrlFacade->getAllByRouteNameDomainIdsAndEntityIds( - $routeName, - $entityId, - $this->domain->getAdminEnabledDomainIds(), - ); + $friendlyUrls = $this->friendlyUrlFacade->getAllByRouteNameDomainIdsAndEntityIds( + $routeName, + $entityId, + $this->domain->getAdminEnabledDomainIds(), + ); - foreach ($friendlyUrls as $friendlyUrl) { - $friendlyUrlsByDomain[$friendlyUrl->getDomainId()][] = $friendlyUrl; - } + foreach ($friendlyUrls as $friendlyUrl) { + $friendlyUrlsByDomain[$friendlyUrl->getDomainId()][] = $friendlyUrl; } return $friendlyUrlsByDomain; @@ -151,7 +149,7 @@ private function getFriendlyUrlsIndexedByDomain($routeName, $entityId) * @param int $entityId * @return string[][] */ - private function getAbsoluteUrlsIndexedByDomainIdAndSlug($routeName, $entityId) + private function getAbsoluteUrlsIndexedByDomainIdAndSlug(string $routeName, int $entityId): array { $friendlyUrlsByDomain = $this->getFriendlyUrlsIndexedByDomain($routeName, $entityId); $absoluteUrlsByDomainIdAndSlug = []; @@ -175,10 +173,10 @@ private function getAbsoluteUrlsIndexedByDomainIdAndSlug($routeName, $entityId) /** * @param string $routeName - * @param int $entityId + * @param int|null $entityId * @return string[] */ - private function getMainFriendlyUrlSlugsIndexedByDomainId($routeName, $entityId) + private function getMainFriendlyUrlSlugsIndexedByDomainId(string $routeName, ?int $entityId): array { $mainFriendlyUrlsSlugsByDomainId = []; diff --git a/src/Form/WarningMessageType.php b/src/Form/WarningMessageType.php index 88fde19835..a916f0a40c 100644 --- a/src/Form/WarningMessageType.php +++ b/src/Form/WarningMessageType.php @@ -12,7 +12,7 @@ class WarningMessageType extends AbstractType /** * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ diff --git a/src/Model/Administrator/Administrator.php b/src/Model/Administrator/Administrator.php index 987317e488..6d98f62ea8 100644 --- a/src/Model/Administrator/Administrator.php +++ b/src/Model/Administrator/Administrator.php @@ -420,7 +420,7 @@ public function __unserialize(array $data): void /** * {@inheritdoc} */ - public function eraseCredentials() + public function eraseCredentials(): void { } diff --git a/src/Model/Customer/User/CustomerUser.php b/src/Model/Customer/User/CustomerUser.php index 432260564f..b0af65e5e1 100644 --- a/src/Model/Customer/User/CustomerUser.php +++ b/src/Model/Customer/User/CustomerUser.php @@ -384,7 +384,7 @@ public function __unserialize(array $data): void /** * {@inheritdoc} */ - public function eraseCredentials() + public function eraseCredentials(): void { } diff --git a/src/Model/Security/AdministratorChecker.php b/src/Model/Security/AdministratorChecker.php index 138101ba1b..35d464e9d8 100644 --- a/src/Model/Security/AdministratorChecker.php +++ b/src/Model/Security/AdministratorChecker.php @@ -24,7 +24,7 @@ public function __construct( /** * @param \Shopsys\FrameworkBundle\Model\Administrator\Administrator $user */ - public function checkPostAuth(UserInterface $user) + public function checkPostAuth(UserInterface $user): void { if ($this->environment === EnvironmentType::PRODUCTION && !$this->ignoreDefaultAdminPasswordCheck From 9fb3d9522468594ae3ed053f95ab1ca805fdfa2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Wed, 20 Nov 2024 14:00:04 +0100 Subject: [PATCH 13/14] fixed getting GET data for quick search form --- src/Controller/Admin/ProductController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Admin/ProductController.php b/src/Controller/Admin/ProductController.php index 99ff043c57..9da7e9ba45 100644 --- a/src/Controller/Admin/ProductController.php +++ b/src/Controller/Admin/ProductController.php @@ -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); From 1d4e7ab0ffd13caa7223d7a1d20ecad0e998b3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Wed, 20 Nov 2024 14:06:28 +0100 Subject: [PATCH 14/14] fixed deleting of PricingGroup --- src/Controller/Admin/PricingGroupController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Admin/PricingGroupController.php b/src/Controller/Admin/PricingGroupController.php index 8dfbb777b6..a1e55dee55 100644 --- a/src/Controller/Admin/PricingGroupController.php +++ b/src/Controller/Admin/PricingGroupController.php @@ -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;