vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

Readonly class not marking props readonly, fatal error not detected #11029

Open dkarlovi opened 4 months ago

dkarlovi commented 4 months ago

https://psalm.dev/r/e675241c02

This causes a fatal error with PHP 8.3

https://3v4l.org/bb3Qn#v8.3.8

With @psalm-immutable it works. This also works correctly https://psalm.dev/r/219055d746

psalm-github-bot[bot] commented 4 months ago

I found these snippets:

https://psalm.dev/r/e675241c02 ```php s = $s; } } $s = new Service('a'); $s->set('b'); ``` ``` Psalm output (using commit 16b24bd): No issues! ```
https://psalm.dev/r/219055d746 ```php s = $s; } } $s = new Service('a'); $s->set('b'); ``` ``` Psalm output (using commit 16b24bd): ERROR: InaccessibleProperty - 10:9 - Service::$s is marked readonly ```