Skip to content

Commit

Permalink
feature #305 Bring back easy-coding-standard + apply CS fixes (GSadee)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

2ec06c0 Bring back easy-coding-standard
d3fb140 Apply coding standard fixes
6638dea Add missing license docblocks
  • Loading branch information
AdamKasp authored Jun 2, 2021
2 parents 905077e + 6638dea commit e5b3b8a
Show file tree
Hide file tree
Showing 219 changed files with 2,245 additions and 286 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ jobs:
name: Validate composer.json
run: composer validate --ansi --strict

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

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/
Expand Down
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"phpstan/phpstan": "0.12.84",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.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,13 +64,11 @@
"Tests\\Sylius\\RefundPlugin\\Application\\": "tests/Application/src/"
}
},
"conflict": {
"symplify/package-builder": "8.3.25"
},
"scripts": {
"analyse": [
"@composer validate --strict",
"vendor/bin/phpstan analyse -c phpstan.neon -l max src/"
"vendor/bin/phpstan analyse -c phpstan.neon -l max src/",
"vendor/bin/ecs check src/ spec/"
],
"fix": [
"vendor/bin/ecs check src/ spec/ --fix"
Expand Down
6 changes: 0 additions & 6 deletions easy-coding-standard.yml

This file was deleted.

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

use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
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->services()->set(HeaderCommentFixer::class)->call('configure', [[
'location' => 'after_open',
'header' =>
'This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.',
]]);

$containerConfigurator->parameters()->set(Option::SKIP, [
InlineDocCommentDeclarationSniff::class . '.MissingVariable',
'**/var/*',
]);
};
17 changes: 13 additions & 4 deletions spec/Calculator/UnitRefundTotalCalculatorSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace spec\Sylius\RefundPlugin\Calculator;
Expand All @@ -11,17 +20,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 +43,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
19 changes: 14 additions & 5 deletions spec/Checker/CreditMemoCustomerRelationCheckerSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace spec\Sylius\RefundPlugin\Checker;
Expand All @@ -16,24 +25,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 +61,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
19 changes: 14 additions & 5 deletions spec/Checker/OrderFullyRefundedTotalCheckerSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace spec\Sylius\RefundPlugin\Checker;
Expand All @@ -12,22 +21,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 +48,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
25 changes: 17 additions & 8 deletions spec/Checker/OrderRefundingAvailabilityCheckerSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace spec\Sylius\RefundPlugin\Checker;
Expand All @@ -12,17 +21,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 +42,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 +53,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 +64,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 +75,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 +86,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
27 changes: 18 additions & 9 deletions spec/Checker/OrderRefundsListAvailabilityCheckerSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace spec\Sylius\RefundPlugin\Checker;
Expand All @@ -12,17 +21,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 +42,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 +53,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 +64,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 +75,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 +86,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 +97,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
Loading

0 comments on commit e5b3b8a

Please sign in to comment.