Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -2746,6 +2746,7 @@ public function getKeepVoidType(Expr $node): Type
(
!$node instanceof FuncCall
&& !$node instanceof MethodCall
&& !$node instanceof Expr\NullsafeMethodCall
&& !$node instanceof Expr\StaticCall
) || $node->isFirstClassCallable()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,11 @@ public function testBug6720(): void
$this->analyse([__DIR__ . '/data/bug-6720.php'], []);
}

public function testBug6720b(): void
{
$this->analyse([__DIR__ . '/data/bug-6720b.php'], []);
}

public function testBug8659(): void
{
$this->analyse([__DIR__ . '/data/bug-8659.php'], []);
Expand Down
15 changes: 15 additions & 0 deletions tests/PHPStan/Rules/Functions/data/bug-6720b.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);

namespace Bug6720b;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not fixing a bug, this test just covers the nullsafe case, which wasn't tested before


class X {
/** @return string|void */
function a() {}

}

function b(?string $a): void {}

function doFoo(?X $x):void {
b($x?->a());
}
Loading