Skip to content

Commit

Permalink
[DV-8390] Added CS rules just like the Commerce System.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkevindev committed Apr 18, 2024
1 parent f8331ec commit 9dae832
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 8 deletions.
37 changes: 35 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,43 @@
->setRules([
'@Symfony' => true,
'@PSR12' => true,
'ordered_imports' => true,
'yoda_style' => false,
'array_syntax' => [
'syntax' => 'short',
],
'phpdoc_to_comment' => false,
'declare_strict_types' => true,
'global_namespace_import' => [
'import_classes' => true,
],
'phpdoc_separation' => false,
'multiline_whitespace_before_semicolons' => true,
'trailing_comma_in_multiline' => [
'elements' => [
'arrays',
'parameters',
'match',
],
],
'no_unused_imports' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'case',
'property',
'construct',
'destruct',
'magic',
'phpunit',
'method_public',
'method_protected',
'method_private',
],
],
'ordered_imports' => true,
'yoda_style' => false,
'nullable_type_declaration_for_default_null_value' => false,
])
->setFinder($finder);
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
},
"scripts": {
"check-phpstan": "vendor/bin/phpstan analyse",
"check-code-style": "vendor/bin/php-cs-fixer fix --dry-run -v",
"fix-code-style": "vendor/bin/php-cs-fixer fix",
"check-code-style": "vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run -v",
"fix-code-style": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
"test": "phpunit"
}
}
2 changes: 2 additions & 0 deletions src/Exception/ClientException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Exception;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/HttpExceptionTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Exception;

use Symfony\Contracts\HttpClient\ResponseInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/RedirectionException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Exception;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ServerException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Exception;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Response/VerboseErrorResponse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Response;

use Superbrave\VerboseErrorHttpClient\Exception\ClientException;
Expand Down
2 changes: 2 additions & 0 deletions src/VerboseErrorHttpClient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient;

use Superbrave\VerboseErrorHttpClient\Response\VerboseErrorResponse;
Expand Down
8 changes: 5 additions & 3 deletions tests/Response/VerboseErrorResponseTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Tests\Response;

use PHPUnit\Framework\MockObject\MockObject;
Expand Down Expand Up @@ -68,7 +70,7 @@ public function testGetHeaders(
?HttpExceptionInterface $exception,
int $httpCode,
?string $expectedExceptionClass,
?string $expectedExceptionMessage
?string $expectedExceptionMessage,
): void {
$method = $this->wrappedResponseMock->expects($this->once())
->method('getHeaders')
Expand Down Expand Up @@ -110,7 +112,7 @@ public function testGetContent(
?HttpExceptionInterface $exception,
int $httpCode,
?string $expectedExceptionClass,
?string $expectedExceptionMessage
?string $expectedExceptionMessage,
): void {
$method = $this->wrappedResponseMock->expects($this->atLeastOnce())
->method('getContent')
Expand Down Expand Up @@ -161,7 +163,7 @@ public function testToArray(
?HttpExceptionInterface $exception,
int $httpCode,
?string $expectedExceptionClass,
?string $expectedExceptionMessage
?string $expectedExceptionMessage,
): void {
$method = $this->wrappedResponseMock->expects($this->once())
->method('toArray')
Expand Down
4 changes: 3 additions & 1 deletion tests/VerboseErrorHttpClientTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Superbrave\VerboseErrorHttpClient\Tests;

use ArrayIterator;
Expand Down Expand Up @@ -68,7 +70,7 @@ public function testRequestThrowsClientException(MockResponse $response, string
*/
public function testRequestThrowsRedirectionException(
MockResponse $response,
string $expectedExceptionMessage
string $expectedExceptionMessage,
): void {
$this->mockResponses[] = $response;

Expand Down

0 comments on commit 9dae832

Please sign in to comment.