Skip to content

Commit

Permalink
Merge pull request #8 from answear/support-symfony6
Browse files Browse the repository at this point in the history
Support Symfony6
  • Loading branch information
lukasz-falda authored Aug 18, 2022
2 parents 3b1b8ef + ef6e8ec commit ab69039
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
deps:
- "normal"
include:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
matrix:
php-version:
- "7.4"

- "8.0"
- "8.1"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/vendor/
\.php_cs\.cache
.phpunit.result.cache
*.cache
composer.lock
/.idea
/.env*
22 changes: 18 additions & 4 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<?php

$finder = PhpCsFixer\Finder::create()
declare(strict_types=1);

$config = new PhpCsFixer\Config();

$finder = $config->getFinder()
->exclude(
[
'vendor',
]
)
->in(__DIR__);

return PhpCsFixer\Config::create()
return $config
->registerCustomFixers([])
->setRules(
[
'@Symfony' => true,
Expand All @@ -21,6 +26,15 @@
'phpdoc_var_without_name' => false,
'phpdoc_to_comment' => false,
'single_line_throw' => false,
'modernize_types_casting' => true,
'function_declaration' => false,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
]
)
->setFinder($finder);
);
97 changes: 50 additions & 47 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,53 @@
{
"name": "answear/econt-pickup-point-bundle",
"description": "API Client for EcontBundle",
"type": "symfony-bundle",
"license": "MIT",
"require": {
"php": ">=7.4",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.0",
"marc-mabe/php-enum": "^3.0|^4.3",
"symfony/http-kernel": "^4.4|^5.0",
"symfony/serializer": "^4.4|^5.0",
"webmozart/assert": "^1.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"phpro/grumphp": "^1.3.0",
"phpstan/phpstan": "^0.12.32",
"phpstan/phpstan-webmozart-assert": "^0.12.2",
"phpunit/phpunit": "^8.4",
"roave/security-advisories": "dev-master",
"symfony/phpunit-bridge": "^5.0"
},
"autoload": {
"psr-4": {
"Answear\\EcontBundle\\": "src/"
"name": "answear/econt-pickup-point-bundle",
"description": "API Client for EcontBundle",
"type": "symfony-bundle",
"license": "MIT",
"require": {
"php": ">=7.4|^8.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.0|^7.0",
"marc-mabe/php-enum": "^3.0|^4.3",
"symfony/http-kernel": "^5.4|^6.0",
"symfony/serializer": "^5.4|^6.0",
"webmozart/assert": "^1.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"phpro/grumphp": "^1.5.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master",
"symfony/phpunit-bridge": "6.1.*"
},
"autoload": {
"psr-4": {
"Answear\\EcontBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Answear\\EcontBundle\\Tests\\": "tests/"
}
},
"scripts": {
"post-install-cmd": [
"GrumPHP\\Composer\\DevelopmentIntegrator::integrate"
],
"post-update-cmd": [
"GrumPHP\\Composer\\DevelopmentIntegrator::integrate"
]
},
"extra": {
"grumphp": {
"config-default-path": "grumphp.yaml"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"phpro/grumphp": true
}
}
},
"autoload-dev": {
"psr-4": {
"Answear\\EcontBundle\\Tests\\": "tests/"
}
},
"scripts": {
"post-install-cmd": [
"GrumPHP\\Composer\\DevelopmentIntegrator::integrate"
],
"post-update-cmd": [
"GrumPHP\\Composer\\DevelopmentIntegrator::integrate"
]
},
"extra": {
"grumphp": {
"config-default-path": "grumphp.yaml"
}
},
"config": {
"sort-packages": true
}
}
2 changes: 1 addition & 1 deletion grumphp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ grumphp:
phpcsfixer:
allow_risky: true
cache_file: ~
config: './.php_cs'
config: './.php-cs-fixer.php'
using_cache: true
verbose: true
phpstan:
Expand Down
16 changes: 16 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
ignoreErrors:
-
message: "#^Property Answear\\\\EcontBundle\\\\Request\\\\GetCitiesRequest\\:\\:\\$countryCode is never read, only written\\.$#"
count: 1
path: src/Request/GetCitiesRequest.php

-
message: "#^Property Answear\\\\EcontBundle\\\\Request\\\\GetOfficesRequest\\:\\:\\$cityId is never read, only written\\.$#"
count: 1
path: src/Request/GetOfficesRequest.php

-
message: "#^Property Answear\\\\EcontBundle\\\\Request\\\\GetOfficesRequest\\:\\:\\$countryCode is never read, only written\\.$#"
count: 1
path: src/Request/GetOfficesRequest.php
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
- phpstan-baseline.neon

parameters:
level: 5
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function serialize(Request $request): string
{
return $this->getSerializer()->serialize(
$request,
static::FORMAT,
self::FORMAT,
[Normalizer\AbstractObjectNormalizer::SKIP_NULL_VALUES => true]
);
}
Expand Down
5 changes: 3 additions & 2 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ConfigProvider
{
private const URL = 'http://ee.econt.com/';
private const SERVICE_URI = '/services/Nomenclatures/';

private string $user;
private string $password;

Expand All @@ -27,12 +28,12 @@ public function getRequestHeaders(): array

public function getUrl(): string
{
return static::URL;
return self::URL;
}

public function getServiceURI(): string
{
return static::SERVICE_URI;
return self::SERVICE_URI;
}

public function getUser(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Request/GetCitiesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public function __construct(?string $countryCode = null)

public function getEndpoint(): string
{
return static::ENDPOINT;
return self::ENDPOINT;
}

public function getMethod(): string
{
return static::HTTP_METHOD;
return self::HTTP_METHOD;
}
}
4 changes: 2 additions & 2 deletions src/Request/GetOfficesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function __construct(?string $countryCode = null, ?int $cityId = null)

public function getEndpoint(): string
{
return static::ENDPOINT;
return self::ENDPOINT;
}

public function getMethod(): string
{
return static::HTTP_METHOD;
return self::HTTP_METHOD;
}
}
2 changes: 1 addition & 1 deletion src/Response/ErrorResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function isErrorResponse(array $response): bool

public static function fromArray(array $response): self
{
if (!static::isErrorResponse($response)) {
if (!self::isErrorResponse($response)) {
throw new RuntimeException('Cannot create ErrorResponse');
}

Expand Down

0 comments on commit ab69039

Please sign in to comment.