We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e6e901 commit 7aeda4aCopy full SHA for 7aeda4a
tests/PHPStan/Analyser/nsrt/remember-readonly-constructor-narrowed.php
@@ -143,3 +143,28 @@ public function doFoo() {
143
assertType('int', $this->prop->writable);
144
}
145
146
+
147
+class HelloWorldReadonlyPropertyInClosureScope {
148
+ private readonly int $i;
149
150
+ public function __construct()
151
+ {
152
+ if (rand(0,1)) {
153
+ $this->i = 4;
154
+ } else {
155
+ $this->i = 10;
156
+ }
157
158
159
+ public function doFoo() {
160
+ assertType('4|10', $this->i);
161
162
+ (function() {
163
164
+ })();
165
166
+ $func = function() {
167
168
+ };
169
170
+}
0 commit comments