Skip to content

Commit 414cb07

Browse files
authored
Updated deps and applied new code style (#2)
1 parent d0c6266 commit 414cb07

File tree

8 files changed

+74
-56
lines changed

8 files changed

+74
-56
lines changed

.github/workflows/build.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: build
2+
on:
3+
push: ~
4+
pull_request: ~
5+
schedule:
6+
- cron: 5 8 * * 3
7+
jobs:
8+
checks:
9+
name: PHP ${{ matrix.php-versions }}
10+
runs-on: ${{ matrix.operating-system }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
operating-system: [ubuntu-latest]
15+
php-versions: ['7.2', '7.3']
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v1
19+
- name: Setup PHP, with composer and extensions
20+
uses: shivammathur/setup-php@master
21+
with:
22+
php-version: ${{ matrix.php-versions }}
23+
extension-csv: intl
24+
- name: Install Composer dependencies
25+
run: composer update --no-progress --no-suggest --prefer-dist --no-interaction
26+
- name: Validate composer
27+
run: composer validate --strict
28+
- name: Check composer normalized
29+
run: composer normalize --dry-run
30+
- name: Check style
31+
run: composer check-style
32+
- name: Static analysis
33+
run: composer analyse
34+
- name: Run phpspec
35+
run: composer phpspec
36+
- name: Run phpunit
37+
run: composer phpunit

composer.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,27 @@
1414
"psr/http-client": "^1.0",
1515
"psr/http-factory": "^1.0",
1616
"psr/http-message": "^1.0",
17-
"thecodingmachine/safe": "^0.1.15",
17+
"thecodingmachine/safe": "^1.0",
1818
"webmozart/assert": "^1.4"
1919
},
2020
"require-dev": {
21+
"ergebnis/composer-normalize": "^2.0",
22+
"korbeil/phpstan-generic-rules": "^0.2.4",
2123
"kriswallsmith/buzz": "^1.0",
22-
"localheinz/composer-normalize": "^1.1",
2324
"nyholm/psr7": "^1.1",
24-
"phpspec/phpspec": "^5.1",
25-
"phpstan/phpstan": "^0.11",
26-
"phpstan/phpstan-strict-rules": "^0.11",
25+
"phpspec/phpspec": "^5.1 || ^6.0",
26+
"phpstan/phpstan": "^0.12",
27+
"phpstan/phpstan-strict-rules": "^0.12",
2728
"phpunit/phpunit": "^8.0",
28-
"symplify/easy-coding-standard": "^5.1",
29-
"thecodingmachine/phpstan-safe-rule": "^0.1.3"
29+
"sylius-labs/coding-standard": "^3.1",
30+
"thecodingmachine/phpstan-safe-rule": "^1.0@beta"
3031
},
3132
"config": {
3233
"sort-packages": true
3334
},
3435
"extra": {
3536
"branch-alias": {
36-
"dev-master": "2.1-dev"
37+
"dev-master": "2.2-dev"
3738
}
3839
},
3940
"autoload": {
@@ -43,12 +44,14 @@
4344
},
4445
"prefer-stable": true,
4546
"scripts": {
46-
"analyse": "./vendor/bin/phpstan analyse -c phpstan.neon -l max src",
47-
"check-style": "./vendor/bin/ecs check --ansi src/ tests/ spec/",
48-
"fix-style": "./vendor/bin/ecs check --fix --ansi src/ tests/ spec/",
47+
"analyse": "vendor/bin/phpstan analyse -c phpstan.neon -l max src",
48+
"check-style": "vendor/bin/ecs check --ansi src/ tests/ spec/",
49+
"fix-style": "vendor/bin/ecs check --fix --ansi src/ tests/ spec/",
50+
"phpspec": "vendor/bin/phpspec run",
51+
"phpunit": "vendor/bin/phpunit",
4952
"test": [
50-
"./vendor/bin/phpspec run",
51-
"./vendor/bin/phpunit"
53+
"@phpspec",
54+
"@phpunit"
5255
]
5356
}
5457
}

