Skip to content

Commit 509e513

Browse files
committed
add php-cs-fixer step to build
1 parent 262bc0a commit 509e513

16 files changed

+65
-32
lines changed

.github/workflows/static.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,16 @@ jobs:
2121
REQUIRE_DEV: false
2222
with:
2323
args: analyze --no-progress
24+
25+
php-cs-fixer:
26+
name: PHP-CS-Fixer
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
33+
- name: PHP-CS-Fixer
34+
uses: docker://oskarstark/php-cs-fixer-ga
35+
with:
36+
args: --dry-run --diff

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/.php_cs
2-
/.php_cs.cache
1+
/.php-cs-fixer.php
2+
/.php-cs-fixer.cache
33
/behat.yml
44
/build/
55
/composer.lock

.php-cs-fixer.dist.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests')
6+
->name('*.php')
7+
;
8+
9+
$config = new PhpCsFixer\Config();
10+
11+
return $config
12+
->setRiskyAllowed(true)
13+
->setRules([
14+
'@Symfony' => true,
15+
'single_line_throw' => false,
16+
])
17+
->setFinder($finder)
18+
;

src/Deferred.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ public function wait($unwrap = true)
146146
return $this->value;
147147
}
148148

149-
/** @var ClientExceptionInterface */
149+
if (null === $this->failure) {
150+
throw new \RuntimeException('Internal Error: Promise is not fulfilled but has no exception stored');
151+
}
152+
150153
throw $this->failure;
151154
}
152155
}

src/HttpClientPool/HttpClientPool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public function addHttpClient($client): void
4646
/**
4747
* Return an http client given a specific strategy.
4848
*
49-
* @throws HttpClientNotFoundException When no http client has been found into the pool
50-
*
5149
* @return HttpClientPoolItem Return a http client that can do both sync or async
50+
*
51+
* @throws HttpClientNotFoundException When no http client has been found into the pool
5252
*/
5353
abstract protected function chooseHttpClient(): HttpClientPoolItem;
5454

src/Plugin/AddHostPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class AddHostPlugin implements Plugin
3131
* @param array{'replace'?: bool} $config
3232
*
3333
* Configuration options:
34-
* - replace: True will replace all hosts, false will only add host when none is specified.
34+
* - replace: True will replace all hosts, false will only add host when none is specified
3535
*/
3636
public function __construct(UriInterface $host, array $config = [])
3737
{

src/Plugin/AddPathPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
7070
if (substr($path, 0, strlen($prepend)) !== $prepend) {
7171
$request = $request->withUri($request->getUri()
7272
->withPath($prepend.$path)
73-
);
73+
);
7474
}
7575

7676
return $next($request);

src/Plugin/ContentTypePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class ContentTypePlugin implements Plugin
3939
*
4040
* Configuration options:
4141
* - skip_detection: true skip detection if stream size is bigger than $size_limit
42-
* - size_limit: size stream limit for which the detection as to be skipped.
42+
* - size_limit: size stream limit for which the detection as to be skipped
4343
*/
4444
public function __construct(array $config = [])
4545
{

src/Plugin/DecoderPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class DecoderPlugin implements Plugin
3434
* @param array{'use_content_encoding'?: bool} $config
3535
*
3636
* Configuration options:
37-
* - use_content_encoding: Whether this plugin should look at the Content-Encoding header first or only at the Transfer-Encoding (defaults to true).
37+
* - use_content_encoding: Whether this plugin should look at the Content-Encoding header first or only at the Transfer-Encoding (defaults to true)
3838
*/
3939
public function __construct(array $config = [])
4040
{

src/Plugin/ErrorPlugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ final class ErrorPlugin implements Plugin
4040
* @param array{'only_server_exception'?: bool} $config
4141
*
4242
* Configuration options:
43-
* - only_server_exception: Whether this plugin should only throw 5XX Exceptions (default to false).
43+
* - only_server_exception: Whether this plugin should only throw 5XX Exceptions (default to false)
4444
*/
4545
public function __construct(array $config = [])
4646
{
@@ -72,10 +72,10 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
7272
* @param RequestInterface $request Request of the call
7373
* @param ResponseInterface $response Response of the call
7474
*
75+
* @return ResponseInterface If status code is not in 4xx or 5xx return response
76+
*
7577
* @throws ClientErrorException If response status code is a 4xx
7678
* @throws ServerErrorException If response status code is a 5xx
77-
*
78-
* @return ResponseInterface If status code is not in 4xx or 5xx return response
7979
*/
8080
private function transformResponseToException(RequestInterface $request, ResponseInterface $response): ResponseInterface
8181
{

0 commit comments

Comments
 (0)