phpstan
phpstan copied to clipboard
Signature mismatch for Locale::getPrimaryLanguage
See https://phpstan.org/r/59007ebf-a020-4e0d-884e-0e5854a3b925
I expect it to not show any errors there.
Please follow this: https://github.com/phpstan/phpstan/issues/new?assignees=&labels=&template=Function_signature_mismatch.md
Please send a pull request in phpstan/phpstan-src that updates file resources/functionMap.php instead. Thank you.
@lazka After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:
@@ @@
-PHP 8.0 – 8.2 (1 error)
+PHP 8.0 – 8.2 (2 errors)
==========
3: Expression on left side of ?? is not nullable.
+4: Expression "\locale_get_primary_language(\str_repeat('a', 200)) ?? 'en'" on a separate line does not do anything.
-PHP 7.1 – 7.4 (2 errors)
+PHP 7.1 – 7.4 (3 errors)
==========
3: Expression on left side of ?? is not nullable.
+4: Expression "\locale_get_primary_language(\str_repeat('a', 200)) ?? 'en'" on a separate line does not do anything.
4: Expression on left side of ?? is not nullable.
Full report
PHP 8.0 – 8.2 (2 errors)
| Line | Error |
|---|---|
| 3 | Expression on left side of ?? is not nullable. |
| 4 | Expression "\locale_get_primary_language(\str_repeat('a', 200)) ?? 'en'" on a separate line does not do anything. |
PHP 7.1 – 7.4 (3 errors)
| Line | Error |
|---|---|
| 3 | Expression on left side of ?? is not nullable. |
| 4 | Expression "\locale_get_primary_language(\str_repeat('a', 200)) ?? 'en'" on a separate line does not do anything. |
| 4 | Expression on left side of ?? is not nullable. |
@lazka After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:
@@ @@
-PHP 8.0 – 8.2 (1 error)
-==========
-
-3: Expression on left side of ?? is not nullable.
-
-PHP 7.1 – 7.4 (2 errors)
-==========
-
-3: Expression on left side of ?? is not nullable.
-4: Expression on left side of ?? is not nullable.
+4: Expression "\locale_get_primary_language(\str_repeat('a', 200)) ?? 'en'" on a separate line does not do anything.
Full report
| Line | Error |
|---|---|
| 4 | Expression "\locale_get_primary_language(\str_repeat('a', 200)) ?? 'en'" on a separate line does not do anything. |
Fixed https://github.com/phpstan/phpstan-src/pull/2880
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.