phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

Signature mismatch for Locale::getPrimaryLanguage

Open lazka opened this issue 3 years ago • 2 comments
trafficstars

See https://phpstan.org/r/59007ebf-a020-4e0d-884e-0e5854a3b925

I expect it to not show any errors there.

lazka avatar Aug 25 '22 10:08 lazka

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.

ondrejmirtes avatar Aug 25 '22 13:08 ondrejmirtes

@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.

phpstan-bot avatar Apr 03 '24 12:04 phpstan-bot

@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.

phpstan-bot avatar May 30 '24 13:05 phpstan-bot

Fixed https://github.com/phpstan/phpstan-src/pull/2880

ondrejmirtes avatar May 30 '24 14:05 ondrejmirtes

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.

github-actions[bot] avatar Jul 01 '24 01:07 github-actions[bot]