Skip to content

Commit

Permalink
[Maintenance] Bring back symplify/easy-coding-standard
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Apr 20, 2021
1 parent 72c5341 commit 4198470
Show file tree
Hide file tree
Showing 75 changed files with 341 additions and 315 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,17 @@ jobs:
name: Load fixtures in test application
run: (cd tests/Application && bin/console sylius:fixtures:load -n)

-
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Run security check
run: symfony security:check

-
name: Run analysis
run: composer analyse
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/

-
name: Run PHPSpec
Expand All @@ -166,6 +170,10 @@ jobs:
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always

-
name: Run Easy Coding Standard
run: vendor/bin/ecs check

-
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun
Expand Down
10 changes: 4 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"phpstan/phpstan": "0.12.29",
"phpstan/phpstan-webmozart-assert": "0.12.6",
"phpunit/phpunit": "^8.5",
"sylius-labs/coding-standard": "^3.2",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
Expand All @@ -64,16 +64,14 @@
"Tests\\Sylius\\RefundPlugin\\Application\\": "tests/Application/src/"
}
},
"conflict": {
"symplify/package-builder": "8.3.25"
},
"scripts": {
"analyse": [
"@composer validate --strict",
"vendor/bin/phpstan.phar analyse -c phpstan.neon -l max src/"
"vendor/bin/ecs check",
"vendor/bin/phpstan analyse -c phpstan.neon -l max src/"
],
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
"vendor/bin/ecs check --fix"
]
},
"config": {
Expand Down
6 changes: 0 additions & 6 deletions easy-coding-standard.yml

This file was deleted.

28 changes: 28 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
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');

$services = $containerConfigurator->services();
$services->set(ArraySyntaxFixer::class)
->call('configure', [[
'syntax' => 'short',
]]);

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/spec',
]);

$parameters->set(Option::SKIP, [
'SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff.MissingVariable',
]);
};
8 changes: 4 additions & 4 deletions spec/Calculator/UnitRefundTotalCalculatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@

