Skip to content
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

Fixes PHPStan errors until level 4 #163

Merged
merged 10 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ matrix:
- php: nightly

before_script:
- composer require php-coveralls/php-coveralls:^2.1.0
- composer require php-coveralls/php-coveralls:^2.2.0
- composer install -n

script:
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpstan analyse src ; fi

after_success:
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/php-coveralls --coverage_clover=clover.xml -v ; fi
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"slim/slim": "^4.5"
},
"require-dev": {
"phpstan/phpstan": "^0.12.23",
"phpunit/phpunit": "^8.5"
},
"config": {
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 4
includes:
- vendor/jangregor/phpstan-prophecy/src/extension.neon
l0gicgate marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/Application/Handlers/HttpErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function respond(): Response

if (
!($exception instanceof HttpException)
&& ($exception instanceof Exception || $exception instanceof Throwable)
&& $exception instanceof Throwable
&& $this->displayErrorDetails
) {
$error->setDescription($exception->getMessage());
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Handlers/ShutdownHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ShutdownHandler
* ShutdownHandler constructor.
*
* @param Request $request
* @param $errorHandler $errorHandler
* @param HttpErrorHandler $errorHandler
* @param bool $displayErrorDetails
flangofas marked this conversation as resolved.
Show resolved Hide resolved
*/
public function __construct(
Expand Down
20 changes: 10 additions & 10 deletions tests/Domain/User/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public function userProvider()

/**
* @dataProvider userProvider
* @param $id
* @param $username
* @param $firstName
* @param $lastName
* @param int $id
* @param string $username
* @param string $firstName
* @param string $lastName
flangofas marked this conversation as resolved.
Show resolved Hide resolved
*/
public function testGetters($id, $username, $firstName, $lastName)
public function testGetters(int $id, string $username, string $firstName, string $lastName)
{
$user = new User($id, $username, $firstName, $lastName);

Expand All @@ -38,12 +38,12 @@ public function testGetters($id, $username, $firstName, $lastName)

/**
* @dataProvider userProvider
* @param $id
* @param $username
* @param $firstName
* @param $lastName
* @param int $id
* @param string $username
* @param string $firstName
* @param string $lastName
flangofas marked this conversation as resolved.
Show resolved Hide resolved
*/
public function testJsonSerialize($id, $username, $firstName, $lastName)
public function testJsonSerialize(int $id, string $username, string $firstName, string $lastName)
{
$user = new User($id, $username, $firstName, $lastName);

Expand Down