Skip to content

Commit

Permalink
Merge pull request #17 from BitBagCommerce/OPSRC-496/Add_bitbag_codin…
Browse files Browse the repository at this point in the history
…g_standard_to_every_plugin

OPSRC-496/Add bitbag coding standard and ecs fix
  • Loading branch information
fabulousPuppet committed Jul 29, 2022
2 parents 38a3c38 + a86f210 commit 7991d07
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ jobs:
-
name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)

-
name: Run ECS
run: vendor/bin/ecs check src

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

-
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^1.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -34,15 +35,14 @@
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.1",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"vimeo/psalm": "4.7.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
"vimeo/psalm": "4.7.1"
},
"config": {
"sort-packages": true,
Expand Down
10 changes: 5 additions & 5 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');

$containerConfigurator->parameters()->set(Option::SKIP, [
VisibilityRequiredFixer::class => ['*Spec.php'],
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
]);
};
7 changes: 5 additions & 2 deletions src/Api/ShippingLabelFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ class ShippingLabelFetcher implements ShippingLabelFetcherInterface

private FlashBagInterface $flashBag;

public function __construct(FlashBagInterface $flashBag, WebClientInterface $webClient, SoapClientInterface $soapClient)
{
public function __construct(
FlashBagInterface $flashBag,
WebClientInterface $webClient,
SoapClientInterface $soapClient
) {
$this->flashBag = $flashBag;
$this->webClient = $webClient;
$this->soapClient = $soapClient;
Expand Down
8 changes: 4 additions & 4 deletions src/Api/WebClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ private function getContent(): string
foreach ($this->getOrder()->getItems() as $item) {
$mainTaxon = $item->getProduct()->getMainTaxon();

if ($mainTaxon !== null) {
if (stristr($content, $mainTaxon->getName()) === false) {
if (null !== $mainTaxon) {
if (false === stristr($content, $mainTaxon->getName())) {
$content .= $mainTaxon->getName() . ', ';
}
}
Expand Down Expand Up @@ -202,11 +202,11 @@ private function resolveWeekend(\DateTime $date): \DateTime
{
$dayOfWeek = (int) $date->format('N');

if ($dayOfWeek === 6) {
if (6 === $dayOfWeek) {
return $date->modify('+2 days');
}

if ($dayOfWeek === 7) {
if (7 === $dayOfWeek) {
return $date->modify('+1 day');
}

Expand Down

0 comments on commit 7991d07

Please sign in to comment.