Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature mismatch for Locale::getPrimaryLanguage #7855

Closed
lazka opened this issue Aug 25, 2022 · 5 comments
Closed

Signature mismatch for Locale::getPrimaryLanguage #7855

lazka opened this issue Aug 25, 2022 · 5 comments
Labels
Milestone

Comments

@lazka
Copy link

lazka commented Aug 25, 2022

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

I expect it to not show any errors there.

@ondrejmirtes
Copy link
Member

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 ondrejmirtes added this to the Easy fixes milestone Aug 25, 2022
@phpstan-bot
Copy link
Contributor

@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
Copy link
Contributor

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

@ondrejmirtes
Copy link
Member

Fixed phpstan/phpstan-src#2880

Copy link

github-actions bot commented Jul 1, 2024

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 github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants