-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Bug report
with #13292 fixed, from phpstan 2.1.20 Hints and error type seems to be taken into account in wrapping algorithm, giving sometime weird appearances like
🪪 property.unu
sedType
Depending on the terminal size, sometime error message is wrapped as intended and hints and error type are untouched, sometime theses two last are also wrapped with no obvious reasons. I could be just cosmetic issue but sometime I search in phpstan output with error type, ie: "property.unusedType".
With a terminal size of 300, no problems for error message hints and error type (the error message is even below 155 characters count)
$ COLUMNS=300 phpstan analyze bla.php
Note: Using configuration file /home/shad/Work/diag-front/phpstan.neon.
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -------------------------------------------------------------------------------------------------------------------------------------------------
Line bla.php
------ -------------------------------------------------------------------------------------------------------------------------------------------------
6 Property bla::$error_params (non-empty-list<string>|null) is never assigned non-empty-list<string> so it can be removed from the property type.
🪪 property.unusedType
10 Property bla::$error_params (non-empty-list<string>|null) does not accept array<int<1, max>, string>|null.
🪪 assign.propertyType
💡 Type #1 from the union: array<int<1, max>, string> is not a list.
💡 Type #1 from the union: array<int<1, max>, string> might be empty.
------ ------------------------------------------------------------------------------------------------------------------------------------------------- With a terminal size of 170, hints and error type are wrapped while their content size are far bellow 170 characters
$ COLUMNS=170 phpstan analyze bla.php
Note: Using configuration file /home/shad/Work/diag-front/phpstan.neon.
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -------------------------------------------------------------------------------------------------------------------------------------------------
Line bla.php
------ -------------------------------------------------------------------------------------------------------------------------------------------------
6 Property bla::$error_params (non-empty-list<string>|null) is never assigned non-empty-list<string> so it can be removed from the property type.
🪪 property.unu
sedType
10 Property bla::$error_params (non-empty-list<string>|null) does not accept array<int<1, max>, string>|null.
🪪 assign.propertyType
💡 Type #1 from the union: ar
ray<int<1, max>, string> is not a list.
💡 Type #1 from the union: array<int<1, max>, string> might be empty.
------ -------------------------------------------------------------------------------------------------------------------------------------------------
Code snippet that reproduces the problem
https://phpstan.org/r/c0396ddb-ae37-4141-9d88-c74203856a60
Expected output
error type and hint are not wrapped if not needed
Did PHPStan help you today? Did it make you happy in any way?
No response