Skip to content

Commit

Permalink
Add PHPStan
Browse files Browse the repository at this point in the history
Add PHPStan
  • Loading branch information
holtkamp committed Dec 3, 2019
1 parent 4b2243c commit 7468956
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
}
],
"require": {
"php": ">=7.1",
"ext-json": "*",
"monolog/monolog": "^1.24",
"php": ">=7.1",
"php-di/php-di": "^6.0",

"slim/psr7": "^0.5",
"slim/slim": "^4.1"
},
"require-dev": {
"phpstan/phpstan": "@stable",
"phpstan/phpstan-deprecation-rules": "@stable",
"phpstan/phpstan-strict-rules": "@stable",
"phpunit/phpunit": "^7.5"
},
"config": {
Expand All @@ -47,6 +51,7 @@
}
},
"scripts": {
"phpstan": "./vendor/bin/phpstan analyse --level 3 --configuration phpstan.neon app src",
"start": "php -S localhost:8080 -t public",
"test": "phpunit"
}
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
includes:
- ./vendor/phpstan/phpstan-deprecation-rules/rules.neon
- ./vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
inferPrivatePropertyTypeFromConstructor: true
11 changes: 2 additions & 9 deletions src/Application/Handlers/ShutdownHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ class ShutdownHandler
*/
private $displayErrorDetails;

/**
* ShutdownHandler constructor.
*
* @param Request $request
* @param $errorHandler $errorHandler
* @param bool $displayErrorDetails
*/
public function __construct(
Request $request,
HttpErrorHandler $errorHandler,
Expand All @@ -41,10 +34,10 @@ public function __construct(
$this->displayErrorDetails = $displayErrorDetails;
}

public function __invoke()
public function __invoke() : void
{
$error = error_get_last();
if ($error) {
if (is_array($error)) {
$errorFile = $error['file'];
$errorLine = $error['line'];
$errorMessage = $error['message'];
Expand Down
3 changes: 3 additions & 0 deletions src/Domain/User/UserNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@

class UserNotFoundException extends DomainRecordNotFoundException
{
/**
* @var string
*/
public $message = 'The user you requested does not exist.';
}

0 comments on commit 7468956

Please sign in to comment.