easy-coding-standard.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
11
imports:
2-
- { resource: 'vendor/symplify/easy-coding-standard/config/symfony.yml' }
3-
4-
services:
5-
PhpCsFixer\Fixer\Import\OrderedImportsFixer: ~
6-
PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer: ~
7-
PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer: ~
8-
PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: ~
2+
- { resource: 'vendor/sylius-labs/coding-standard/easy-coding-standard.yml' }

phpstan.neon

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
includes:
2-
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
2+
- vendor/korbeil/phpstan-generic-rules/extension.neon
3+
- vendor/phpstan/phpstan-strict-rules/rules.neon
4+
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
35

46
parameters:
5-
excludes_analyse:
6-
# Test dependencies
7-
- 'tests/**.php'
7+
checkMissingIterableValueType: false
8+
9+
excludes_analyse:
10+
- 'tests/**.php'

spec/Client/ClientSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function it_gets(
5454
StreamInterface $stream
5555
): void {
5656
$requestFactory
57-
->createRequest('GET', self::BASE_URL.'/endpoint.php?kundeid='.self::CUSTOMER_ID.'&kode='.self::PASSWORD.'&param1=value1&param2=value2&format=json')
57+
->createRequest('GET', self::BASE_URL . '/endpoint.php?kundeid=' . self::CUSTOMER_ID . '&kode=' . self::PASSWORD . '&param1=value1&param2=value2&format=json')
5858
->shouldBeCalled();
5959

6060
$response->getStatusCode()->willReturn(200);

src/Client/Client.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Setono\DAO\Client;
66

77
use InvalidArgumentException;
8+
use const PHP_QUERY_RFC3986;
89
use Psr\Http\Client\ClientExceptionInterface;
910
use Psr\Http\Client\ClientInterface as HttpClientInterface;
1011
use Psr\Http\Message\RequestFactoryInterface;
@@ -17,29 +18,19 @@
1718

1819
final class Client implements ClientInterface
1920
{
20-
/**
21-
* @var HttpClientInterface
22-
*/
21+
/** @var HttpClientInterface */
2322
private $httpClient;
2423

25-
/**
26-
* @var RequestFactoryInterface
27-
*/
24+
/** @var RequestFactoryInterface */
2825
private $requestFactory;
2926

30-
/**
31-
* @var string
32-
*/
27+
/** @var string */
3328
private $customerId;
3429

35-
/**
36-
* @var string
37-
*/
30+
/** @var string */
3831
private $password;
3932

40-
/**
41-
* @var string
42-
*/
33+
/** @var string */
4334
private $baseUrl;
4435

4536
public function __construct(
@@ -76,7 +67,7 @@ public function get(string $endpoint, array $params = []): array
7667
// overrides the format because this implementation only supports JSON
7768
$params['format'] = 'json';
7869

79-
$url = $this->baseUrl.'/'.$endpoint.'?'.http_build_query($params, '', '&', PHP_QUERY_RFC3986);
70+
$url = $this->baseUrl . '/' . $endpoint . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
8071

8172
$request = $this->requestFactory->createRequest('GET', $url);
8273

src/Exception/ApiException.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@
99

1010
final class ApiException extends RequestException
1111
{
12-
/**
13-
* @var int|null
14-
*/
12+
/** @var int|null */
1513
private $errorCode;
1614

17-
/**
18-
* @var string|null
19-
*/
15+
/** @var string|null */
2016
private $errorMessage;
2117

2218
public function __construct(RequestInterface $request, ResponseInterface $response, int $statusCode, int $errorCode, string $errorMessage)

src/Exception/RequestException.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,13 @@
1212

1313
abstract class RequestException extends RuntimeException
1414
{
15-
/**
16-
* @var RequestInterface
17-
*/
15+
/** @var RequestInterface */
1816
private $request;
1917

20-
/**
21-
* @var ResponseInterface
22-
*/
18+
/** @var ResponseInterface */
2319
private $response;
2420

25-
/**
26-
* @var int
27-
*/
21+
/** @var int */
2822
private $statusCode;
2923

3024
/**

0 commit comments

Comments
 (0)