Skip to content

Commit

Permalink
attempt to fix #6973
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomulik committed Nov 23, 2021
1 parent b42c281 commit 505c6e7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/Psalm/Internal/Analyzer/MethodComparator.php
Expand Up @@ -980,9 +980,7 @@ private static function compareMethodDocblockReturnTypes(
$implementer_called_class_name
);

if (isset(
$implementer_called_class_storage->template_extended_params[$implementer_classlike_storage->name]
)) {
if ($implementer_called_class_storage->template_extended_params) {
self::transformTemplates(
$implementer_called_class_storage->template_extended_params,
$implementer_classlike_storage->name,
Expand Down
30 changes: 29 additions & 1 deletion tests/ReturnTypeTest.php
Expand Up @@ -1032,7 +1032,35 @@ public function __construct() {
$this->value = 123;
}
}'
]
],
'returnTypeOfAbstractMethodFromTemplatedTraitAndImplementationFromNonTemplatedTrait' => [
'<?php
trait ImplementorTrait {
/** @var int */
private $value;
public function getValue(): int {
return $this->value;
}
}
/** @psalm-template T */
trait GuideTrait {
/** @psalm-return T */
abstract public function getValue();
}
class Test {
use ImplementorTrait;
/** @template-use GuideTrait<int> */
use GuideTrait;
public function __construct() {
$this->value = 123;
}
}'
],
];
}

Expand Down

0 comments on commit 505c6e7

Please sign in to comment.