From 4c2615576fba8790cedfee376d3b45bf655fdbda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Odwa=C5=BCny?= Date: Tue, 30 Jul 2024 01:08:20 +0200 Subject: [PATCH] coding standards --- .github/CODEOWNERS | 1 + .github/workflows/build.yml | 7 ++----- .github/workflows/coding_standard.yml | 7 ++----- src/Controller/Action/CountClicksAction.php | 2 +- src/DataProvider/GetAdsBannersDataProvider.php | 4 ++-- src/Generator/BannerPathGenerator.php | 4 ++-- src/Operator/BannersOperator.php | 4 ++-- src/Operator/BannersOperatorInterface.php | 2 +- src/Provider/BannersProvider.php | 4 ++-- src/Provider/BannersProviderInterface.php | 8 ++++---- src/Twig/Extension/BannerExtension.php | 4 ++-- src/Uploader/BannerUploader.php | 2 +- tests/Behat/Context/Setup/Admin/BannerSetupContext.php | 8 ++++---- tests/Behat/Context/Ui/Admin/AdContext.php | 4 ++-- tests/Behat/Context/Ui/Admin/BannerContext.php | 6 +++--- tests/Behat/Context/Ui/Admin/SectionContext.php | 2 +- tests/Behat/Page/Admin/AdPage.php | 4 ++-- tests/Behat/Page/Admin/BannerPage.php | 4 ++-- tests/Behat/Page/Admin/SectionPage.php | 4 ++-- tests/Behat/Transformer/AdTransformer.php | 2 +- tests/Behat/Transformer/SectionTransformer.php | 2 +- 21 files changed, 40 insertions(+), 45 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 92faea2..5da7b9f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ +* @BitBagCommerce * @Sylius/core-team diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab2db7c..40dfd34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: - 'dependabot/**' pull_request: ~ release: - types: [ created ] + types: [created] schedule: - cron: "0 1 * * 6" # Run at 1am every Saturday workflow_dispatch: ~ @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, - MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}" + MySQL ${{ matrix.mysql }}" strategy: fail-fast: false @@ -26,11 +26,8 @@ jobs: sylius: ["~1.12.0", "~1.13.0"] node: ["^20.x"] mysql: ["8.0"] - state_machine_adapter: ["winzou_state_machine", "symfony_workflow"] exclude: - - sylius: "~1.12.0" - state_machine_adapter: "symfony_workflow" - sylius: "~1.13.0" php: "8.0" diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index e93a702..ade7d95 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, - MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}" + MySQL ${{ matrix.mysql }}" strategy: fail-fast: false @@ -24,11 +24,8 @@ jobs: sylius: ["~1.12.0", "~1.13.0"] node: ["^20.x"] mysql: ["8.0"] - state_machine_adapter: ["winzou_state_machine", "symfony_workflow"] exclude: - - sylius: "~1.12.0" - state_machine_adapter: "symfony_workflow" - sylius: "~1.13.0" php: "8.0" @@ -81,7 +78,7 @@ jobs: - name: Run ECS - run: vendor/bin/ecs + run: vendor/bin/ecs check src tests/Behat - name: Failed build Slack notification diff --git a/src/Controller/Action/CountClicksAction.php b/src/Controller/Action/CountClicksAction.php index 02bf0a9..d3f0a7d 100644 --- a/src/Controller/Action/CountClicksAction.php +++ b/src/Controller/Action/CountClicksAction.php @@ -26,7 +26,7 @@ final class CountClicksAction public function __construct( BannerRepositoryInterface $bannerRepository, - ObjectManager $objectManager + ObjectManager $objectManager, ) { $this->bannerRepository = $bannerRepository; $this->objectManager = $objectManager; diff --git a/src/DataProvider/GetAdsBannersDataProvider.php b/src/DataProvider/GetAdsBannersDataProvider.php index b8caf0c..e601c1a 100644 --- a/src/DataProvider/GetAdsBannersDataProvider.php +++ b/src/DataProvider/GetAdsBannersDataProvider.php @@ -32,7 +32,7 @@ public function __construct(AdRepositoryInterface $adRepository, BannersProvider public function supports( string $resourceClass, string $operationName = null, - array $context = [] + array $context = [], ): bool { return Banner::class === $resourceClass; } @@ -40,7 +40,7 @@ public function supports( public function getCollection( string $resourceClass, string $operationName = null, - array $context = [] + array $context = [], ): iterable { $localeCode = $context['filters']['locale_code'] ?? null; $sectionCode = $context['filters']['section_code'] ?? null; diff --git a/src/Generator/BannerPathGenerator.php b/src/Generator/BannerPathGenerator.php index f6d7683..d06fe06 100644 --- a/src/Generator/BannerPathGenerator.php +++ b/src/Generator/BannerPathGenerator.php @@ -25,7 +25,7 @@ public function generate(BannerInterface $banner): string return $this->expandPath( sprintf('%s.%s', $hash, $file->guessExtension()), - self::PATH_PREFIX + self::PATH_PREFIX, ); } @@ -36,7 +36,7 @@ private function expandPath(string $path, string $pathPrefix): string $pathPrefix, substr($path, 0, 2), substr($path, 2, 2), - substr($path, 4) + substr($path, 4), ); } } diff --git a/src/Operator/BannersOperator.php b/src/Operator/BannersOperator.php index fba63f7..0d6d72f 100644 --- a/src/Operator/BannersOperator.php +++ b/src/Operator/BannersOperator.php @@ -20,7 +20,7 @@ final class BannersOperator implements BannersOperatorInterface public function operate( AdInterface $ad, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { /** @var Collection $adBanners */ $adBanners = $ad->getBanners(); @@ -44,7 +44,7 @@ public function operate( private function filterBannersBySectionAndLocale( Collection $adBanners, string $sectionCode, - string $localeCode + string $localeCode, ): Collection { return $adBanners->filter(function (BannerInterface $banner) use ($sectionCode, $localeCode) { if (null !== $banner->getLocale() && diff --git a/src/Operator/BannersOperatorInterface.php b/src/Operator/BannersOperatorInterface.php index 2bd3a07..57cd3ef 100644 --- a/src/Operator/BannersOperatorInterface.php +++ b/src/Operator/BannersOperatorInterface.php @@ -18,6 +18,6 @@ interface BannersOperatorInterface public function operate( AdInterface $ad, string $sectionCode, - string $localeCode + string $localeCode, ): ?array; } diff --git a/src/Provider/BannersProvider.php b/src/Provider/BannersProvider.php index 4652d0a..f3d4ed4 100644 --- a/src/Provider/BannersProvider.php +++ b/src/Provider/BannersProvider.php @@ -26,7 +26,7 @@ public function __construct(BannersOperatorInterface $bannersOperator) public function getAdsBanners( array $ads, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { $banners = []; @@ -44,7 +44,7 @@ public function getAdsBanners( public function getAdBanners( AdInterface $ad, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { return $this->bannersOperator->operate($ad, $sectionCode, $localeCode); } diff --git a/src/Provider/BannersProviderInterface.php b/src/Provider/BannersProviderInterface.php index 5e356c2..9640ce3 100644 --- a/src/Provider/BannersProviderInterface.php +++ b/src/Provider/BannersProviderInterface.php @@ -1,7 +1,5 @@ adRepository->findAllActiveAds(); @@ -52,7 +52,7 @@ public function getActiveAdsBannersBySectionAndLocale( public function getActiveAdBannersByCodeSectionAndLocale( string $adCode, string $sectionCode, - string $localeCode + string $localeCode, ): ?array { $ad = $this->adRepository->findActiveAdByCode($adCode); diff --git a/src/Uploader/BannerUploader.php b/src/Uploader/BannerUploader.php index 20bad87..c8d087a 100644 --- a/src/Uploader/BannerUploader.php +++ b/src/Uploader/BannerUploader.php @@ -53,7 +53,7 @@ public function upload(BannerInterface $banner): void $this->filesystem->write( $path, - $fileContents + $fileContents, ); } diff --git a/tests/Behat/Context/Setup/Admin/BannerSetupContext.php b/tests/Behat/Context/Setup/Admin/BannerSetupContext.php index 18b7d92..11913f3 100644 --- a/tests/Behat/Context/Setup/Admin/BannerSetupContext.php +++ b/tests/Behat/Context/Setup/Admin/BannerSetupContext.php @@ -48,7 +48,7 @@ public function __construct( FactoryInterface $bannerFactory, ObjectRepository $localeRepository, BannerPage $bannerPage, - BannerRepository $bannerRepository + BannerRepository $bannerRepository, ) { $this->adRepository = $adRepository; $this->sectionRepository = $sectionRepository; @@ -82,7 +82,7 @@ public function theStoreHasSectionWithCode(string $code) public function theStoreHasActiveAdWithCode( string $code, int $priority, - string $name + string $name, ) { /** @var AdInterface $ad */ $ad = $this->adFactory->createNew(); @@ -103,7 +103,7 @@ public function theStoreHasActiveAdWithCode( public function theStoreHasNonActiveAdWithCode( string $code, int $priority, - string $name + string $name, ) { /** @var AdInterface $ad */ $ad = $this->adFactory->createNew(); @@ -128,7 +128,7 @@ public function theStoreHasBannerWithImageAltAndLinkInSectionAndAdWithPriorityIn SectionInterface $section, AdInterface $ad, int $priority, - string $locale + string $locale, ) { $locale = $this->localeRepository->findOneBy(['code' => $locale]); diff --git a/tests/Behat/Context/Ui/Admin/AdContext.php b/tests/Behat/Context/Ui/Admin/AdContext.php index 6a229e4..b735f92 100644 --- a/tests/Behat/Context/Ui/Admin/AdContext.php +++ b/tests/Behat/Context/Ui/Admin/AdContext.php @@ -41,7 +41,7 @@ public function iCreateANewAdWithData( string $startDate, string $endDate, int $priority, - string $code + string $code, ) { $this->adPage->setAdFormData( $name, @@ -49,7 +49,7 @@ public function iCreateANewAdWithData( $startDate, $endDate, $priority, - $code + $code, ); $this->adPage->submitForm(); } diff --git a/tests/Behat/Context/Ui/Admin/BannerContext.php b/tests/Behat/Context/Ui/Admin/BannerContext.php index e03615a..e5666b1 100644 --- a/tests/Behat/Context/Ui/Admin/BannerContext.php +++ b/tests/Behat/Context/Ui/Admin/BannerContext.php @@ -27,7 +27,7 @@ final class BannerContext implements Context public function __construct( BannerPage $bannerPage, - ObjectManager $manager + ObjectManager $manager, ) { $this->bannerPage = $bannerPage; $this->manager = $manager; @@ -66,7 +66,7 @@ public function iFillFormWithAndPriority( SectionInterface $sectionCode, AdInterface $adCode, string $locale, - int $priority + int $priority, ) { $this->bannerPage->fillGeneralInfoForm($sectionCode, $adCode, $locale, $priority); } @@ -77,7 +77,7 @@ public function iFillFormWithAndPriority( public function iAddNewImageAndFillAltAsAndLinksAs( string $image, string $alt, - string $link + string $link, ) { $this->bannerPage->fillBannerInfoForm($alt, $link); $this->bannerPage->attachImage($image); diff --git a/tests/Behat/Context/Ui/Admin/SectionContext.php b/tests/Behat/Context/Ui/Admin/SectionContext.php index 88dd89c..0a457fd 100644 --- a/tests/Behat/Context/Ui/Admin/SectionContext.php +++ b/tests/Behat/Context/Ui/Admin/SectionContext.php @@ -31,7 +31,7 @@ public function iCreateANewSectionWithData( string $name, string $code, int $width, - int $height + int $height, ) { $this->sectionPage->setSectionData($name, $code, $width, $height); $this->sectionPage->submitForm(); diff --git a/tests/Behat/Page/Admin/AdPage.php b/tests/Behat/Page/Admin/AdPage.php index aebabd6..effff80 100644 --- a/tests/Behat/Page/Admin/AdPage.php +++ b/tests/Behat/Page/Admin/AdPage.php @@ -26,7 +26,7 @@ public function setSectionData( string $name, string $code, int $width, - int $height + int $height, ): void { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); @@ -57,7 +57,7 @@ public function setAdFormData( string $startDate, string $endDate, int $priority, - string $code + string $code, ) { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); diff --git a/tests/Behat/Page/Admin/BannerPage.php b/tests/Behat/Page/Admin/BannerPage.php index 7f760cb..c3f1a5f 100644 --- a/tests/Behat/Page/Admin/BannerPage.php +++ b/tests/Behat/Page/Admin/BannerPage.php @@ -28,7 +28,7 @@ public function setSectionData( string $name, string $code, int $width, - int $height + int $height, ): void { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); @@ -57,7 +57,7 @@ public function fillGeneralInfoForm( SectionInterface $sectionCode, AdInterface $adCode, string $locale, - int $priority + int $priority, ): void { $this->getElement('banner_locale_field')->setValue($locale); $this->getElement('banner_section_field')->setValue($sectionCode->getId()); diff --git a/tests/Behat/Page/Admin/SectionPage.php b/tests/Behat/Page/Admin/SectionPage.php index ca47d24..c350d7d 100644 --- a/tests/Behat/Page/Admin/SectionPage.php +++ b/tests/Behat/Page/Admin/SectionPage.php @@ -26,7 +26,7 @@ public function __construct( Session $session, $minkParameters, RouterInterface $router, - NotificationCheckerInterface $notificationChecker + NotificationCheckerInterface $notificationChecker, ) { parent::__construct($session, $minkParameters, $router); $this->notificationChecker = $notificationChecker; @@ -41,7 +41,7 @@ public function setSectionData( string $name, string $code, int $width, - int $height + int $height, ): void { $this->getElement('section_name_field')->setValue($name); $this->getElement('section_code_field')->setValue($code); diff --git a/tests/Behat/Transformer/AdTransformer.php b/tests/Behat/Transformer/AdTransformer.php index 168bcae..216b96d 100644 --- a/tests/Behat/Transformer/AdTransformer.php +++ b/tests/Behat/Transformer/AdTransformer.php @@ -37,7 +37,7 @@ public function getAdByCode(string $adCode): AdInterface Assert::notNull( $ad, - sprintf('Banner ad with code "%s" does not exist', $adCode) + sprintf('Banner ad with code "%s" does not exist', $adCode), ); return $ad; diff --git a/tests/Behat/Transformer/SectionTransformer.php b/tests/Behat/Transformer/SectionTransformer.php index 94c9ec8..50a3efe 100644 --- a/tests/Behat/Transformer/SectionTransformer.php +++ b/tests/Behat/Transformer/SectionTransformer.php @@ -37,7 +37,7 @@ public function getSectionByCode(string $sectionCode): SectionInterface Assert::notNull( $section, - sprintf('Banner section with code "%s" does not exist', $sectionCode) + sprintf('Banner section with code "%s" does not exist', $sectionCode), ); return $section;