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..12cb468 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" @@ -133,8 +130,11 @@ jobs: - name: Validate database schema run: (cd tests/Application && bin/console doctrine:schema:validate) + - name: Run PHPStan + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + - name: Run ECS - run: vendor/bin/ecs check src + run: vendor/bin/ecs check src tests/Behat - name: Run PHPSpec run: vendor/bin/phpspec run --ansi -f progress --no-interaction diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml deleted file mode 100644 index e93a702..0000000 --- a/.github/workflows/coding_standard.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Coding standard - -on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: ~ - release: - types: [created] - workflow_dispatch: ~ - -jobs: - tests: - runs-on: ubuntu-latest - - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, - MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}" - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1", "8.2", "8.3"] - symfony: ["^5.4", "^6.0"] - 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" - - - env: - APP_ENV: test - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" - - steps: - - - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none - - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - - name: Cache Composer - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Restrict Symfony version - if: matrix.symfony != '' - run: | - composer config extra.symfony.require "${{ matrix.symfony }}" - - - name: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - - - name: Install PHP dependencies - run: composer install --no-interaction - - - - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - - - - name: Run ECS - run: vendor/bin/ecs - - - - name: Failed build Slack notification - uses: rtCamp/action-slack-notify@v2 - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} - env: - SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://github.com/rtCamp.png?size=48 - SLACK_MESSAGE: ':x:' - SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository - SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} 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;