Skip to content
Permalink
Browse files

Fix #2091 - $this properties should be replaced in trait types

  • Loading branch information...
muglug committed Sep 1, 2019
1 parent 6ad5d31 commit 914ef5a5ddb8fc13eb87b59d2f3884d30c69d803
Showing with 22 additions and 2 deletions.
  1. +6 −2 src/Psalm/Internal/Analyzer/MethodAnalyzer.php
  2. +16 −0 tests/TraitTest.php
@@ -628,8 +628,12 @@ public static function compareMethods(
$guide_method_storage_return_type = ExpressionAnalyzer::fleshOutType(
$codebase,
$guide_method_storage->return_type,
$guide_classlike_storage->name,
$guide_classlike_storage->name,
$guide_classlike_storage->is_trait
? $implementer_classlike_storage->name
: $guide_classlike_storage->name,
$guide_classlike_storage->is_trait
? $implementer_called_class_name
: $guide_classlike_storage->name,
$guide_classlike_storage->parent_class
);
@@ -869,6 +869,22 @@ class C {
use T;
}',
],
'abstractThisMethod' => [
'<?php
trait ATrait {
/** @return $this */
abstract public function bar();
}
class C {
use ATrait;
/** @return $this */
public function bar() {
return $this;
}
}'
],
];
}

0 comments on commit 914ef5a

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