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

Inconsistent behaviour #8958

Closed
JoyceBabu opened this issue Feb 25, 2023 · 2 comments
Closed

Inconsistent behaviour #8958

JoyceBabu opened this issue Feb 25, 2023 · 2 comments
Labels

Comments

@JoyceBabu
Copy link

JoyceBabu commented Feb 25, 2023

Bug report

I am getting an Access to an uninitialized readonly property error with the following code. @phpstan-ignore-line is also not working. But, the error goes away when I change the constructor argument from an interface (TimeRangeInterface) to a concrete object (Foo).

Code snippet that reproduces the problem

https://phpstan.org/r/ca78225c-837f-474d-9377-c58d7fc9d764

No error with concrete class

https://phpstan.org/r/89b52a30-4588-45e8-b43d-90e0fd322cff

Expected output

The code should pass validation without errors.

@phpstan-bot
Copy link
Contributor

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

@@ @@
-PHP 8.1 – 8.2 (2 errors)
+PHP 8.1 – 8.2
 ==========
 
-20: Access to an uninitialized readonly property Bar::$start.
-25: Access to an uninitialized readonly property Bar::$end.
+No errors
 
 PHP 7.2 – 8.0 (1 error)
 ==========
 
 14: Syntax error, unexpected T_NAME_FULLY_QUALIFIED, expecting T_VARIABLE on line 14
Full report

PHP 8.1 – 8.2

No errors

PHP 7.2 – 8.0 (1 error)

Line Error
14 Syntax error, unexpected T_NAME_FULLY_QUALIFIED, expecting T_VARIABLE on line 14

@github-actions
Copy link

github-actions bot commented Jul 9, 2023

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 9, 2023
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