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

Promoted property must be validated againts property (not param) grammar #9839

Closed
mvorisek opened this issue Sep 2, 2023 · 3 comments
Closed

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Sep 2, 2023

Feature request

https://3v4l.org/Sq0bk

the fatal error is currently undetected: https://phpstan.org/r/3428ac8f-581f-4bfc-b408-a04c2d9935ca

@mvorisek mvorisek changed the title Promoted property must be validated againts property not param grammar Promoted property must be validated againts property (not param) grammar Sep 2, 2023
@phpstan-bot
Copy link
Contributor

@mvorisek After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:

@@ @@
-PHP 8.0 – 8.3 (1 error)
+PHP 8.0 – 8.3 (2 errors)
 ==========
 
 4: Property Scope::$fieldNotPromoted (string) does not accept default value of type null.
+6: Default value of the parameter #1 $field (null) of method Scope::__construct() is incompatible with type string.
 
-PHP 7.2 – 7.4 (2 errors)
+PHP 7.2 – 7.4 (3 errors)
 ==========
 
 4: Property Scope::$fieldNotPromoted (string) does not accept default value of type null.
+6: Default value of the parameter #1 $field (null) of method Scope::__construct() is incompatible with type string.
 6: Promoted properties are supported only on PHP 8.0 and later.
Full report

PHP 8.0 – 8.3 (2 errors)

Line Error
4 Property Scope::$fieldNotPromoted (string) does not accept default value of type null.
6 Default value of the parameter #1 $field (null) of method Scope::__construct() is incompatible with type string.

PHP 7.2 – 7.4 (3 errors)

Line Error
4 Property Scope::$fieldNotPromoted (string) does not accept default value of type null.
6 Default value of the parameter #1 $field (null) of method Scope::__construct() is incompatible with type string.
6 Promoted properties are supported only on PHP 8.0 and later.

@ondrejmirtes
Copy link
Member

Implemented: phpstan/phpstan-src@b2177e3 + Roave/BetterReflection#1419

Copy link

github-actions bot commented May 4, 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 May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants