Skip to content
Permalink
Browse files

Don’t convert trait self to trait name

  • Loading branch information...
muglug committed Jun 26, 2019
1 parent c66a106 commit 372a512a86ddb8336a415a1643704183bdbc135c
Showing with 15 additions and 2 deletions.
  1. +2 −2 src/Psalm/Internal/Visitor/ReflectorVisitor.php
  2. +13 −0 tests/TraitTest.php
@@ -2157,7 +2157,7 @@ private function registerFunctionLike(PhpParser\Node\FunctionLike $stmt, $fake_m
$docblock_info->params,
$stmt,
$fake_method,
$class_storage ? $class_storage->name : null
$class_storage && !$class_storage->is_trait ? $class_storage->name : null
);
}
@@ -2279,7 +2279,7 @@ function (FunctionLikeParameter $p) {
$this->aliases,
$this->function_template_types + $this->class_template_types,
$this->type_aliases,
$class_storage ? $class_storage->name : null
$class_storage && !$class_storage->is_trait ? $class_storage->name : null
);
$storage->return_type = Type::parseTokens(
@@ -854,6 +854,19 @@ class Foo {
$f1 = new Foo();
$f2 = (new Foo())->bar($f1);',
],
'traitSelfDocblockReturn' => [
'<?php
trait T {
/** @return self */
public function getSelf() {
return $this;
}
}
class C {
use T;
}'
],
];
}

0 comments on commit 372a512

Please sign in to comment.
You can’t perform that action at this time.