Skip to content

fix static analysis #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
.editorconfig export-ignore
.gitattributes export-ignore
/.github/ export-ignore
.gitignore export-ignore
/.php_cs export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/behat.yml.dist export-ignore
/features/ export-ignore
/phpspec.ci.yml export-ignore
/phpspec.yml.dist export-ignore
/phpunit.xml.dist export-ignore
/spec/ export-ignore
/tests/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
/.github/ export-ignore
.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI

on:
push:
branches:
- master
pull_request:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run --diff-format udiff
args: --dry-run --diff
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/behat.yml
/build/
/composer.lock
/phpspec.yml
/phpunit.xml
/vendor/
.php-cs-fixer.php
.phpunit.result.cache
16 changes: 16 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
;

$config = (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
])
->setFinder($finder)
;

return $config;
14 changes: 0 additions & 14 deletions .php_cs.dist

This file was deleted.

3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ parameters:
level: max
paths:
- src
ignoreErrors:
- message: '#^Method Http\\Adapter\\React\\Client::sendRequest\(\) should return Psr\\Http\\Message\\ResponseInterface but returns mixed.$#'
path: src/Client.php
2 changes: 2 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public function sendRequest(RequestInterface $request): ResponseInterface
{
$promise = $this->sendAsyncRequest($request);

// The promise is declared to return mixed, but the react client promise returns a response.
// We unwrap the exception if there is any, otherwise the promise would return null on error.
return $promise->wait();
}

Expand Down
8 changes: 4 additions & 4 deletions tests/PromiseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public function exceptionThatIsThrownFromReactProvider()
$response = $this->getMockBuilder(ResponseInterface::class)->getMock();

return [
'string' => [$request, 'whatever', UnexpectedValueException::class],
'string' => [$request, 'whatever', UnexpectedValueException::class],
'InvalidArgumentException' => [$request, new InvalidArgumentException('Something went wrong'), TransferException::class],
'RuntimeException' => [$request, new RuntimeException('Something happened inside ReactPHP engine'), NetworkException::class],
'NetworkException' => [$request, new NetworkException('Something happened inside ReactPHP engine', $request), NetworkException::class],
'HttpException' => [$request, new HttpException('Something happened inside ReactPHP engine', $request, $response), HttpException::class],
'RuntimeException' => [$request, new RuntimeException('Something happened inside ReactPHP engine'), NetworkException::class],
'NetworkException' => [$request, new NetworkException('Something happened inside ReactPHP engine', $request), NetworkException::class],
'HttpException' => [$request, new HttpException('Something happened inside ReactPHP engine', $request, $response), HttpException::class],
];
}
}