Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 109219a

Browse files
committed
fix
1 parent 6a22dbc commit 109219a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

‎src/Analyser/MutatingScope.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3715,7 +3715,6 @@ private function enterAnonymousFunctionWithoutReflection(
37153715
&& $expr->var instanceof Variable
37163716
&& is_string($expr->var->name)
37173717
&& $expr->var->name === 'this'
3718-
&& $closure->getAttribute(ImmediatelyInvokedClosureVisitor::ATTRIBUTE_NAME) === true
37193718
&& !$closure->static
37203719
&& $this->hasVariableType('this')->yes()
37213720
&& $this->phpVersion->supportsReadOnlyProperties()

‎tests/PHPStan/Analyser/nsrt/bug-13321.php‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ public function __construct(
2222

2323
public function bar(): void
2424
{
25+
(function () {
26+
assertType(Foo::class.'|null', $this->foo);
27+
assertType(Foo::class.'|null', $this->writableFoo);
28+
29+
echo $this->foo->value;
30+
})();
31+
2532
if ($this->foo === null) {
2633
return;
2734
}
@@ -37,7 +44,7 @@ public function bar(): void
3744
})();
3845

3946
$test = function () {
40-
assertType(Foo::class.'|null', $this->foo);
47+
assertType(Foo::class, $this->foo);
4148
assertType(Foo::class.'|null', $this->writableFoo);
4249

4350
echo $this->foo->value;

‎tests/PHPStan/Analyser/nsrt/bug-13321b.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function bar(): void
3232
assertType('non-empty-string', $this->foo->value);
3333

3434
$test = function () {
35-
assertType(Foo::class.'|null', $this->foo);
35+
assertType(Foo::class, $this->foo);
3636
assertType('string', $this->foo->value);
3737
};
3838

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /