Skip to content

Commit

Permalink
coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherhero committed Jul 29, 2024
1 parent 60f20b5 commit 187eb5b
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 138 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @BitBagCommerce
* @Sylius/core-team
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~
Expand All @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -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
Expand Down
97 changes: 0 additions & 97 deletions .github/workflows/coding_standard.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Controller/Action/CountClicksAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class CountClicksAction

public function __construct(
BannerRepositoryInterface $bannerRepository,
ObjectManager $objectManager
ObjectManager $objectManager,
) {
$this->bannerRepository = $bannerRepository;
$this->objectManager = $objectManager;
Expand Down
4 changes: 2 additions & 2 deletions src/DataProvider/GetAdsBannersDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public function __construct(AdRepositoryInterface $adRepository, BannersProvider
public function supports(
string $resourceClass,
string $operationName = null,
array $context = []
array $context = [],
): bool {
return Banner::class === $resourceClass;
}

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;
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/BannerPathGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand All @@ -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),
);
}
}
4 changes: 2 additions & 2 deletions src/Operator/BannersOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class BannersOperator implements BannersOperatorInterface
public function operate(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
/** @var Collection<int, BannerInterface> $adBanners */
$adBanners = $ad->getBanners();
Expand All @@ -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() &&
Expand Down
2 changes: 1 addition & 1 deletion src/Operator/BannersOperatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ interface BannersOperatorInterface
public function operate(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array;
}
4 changes: 2 additions & 2 deletions src/Provider/BannersProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(BannersOperatorInterface $bannersOperator)
public function getAdsBanners(
array $ads,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
$banners = [];

Expand All @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Provider/BannersProviderInterface.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

declare(strict_types=1);

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

namespace BitBag\SyliusBannerPlugin\Provider;

use BitBag\SyliusBannerPlugin\Entity\AdInterface;
Expand All @@ -18,12 +18,12 @@ interface BannersProviderInterface
public function getAdsBanners(
array $ads,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array;

public function getAdBanners(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array;
}
4 changes: 2 additions & 2 deletions src/Twig/Extension/BannerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getFunctions(): array

public function getActiveAdsBannersBySectionAndLocale(
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
$ads = $this->adRepository->findAllActiveAds();

Expand All @@ -52,7 +52,7 @@ public function getActiveAdsBannersBySectionAndLocale(
public function getActiveAdBannersByCodeSectionAndLocale(
string $adCode,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
$ad = $this->adRepository->findActiveAdByCode($adCode);

Expand Down
2 changes: 1 addition & 1 deletion src/Uploader/BannerUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function upload(BannerInterface $banner): void

$this->filesystem->write(
$path,
$fileContents
$fileContents,
);
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Behat/Context/Setup/Admin/BannerSetupContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
FactoryInterface $bannerFactory,
ObjectRepository $localeRepository,
BannerPage $bannerPage,
BannerRepository $bannerRepository
BannerRepository $bannerRepository,
) {
$this->adRepository = $adRepository;
$this->sectionRepository = $sectionRepository;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -128,7 +128,7 @@ public function theStoreHasBannerWithImageAltAndLinkInSectionAndAdWithPriorityIn
SectionInterface $section,
AdInterface $ad,
int $priority,
string $locale
string $locale,
) {
$locale = $this->localeRepository->findOneBy(['code' => $locale]);

Expand Down
4 changes: 2 additions & 2 deletions tests/Behat/Context/Ui/Admin/AdContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public function iCreateANewAdWithData(
string $startDate,
string $endDate,
int $priority,
string $code
string $code,
) {
$this->adPage->setAdFormData(
$name,
$enabled,
$startDate,
$endDate,
$priority,
$code
$code,
);
$this->adPage->submitForm();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Context/Ui/Admin/BannerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class BannerContext implements Context

public function __construct(
BannerPage $bannerPage,
ObjectManager $manager
ObjectManager $manager,
) {
$this->bannerPage = $bannerPage;
$this->manager = $manager;
Expand Down Expand Up @@ -66,7 +66,7 @@ public function iFillFormWithAndPriority(
SectionInterface $sectionCode,
AdInterface $adCode,
string $locale,
int $priority
int $priority,
) {
$this->bannerPage->fillGeneralInfoForm($sectionCode, $adCode, $locale, $priority);
}
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Behat/Context/Ui/Admin/SectionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions tests/Behat/Page/Admin/AdPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 187eb5b

Please sign in to comment.