From 06f81e4717707da035695804528f1887f86e0fba Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 12 Apr 2024 13:27:23 +0200 Subject: [PATCH] Upgrade phpstan --- composer.json | 2 +- phpstan-baseline.neon | 146 ++++++++++++++++++++++++++++++++++++++++++ phpstan.neon.dist | 3 + 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 phpstan-baseline.neon diff --git a/composer.json b/composer.json index b9437d6d5..f94037af0 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", + "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^8.5.14", "predis/predis": "^1.1 || ^2.0", "rollbar/rollbar": "^1.3 || ^2 || ^3", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..aca584a68 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,146 @@ +parameters: + ignoreErrors: + - + message: "#^Property Monolog\\\\ErrorHandler\\:\\:\\$reservedMemory is never read, only written\\.$#" + count: 1 + path: src/Monolog/ErrorHandler.php + + - + message: "#^Parameter \\#2 \\$array of function implode expects array\\, array\\\\> given\\.$#" + count: 1 + path: src/Monolog/Formatter/JsonFormatter.php + + - + message: "#^Method Monolog\\\\Formatter\\\\NormalizerFormatter\\:\\:normalize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Monolog/Formatter/NormalizerFormatter.php + + - + message: "#^Offset 'line' does not exist on array\\{function\\: string, line\\?\\: int, file\\: string, class\\?\\: class\\-string, type\\?\\: '\\-\\>'\\|'\\:\\:', args\\?\\: array, object\\?\\: object\\}\\.$#" + count: 1 + path: src/Monolog/Formatter/NormalizerFormatter.php + + - + message: "#^PHPDoc tag @var for variable \\$value has no value type specified in iterable type array\\.$#" + count: 2 + path: src/Monolog/Formatter/NormalizerFormatter.php + + - + message: "#^Method Monolog\\\\Formatter\\\\WildfireFormatter\\:\\:normalize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Monolog/Formatter/WildfireFormatter.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:call\\(\\) through static\\:\\:\\.$#" + count: 3 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:call_array\\(\\) through static\\:\\:\\.$#" + count: 3 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:dump\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:generateScript\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:getConsoleMethodForLevel\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:handleCustomStyles\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:handleStyles\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Unsafe call to private method Monolog\\\\Handler\\\\BrowserConsoleHandler\\:\\:quote\\(\\) through static\\:\\:\\.$#" + count: 9 + path: src/Monolog/Handler/BrowserConsoleHandler.php + + - + message: "#^Method Monolog\\\\Handler\\\\ElasticsearchHandler\\:\\:bulkSend\\(\\) has parameter \\$records with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Monolog/Handler/ElasticsearchHandler.php + + - + message: "#^Method Monolog\\\\Handler\\\\LogglyHandler\\:\\:loadCurlHandle\\(\\) never returns resource so it can be removed from the return type\\.$#" + count: 1 + path: src/Monolog/Handler/LogglyHandler.php + + - + message: "#^Property Monolog\\\\Handler\\\\MongoDBHandler\\:\\:\\$namespace \\(string\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/Monolog/Handler/MongoDBHandler.php + + - + message: "#^Offset 'dirname' does not exist on array\\{dirname\\?\\: string, basename\\: string, extension\\?\\: string, filename\\: string\\}\\.$#" + count: 2 + path: src/Monolog/Handler/RotatingFileHandler.php + + - + message: "#^Invalid array key type Fiber\\.$#" + count: 1 + path: src/Monolog/Logger.php + + - + message: "#^Method Monolog\\\\Logger\\:\\:__construct\\(\\) has parameter \\$processors with no value type specified in iterable type array\\.$#" + count: 2 + path: src/Monolog/Logger.php + + - + message: "#^Offset Fiber does not exist on WeakMap\\\\|null\\.$#" + count: 1 + path: src/Monolog/Logger.php + + - + message: "#^PHPDoc tag @var for variable \\$fiberLogDepth contains generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 2 + path: src/Monolog/Logger.php + + - + message: "#^Property Monolog\\\\Logger\\:\\:\\$fiberLogDepth \\(WeakMap\\\\|null\\) does not accept non\\-empty\\-array\\\\|WeakMap\\\\.$#" + count: 3 + path: src/Monolog/Logger.php + + - + message: "#^Property Monolog\\\\Logger\\:\\:\\$fiberLogDepth with generic class Fiber does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/Monolog/Logger.php + + - + message: "#^Method Monolog\\\\Processor\\\\IntrospectionProcessor\\:\\:isTraceClassOrSkippedFunction\\(\\) has parameter \\$trace with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Monolog/Processor/IntrospectionProcessor.php + + - + message: "#^Parameter \\#1 \\$length of function random_bytes expects int\\<1, max\\>, int given\\.$#" + count: 1 + path: src/Monolog/Processor/UidProcessor.php + + - + message: "#^Cannot access offset int on 0\\|0\\.0\\|array\\\\|string\\|false\\|null\\.$#" + count: 1 + path: src/Monolog/SignalHandler.php + + - + message: "#^Dead catch \\- Throwable is never thrown in the try block\\.$#" + count: 1 + path: src/Monolog/Utils.php + + - + message: "#^Parameter \\#2 \\$callback of function preg_replace_callback expects callable\\(array\\\\)\\: string, Closure\\(mixed\\)\\: \\(array\\\\|string\\|false\\) given\\.$#" + count: 1 + path: src/Monolog/Utils.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6011baa89..b742a81b9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,3 +1,6 @@ +includes: + - 'phpstan-baseline.neon' + parameters: level: 8