Skip to content

Commit

Permalink
OP-374 - Applied ECS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkalon committed Jul 15, 2024
1 parent 4162fcc commit 432b79d
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 41 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"twig/twig": "^2.10.0"
},
"conflict": {
"behat/mink-selenium2-driver": ">=1.7.0"
"behat/mink-selenium2-driver": ">=1.7.0",
"symplify/easy-coding-standard": ">10.2.10"
},
"config": {
"sort-packages": true,
Expand Down
12 changes: 6 additions & 6 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
declare(strict_types=1);

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
use Symplify\EasyCodingStandard\Config\ECSConfig;

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->import('vendor/bitbag/coding-standard/ecs.php');

$ecsConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
Expand Down
8 changes: 8 additions & 0 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/

declare(strict_types=1);

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

use Tests\BitBag\SyliusInPostPlugin\Application\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
use Tests\BitBag\SyliusInPostPlugin\Application\Kernel;

require dirname(__DIR__) . '/config/bootstrap.php';

Expand Down
1 change: 0 additions & 1 deletion tests/Behat/Context/Setup/ShippingGatewayContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Sylius\Component\Product\Resolver\ProductVariantResolverInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Component\Shipping\Model\ShipmentUnitInterface;
use Webmozart\Assert\Assert;

final class ShippingGatewayContext implements Context
{
Expand Down
1 change: 0 additions & 1 deletion tests/Behat/Context/Ui/Admin/ShippingMethodContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

class ShippingMethodContext implements Context
{

private UpdatePageInterface $updatePage;

public function __construct(
Expand Down
6 changes: 3 additions & 3 deletions tests/Spec/Builder/AddressBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AddressBuilder
{
private AddressInterface $address;

public static function create(): AddressBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -27,14 +27,14 @@ private function __construct()
$this->address = new Address();
}

public function withPhoneNumber(string $phoneNumber): AddressBuilder
public function withPhoneNumber(string $phoneNumber): self
{
$this->address->setPhoneNumber($phoneNumber);

return $this;
}

public function build():AddressInterface
public function build(): AddressInterface
{
return $this->address;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Spec/Builder/OrderBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OrderBuilder
{
private OrderInterface $order;

public static function create(): OrderBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -28,14 +28,14 @@ private function __construct()
$this->order = new Order();
}

public function withShipment(ShipmentInterface $shipment):OrderBuilder
public function withShipment(ShipmentInterface $shipment): self
{
$this->order->addShipment($shipment);

return $this;
}

public function withNumber(string $number): OrderBuilder
public function withNumber(string $number): self
{
$this->order->setNumber($number);

Expand Down
8 changes: 2 additions & 6 deletions tests/Spec/Builder/PaymentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@

namespace Tests\BitBag\SyliusInPostPlugin\Spec\Builder;

use Sylius\Component\Core\Model\Order;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\Payment;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Model\PaymentMethod;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Core\Model\ShipmentInterface;

class PaymentBuilder
{
private PaymentInterface $payment;

public static function create(): PaymentBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -32,7 +28,7 @@ private function __construct()
$this->payment = new Payment();
}

public function withPaymentMethod(PaymentMethodInterface $paymentMethod): PaymentBuilder
public function withPaymentMethod(PaymentMethodInterface $paymentMethod): self
{
$this->payment->setMethod($paymentMethod);

Expand Down
7 changes: 2 additions & 5 deletions tests/Spec/Builder/PaymentMethodBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@

namespace Tests\BitBag\SyliusInPostPlugin\Spec\Builder;

use Sylius\Component\Core\Model\Order;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentMethod;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Core\Model\ShipmentInterface;

class PaymentMethodBuilder
{
private PaymentMethodInterface $paymentMethod;

public static function create(): PaymentMethodBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -30,7 +27,7 @@ private function __construct()
$this->paymentMethod = new PaymentMethod();
}

public function withCode(string $code): PaymentMethodBuilder
public function withCode(string $code): self
{
$this->paymentMethod->setCode($code);

Expand Down
6 changes: 3 additions & 3 deletions tests/Spec/Builder/ShipmentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ShipmentBuilder
{
private ShipmentInterface $shipment;

public static function create(): ShipmentBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -29,14 +29,14 @@ private function __construct()
$this->shipment = new Shipment();
}

public function withShippingMethod(ShippingMethodInterface $shippingMethod): ShipmentBuilder
public function withShippingMethod(ShippingMethodInterface $shippingMethod): self
{
$this->shipment->setMethod($shippingMethod);

return $this;
}

public function withOrder(OrderInterface $order): ShipmentBuilder
public function withOrder(OrderInterface $order): self
{
$this->shipment->setOrder($order);

Expand Down
8 changes: 4 additions & 4 deletions tests/Spec/Builder/ShippingExportBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ShippingExportBuilder
{
private ShippingExportInterface $shippingExport;

public static function create(): ShippingExportBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -29,21 +29,21 @@ private function __construct()
$this->shippingExport = new ShippingExport();
}

public function withShipment(ShipmentInterface $shipment): ShippingExportBuilder
public function withShipment(ShipmentInterface $shipment): self
{
$this->shippingExport->setShipment($shipment);

return $this;
}

public function withExternalId(string $id): ShippingExportBuilder
public function withExternalId(string $id): self
{
$this->shippingExport->setExternalId($id);

return $this;
}

public function withShippingGateway(ShippingGatewayInterface $shippingGateway): ShippingExportBuilder
public function withShippingGateway(ShippingGatewayInterface $shippingGateway): self
{
$this->shippingExport->setShippingGateway($shippingGateway);

Expand Down
6 changes: 3 additions & 3 deletions tests/Spec/Builder/ShippingGatewayBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ShippingGatewayBuilder
{
private ShippingGatewayInterface $shippingGateway;

public static function create(): ShippingGatewayBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -27,14 +27,14 @@ private function __construct()
$this->shippingGateway = new ShippingGateway();
}

public function withCode(string $code): ShippingGatewayBuilder
public function withCode(string $code): self
{
$this->shippingGateway->setCode($code);

return $this;
}

public function build():ShippingGatewayInterface
public function build(): ShippingGatewayInterface
{
return $this->shippingGateway;
}
Expand Down
6 changes: 2 additions & 4 deletions tests/Spec/Builder/ShippingMethodBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@

namespace Tests\BitBag\SyliusInPostPlugin\Spec\Builder;

use Sylius\Component\Core\Model\Shipment;
use Sylius\Component\Core\Model\ShipmentInterface;
use Sylius\Component\Core\Model\ShippingMethod;
use Sylius\Component\Core\Model\ShippingMethodInterface;

class ShippingMethodBuilder
{
private ShippingMethodInterface $shippingMethod;

public static function create(): ShippingMethodBuilder
public static function create(): self
{
return new self();
}
Expand All @@ -29,7 +27,7 @@ private function __construct()
$this->shippingMethod = new ShippingMethod();
}

public function withCode(string $code): ShippingMethodBuilder
public function withCode(string $code): self
{
$this->shippingMethod->setCode($code);

Expand Down

0 comments on commit 432b79d

Please sign in to comment.