Skip to content

Commit

Permalink
Merge pull request #5 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 d4198b8 + 9215d3a commit 5bee524
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 62 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
2 changes: 2 additions & 0 deletions .github/workflows/static-analysis.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"

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
*.cache
.phpunit.result.cache
composer.lock
/.idea
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/speedy-pickup-point-bundle",
"description": "API Client for Speedy.bg.",
"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\\SpeedyBundle\\": "src/"
"name": "answear/speedy-pickup-point-bundle",
"description": "API Client for Speedy.bg.",
"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\\SpeedyBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Answear\\SpeedyBundle\\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\\SpeedyBundle\\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
26 changes: 26 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
ignoreErrors:
-
message: "#^Property Answear\\\\SpeedyBundle\\\\Client\\\\Client\\:\\:\\$configuration is never read, only written\\.$#"
count: 1
path: src/Client/Client.php

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

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

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

-
message: "#^Property Answear\\\\SpeedyBundle\\\\Request\\\\FindOfficeRequest\\:\\:\\$siteId is never read, only written\\.$#"
count: 1
path: src/Request/FindOfficeRequest.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
4 changes: 2 additions & 2 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function __construct(string $username, string $password, string $language

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

public function getApiVersion(): string
{
return static::API_VERSION;
return self::API_VERSION;
}

public function getUsername(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Request/FindOfficeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public function __construct(?int $countryId = null, ?int $siteId = null, ?string

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/Response/Struct/OfficeCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function __construct(array $offices)
}

/**
* @return Office[]
* @return \Traversable<Office>
*/
public function getIterator(): iterable
public function getIterator(): \Traversable
{
foreach ($this->offices as $key => $office) {
yield $key => $office;
Expand Down
4 changes: 2 additions & 2 deletions src/Response/Struct/WorkingTimeSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public static function fromArray(array $data): self
}

/**
* @return WorkingTime[]
* @return \Traversable<WorkingTime>
*/
public function getIterator(): iterable
public function getIterator(): \Traversable
{
foreach ($this->workingTimeCollection as $key => $workingTime) {
yield $key => $workingTime;
Expand Down

0 comments on commit 5bee524

Please sign in to comment.