Skip to content

Commit

Permalink
Refactor with PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yekovalenkoa committed Feb 1, 2024
1 parent 20149a3 commit 602ba87
Show file tree
Hide file tree
Showing 20 changed files with 159 additions and 279 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"
deps:
- "normal"
include:
- deps: "low"
php-version: "7.4"
php-version: "8.1"

steps:
- name: "Checkout"
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 @@ -11,7 +11,8 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/vendor/
\.php_cs\.cache
\.php-cs-fixer\.cache
.phpunit.result.cache
composer.lock
/.idea
43 changes: 43 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

$config = new PhpCsFixer\Config();

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

return $config
->setRules(
[
'@Symfony' => true,
'strict_param' => false,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'phpdoc_align' => [],
'phpdoc_summary' => false,
'void_return' => false,
'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',
],
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
'nullable_type_declaration' => true,
'nullable_type_declaration_for_default_null_value' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'parameters']],
]
);
26 changes: 0 additions & 26 deletions .php_cs

This file was deleted.

97 changes: 50 additions & 47 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,53 @@
{
"name": "answear/inpost-pickup-point-bundle",
"description": "API Client for Inpost.",
"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": {
"roave/security-advisories": "dev-master",
"phpunit/phpunit": "^8.4",
"symfony/phpunit-bridge": "^5.0",
"phpro/grumphp": "^0.20",
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12.32",
"phpstan/phpstan-webmozart-assert": "^0.12.2"
},
"autoload": {
"psr-4": {
"Answear\\InpostBundle\\": "src/"
"name": "answear/inpost-pickup-point-bundle",
"description": "API Client for Inpost.",
"type": "symfony-bundle",
"license": "MIT",
"require": {
"php": "^8.1",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.0",
"phpstan/phpstan-deprecation-rules": "^1.1",
"symfony/http-kernel": "^6.0",
"symfony/serializer": "^6.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
"roave/security-advisories": "dev-master",
"phpunit/phpunit": "^9.6.16",
"symfony/phpunit-bridge": "6.1.*",
"phpro/grumphp": "^1.16",
"friendsofphp/php-cs-fixer": "^3.48",
"phpstan/phpstan": "^1.10.57",
"phpstan/phpstan-webmozart-assert": "^1.2.4"
},
"autoload": {
"psr-4": {
"Answear\\InpostBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Answear\\InpostBundle\\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\\InpostBundle\\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
9 changes: 8 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

parameters:
level: 5
checkNullables: true
checkUnionTypes: true
treatPhpDocTypesAsCertain: false
paths:
- %rootDir%/../../../src
- %rootDir%/../../../src
excludePaths:
- src/Tests/*
- tests/*
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
>
<php>
<ini name="error_reporting" value="-1"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>

<testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Client
private ClientInterface $client;

public function __construct(
?ClientInterface $client = null
?ClientInterface $client = null,
) {
$this->client = $client ?? new GuzzleClient(
[
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
Loading

0 comments on commit 602ba87

Please sign in to comment.