Issue Bug Closed

#100850phpstan max nightly fails with phpstan 1.10.15

Anja Leichsenring 05/10/23, 05:12 updated 07/09/24, 12:56

Description

The error turned up is:
——— ————————————————————————————————-
228 Line core/Classes/Authentication/AuthenticationService.php
229 ——— ————————————————————————————————-
230 227 Parameter #2 $values of function vsprintf expects
231 array<bool>, array<int><br>232 mixed&gt;&gt; given. <br>233 ——— ————————————————————————————————-</int></bool>

The function in question is
/* * param string $message Message to output * param array<int> $params<br> */<br> protected function writeLogMessage(string $message, …$params): void</int>

there are 3 usages, all of them pass $this->writeLogMessage(string, string), what makes the second parameter into array<int string></int>

When I change the docblock accordingly, I end up with
——— —————————————————————————————————————————————————————————————————-
Line core/Classes/Authentication/AuthenticationService.php
——— —————————————————————————————————————————————————————————————————-
227 Parameter #2 $values of function vsprintf expects array<bool>, array<int string>&gt; given. <br> ——— —————————————————————————————————————————————————————————————————-</int></bool>

which is not correct, no nested arrays anywhere around.

I decided to include the error into the baseline file to suppress the test failure. Any feedback here is very much welcome, in case my analysis is incorrect I’d like to improve.

Reviews 3