Merge pull request #706 from flightphp/phpstan-rework

Update PHPStan configuration and enable type treatment
master
n0nag0n 17 hours ago committed by GitHub
commit 03ed9fe706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -45,15 +45,15 @@
}
},
"require-dev": {
"ext-mbstring": "*",
"ext-fileinfo": "*",
"ext-mbstring": "*",
"ext-pdo_sqlite": "*",
"flightphp/container": "^1.3",
"flightphp/runway": "^1.2",
"league/container": "^4.2",
"level-2/dice": "^4.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan": "^2.2",
"phpunit/phpunit": "^9.6",
"rregeer/phpunit-coverage-check": "^0.3.1",
"spatie/phpunit-watcher": "^1.23",

@ -99,7 +99,7 @@ class RouteCommand extends AbstractBaseCommand
$arrayOfRoutes[] = [
'Pattern' => $route->pattern,
'Methods' => implode(', ', $route->methods),
'Alias' => $route->alias ?? '',
'Alias' => $route->alias,
'Streamed' => $route->is_streamed ? 'Yes' : 'No',
'Middleware' => !empty($middlewares) ? implode(",", $middlewares) : '-'
];

@ -348,10 +348,8 @@ class Request
*
* @param string $header Header name. Can be caps, lowercase, or mixed.
* @param string $default Default value if the header does not exist
*
* @return string
*/
public static function getHeader(string $header, $default = ''): string
public static function getHeader(string $header, string $default = ''): string
{
$header = 'HTTP_' . strtoupper(str_replace('-', '_', $header));
return self::getVar($header, $default);
@ -380,10 +378,8 @@ class Request
*
* @param string $header Header name. Can be caps, lowercase, or mixed.
* @param string $default Default value if the header does not exist
*
* @return string
*/
public static function header(string $header, $default = ''): string
public static function header(string $header, string $default = ''): string
{
return self::getHeader($header, $default);
}

@ -0,0 +1,7 @@
parameters:
ignoreErrors:
-
rawMessage: 'Method flight\core\Dispatcher::parseStringClassAndMethod() should return array{class-string|object, string} but returns non-empty-list<string>.'
identifier: return.type
count: 1
path: flight/core/Dispatcher.php

@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fadrian06/phpstan/add-schema/schema.json
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- phpstan-baseline.neon
@ -6,5 +8,4 @@ parameters:
level: 6
paths:
- flight
- index.php
treatPhpDocTypesAsCertain: false

Loading…
Cancel
Save