final class UnitRefundTotalCalculatorSpec extends ObjectBehavior
{
function let(RemainingTotalProviderInterface $remainingTotalProvider): void
public function let(RemainingTotalProviderInterface $remainingTotalProvider): void
{
$this->beConstructedWith($remainingTotalProvider);
}

function it_implements_unit_refund_total_calculator_interface(): void
public function it_implements_unit_refund_total_calculator_interface(): void
{
$this->shouldImplement(UnitRefundTotalCalculatorInterface::class);
}

function it_provides_remaining_total_if_full_refund_option_is_chosen(
public function it_provides_remaining_total_if_full_refund_option_is_chosen(
RemainingTotalProviderInterface $remainingTotalProvider
): void {
$refundType = RefundType::shipment();
Expand All @@ -34,7 +34,7 @@ function it_provides_remaining_total_if_full_refund_option_is_chosen(
;
}

function it_provides_specified_amount_as_an_integer(): void
public function it_provides_specified_amount_as_an_integer(): void
{
$this
->calculateForUnitWithIdAndType(100, RefundType::shipment(), 30.40)
Expand Down
10 changes: 5 additions & 5 deletions spec/Checker/CreditMemoCustomerRelationCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@

final class CreditMemoCustomerRelationCheckerSpec extends ObjectBehavior
{
function let(
public function let(
CustomerContextInterface $customerContext,
RepositoryInterface $creditMemoRepository
): void {
$this->beConstructedWith($customerContext, $creditMemoRepository);
}

function it_is_initializable(): void
public function it_is_initializable(): void
{
$this->shouldHaveType(CreditMemoCustomerRelationChecker::class);
}

function it_implements_credit_memo_customer_relation_checker_interface(): void
public function it_implements_credit_memo_customer_relation_checker_interface(): void
{
$this->shouldImplement(CreditMemoCustomerRelationCheckerInterface::class);
}

function it_checks_if_customer_id_from_order_is_equal_to_customer_id_from_customer_context(
public function it_checks_if_customer_id_from_order_is_equal_to_customer_id_from_customer_context(
CustomerContextInterface $customerContext,
RepositoryInterface $creditMemoRepository,
CreditMemo $creditMemo,
Expand All @@ -52,7 +52,7 @@ function it_checks_if_customer_id_from_order_is_equal_to_customer_id_from_custom
$this->check('00001');
}

function it_throws_exception_if_customer_id_from_order_is_not_equal_to_id_from_context(
public function it_throws_exception_if_customer_id_from_order_is_not_equal_to_id_from_context(
CustomerContextInterface $customerContext,
RepositoryInterface $creditMemoRepository,
CreditMemo $creditMemo,
Expand Down
10 changes: 5 additions & 5 deletions spec/Checker/OrderFullyRefundedTotalCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@

final class OrderFullyRefundedTotalCheckerSpec extends ObjectBehavior
{
function let(OrderRefundedTotalProviderInterface $orderRefundedTotalProvider): void
public function let(OrderRefundedTotalProviderInterface $orderRefundedTotalProvider): void
{
$this->beConstructedWith($orderRefundedTotalProvider);
}

function it_is_initializable(): void
public function it_is_initializable(): void
{
$this->shouldHaveType(OrderFullyRefundedTotalChecker::class);
}

function it_implements_order_fully_refunded_total_checker_interface(): void
public function it_implements_order_fully_refunded_total_checker_interface(): void
{
$this->shouldImplement(OrderFullyRefundedTotalCheckerInterface::class);
}

function it_returns_false_if_order_refunded_total_is_lower_than_order_total(
public function it_returns_false_if_order_refunded_total_is_lower_than_order_total(
OrderInterface $order,
OrderRefundedTotalProviderInterface $orderRefundedTotalProvider
): void {
Expand All @@ -39,7 +39,7 @@ function it_returns_false_if_order_refunded_total_is_lower_than_order_total(
$this->isOrderFullyRefunded($order)->shouldReturn(false);
}

function it_returns_true_if_order_refunded_total_is_equal_to_order_total(
public function it_returns_true_if_order_refunded_total_is_equal_to_order_total(
OrderInterface $order,
OrderRefundedTotalProviderInterface $orderRefundedTotalProvider
): void {
Expand Down
16 changes: 8 additions & 8 deletions spec/Checker/OrderRefundingAvailabilityCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

final class OrderRefundingAvailabilityCheckerSpec extends ObjectBehavior
{
function let(OrderRepositoryInterface $orderRepository): void
public function let(OrderRepositoryInterface $orderRepository): void
{
$this->beConstructedWith($orderRepository);
}

function it_implements_order_refunding_availability_checker_interface(): void
public function it_implements_order_refunding_availability_checker_interface(): void
{
$this->shouldImplement(OrderRefundingAvailabilityCheckerInterface::class);
}

function it_returns_true_if_order_is_paid_and_not_free(
public function it_returns_true_if_order_is_paid_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -33,7 +33,7 @@ function it_returns_true_if_order_is_paid_and_not_free(
$this('00000007')->shouldReturn(true);
}

function it_returns_true_if_order_is_partially_refunded_and_not_free(
public function it_returns_true_if_order_is_partially_refunded_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -44,7 +44,7 @@ function it_returns_true_if_order_is_partially_refunded_and_not_free(
$this('00000007')->shouldReturn(true);
}

function it_returns_false_if_order_is_in_other_state_and_not_free(
public function it_returns_false_if_order_is_in_other_state_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -55,7 +55,7 @@ function it_returns_false_if_order_is_in_other_state_and_not_free(
$this('00000007')->shouldReturn(false);
}

function it_returns_false_if_order_is_free(
public function it_returns_false_if_order_is_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -66,7 +66,7 @@ function it_returns_false_if_order_is_free(
$this('00000007')->shouldReturn(false);
}

function it_returns_false_if_order_is_partially_refunded_and_free(
public function it_returns_false_if_order_is_partially_refunded_and_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -77,7 +77,7 @@ function it_returns_false_if_order_is_partially_refunded_and_free(
$this('00000007')->shouldReturn(false);
}

function it_returns_false_if_order_is_in_other_state_and_free(
public function it_returns_false_if_order_is_in_other_state_and_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand Down
18 changes: 9 additions & 9 deletions spec/Checker/OrderRefundsListAvailabilityCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

final class OrderRefundsListAvailabilityCheckerSpec extends ObjectBehavior
{
function let(OrderRepositoryInterface $orderRepository): void
public function let(OrderRepositoryInterface $orderRepository): void
{
$this->beConstructedWith($orderRepository);
}

function it_implements_order_refunding_availability_checker_interface(): void
public function it_implements_order_refunding_availability_checker_interface(): void
{
$this->shouldImplement(OrderRefundingAvailabilityCheckerInterface::class);
}

function it_returns_true_if_order_is_paid_and_not_free(
public function it_returns_true_if_order_is_paid_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -33,7 +33,7 @@ function it_returns_true_if_order_is_paid_and_not_free(
$this('00000007')->shouldReturn(true);
}

function it_returns_true_if_order_is_refunded_and_not_free(
public function it_returns_true_if_order_is_refunded_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -44,7 +44,7 @@ function it_returns_true_if_order_is_refunded_and_not_free(
$this('00000007')->shouldReturn(true);
}

function it_returns_true_if_order_is_partially_refunded_and_not_free(
public function it_returns_true_if_order_is_partially_refunded_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -55,7 +55,7 @@ function it_returns_true_if_order_is_partially_refunded_and_not_free(
$this('00000007')->shouldReturn(true);
}

function it_returns_false_if_order_is_in_other_state_and_not_free(
public function it_returns_false_if_order_is_in_other_state_and_not_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -66,7 +66,7 @@ function it_returns_false_if_order_is_in_other_state_and_not_free(
$this('00000007')->shouldReturn(false);
}

function it_returns_false_if_order_is_paid_and_free(
public function it_returns_false_if_order_is_paid_and_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -77,7 +77,7 @@ function it_returns_false_if_order_is_paid_and_free(
$this('00000007')->shouldReturn(false);
}

function it_returns_false_if_order_is_refunded_and_free(
public function it_returns_false_if_order_is_refunded_and_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand All @@ -88,7 +88,7 @@ function it_returns_false_if_order_is_refunded_and_free(
$this('00000007')->shouldReturn(false);
}

function it_returns_false_if_order_is_in_other_state_and_free(
public function it_returns_false_if_order_is_in_other_state_and_free(
OrderRepositoryInterface $orderRepository,
OrderInterface $order
): void {
Expand Down
8 changes: 4 additions & 4 deletions spec/Checker/UnitRefundingAvailabilityCheckerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@

final class UnitRefundingAvailabilityCheckerSpec extends ObjectBehavior
{
function let(
public function let(
RemainingTotalProviderInterface $remainingTotalProvider
): void {
$this->beConstructedWith($remainingTotalProvider);
}

function it_implements_unit_refunding_availability_checker_interface(): void
public function it_implements_unit_refunding_availability_checker_interface(): void
{
$this->shouldImplement(UnitRefundingAvailabilityCheckerInterface::class);
}

function it_returns_false_if_remaining_unit_total_is_0(
public function it_returns_false_if_remaining_unit_total_is_0(
RemainingTotalProviderInterface $remainingTotalProvider
): void {
$type = RefundType::orderItemUnit();
Expand All @@ -32,7 +32,7 @@ function it_returns_false_if_remaining_unit_total_is_0(
$this->__invoke(1, $type)->shouldReturn(false);
}

function it_returns_true_if_remaining_unit_total_is_more_than_0(
public function it_returns_true_if_remaining_unit_total_is_more_than_0(
RemainingTotalProviderInterface $remainingTotalProvider
): void {
$type = RefundType::shipment();
Expand Down
2 changes: 1 addition & 1 deletion spec/Command/GenerateCreditMemoSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class GenerateCreditMemoSpec extends ObjectBehavior
{
function it_represents_an_intention_to_generate_credit_memo(): void
public function it_represents_an_intention_to_generate_credit_memo(): void
{
$unitRefunds = [new OrderItemUnitRefund(1, 1000), new OrderItemUnitRefund(3, 2000), new OrderItemUnitRefund(5, 3000)];
$shipmentRefunds = [new ShipmentRefund(1, 1000)];
Expand Down
2 changes: 1 addition & 1 deletion spec/Command/RefundUnitsSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class RefundUnitsSpec extends ObjectBehavior
{
function it_represents_an_intention_to_refund_specific_order_units_and_shipments(): void
public function it_represents_an_intention_to_refund_specific_order_units_and_shipments(): void
{
$unitRefunds = [new OrderItemUnitRefund(1, 1000), new OrderItemUnitRefund(3, 2000), new OrderItemUnitRefund(5, 3000)];
$shipmentRefunds = [new ShipmentRefund(1, 1000)];
Expand Down
Loading

0 comments on commit 4198470

Please sign in to comment.