Skip to content

Commit

Permalink
Merge pull request #10104 from 6b7562617765726c6f73/fix_MethodCallAna…
Browse files Browse the repository at this point in the history
…lyzer
  • Loading branch information
weirdan committed Aug 12, 2023
2 parents 3098e51 + 35183b9 commit a69eddd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Psalm\IssueBuffer;
use Psalm\Type;
use Psalm\Type\Atomic\TNamedObject;
use Psalm\Type\Atomic\TObject;
use Psalm\Type\Atomic\TTemplateParam;
use Psalm\Type\Union;

Expand Down Expand Up @@ -412,7 +413,7 @@ public static function analyze(
$types = $class_type->getAtomicTypes();

foreach ($types as $key => &$type) {
if (!$type instanceof TNamedObject) {
if (!$type instanceof TNamedObject && !$type instanceof TObject) {
unset($types[$key]);
} else {
$type = $type->setFromDocblock(false);
Expand Down
11 changes: 11 additions & 0 deletions tests/MethodCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,17 @@ public function method(mixed $value): mixed
'ignored_issues' => [],
'php_version' => '8.0',
],
'phpdocObjectTypeAndReferenceInParameter' => [
'code' => '<?php
class Foo {
/**
* @param object $object
*/
public function bar(&$object): void {}
}
$x = new Foo();
$x->bar($x);',
],
];
}

Expand Down

0 comments on commit a69eddd

Please sign in to comment.