diff --git a/composer.json b/composer.json index 3aacdd31..1a8dd68b 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -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" } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..8cf8a641 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +includes: + - ./vendor/phpstan/phpstan-deprecation-rules/rules.neon + - ./vendor/phpstan/phpstan-strict-rules/rules.neon +parameters: + inferPrivatePropertyTypeFromConstructor: true diff --git a/src/Application/Handlers/ShutdownHandler.php b/src/Application/Handlers/ShutdownHandler.php index 323f16af..143d51e2 100644 --- a/src/Application/Handlers/ShutdownHandler.php +++ b/src/Application/Handlers/ShutdownHandler.php @@ -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, @@ -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']; diff --git a/src/Domain/User/UserNotFoundException.php b/src/Domain/User/UserNotFoundException.php index 2080774a..6c350ed3 100644 --- a/src/Domain/User/UserNotFoundException.php +++ b/src/Domain/User/UserNotFoundException.php @@ -7,5 +7,8 @@ class UserNotFoundException extends DomainRecordNotFoundException { + /** + * @var string + */ public $message = 'The user you requested does not exist.'; }