mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
parent
fb5ee1e46d
commit
bd20313a14
@ -762,9 +762,7 @@ class Methods
|
|||||||
|
|
||||||
$self_class = $overridden_class_storage->name;
|
$self_class = $overridden_class_storage->name;
|
||||||
|
|
||||||
if ($candidate_type
|
if ($candidate_type && $source_analyzer && !$candidate_type->isMixed()) {
|
||||||
&& $source_analyzer
|
|
||||||
) {
|
|
||||||
$old_contained_by_new = UnionTypeComparator::isContainedBy(
|
$old_contained_by_new = UnionTypeComparator::isContainedBy(
|
||||||
$source_analyzer->getCodebase(),
|
$source_analyzer->getCodebase(),
|
||||||
$candidate_type,
|
$candidate_type,
|
||||||
|
@ -311,7 +311,12 @@ class Populator
|
|||||||
|
|
||||||
if ($declaring_method_storage->has_docblock_param_types
|
if ($declaring_method_storage->has_docblock_param_types
|
||||||
&& !$method_storage->has_docblock_param_types
|
&& !$method_storage->has_docblock_param_types
|
||||||
&& !isset($storage->documenting_method_ids[$method_name])
|
&& (!isset($storage->documenting_method_ids[$method_name])
|
||||||
|
|| \in_array(
|
||||||
|
$storage->documenting_method_ids[$method_name]->fq_class_name,
|
||||||
|
$declaring_class_storage->parent_interfaces
|
||||||
|
)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
$storage->documenting_method_ids[$method_name] = $declaring_method_id;
|
$storage->documenting_method_ids[$method_name] = $declaring_method_id;
|
||||||
}
|
}
|
||||||
|
@ -4561,6 +4561,38 @@ class ClassTemplateExtendsTest extends TestCase
|
|||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
],
|
],
|
||||||
|
'inheritCorrectParams' => [
|
||||||
|
'<?php
|
||||||
|
interface ToBeIgnored
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param mixed $value
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function of($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ToBeUsed extends ToBeIgnored
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @template U
|
||||||
|
* @param U $value
|
||||||
|
* @return U
|
||||||
|
*/
|
||||||
|
public static function of($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsToBeUsed extends ToBeUsed {}
|
||||||
|
|
||||||
|
class Foo implements ExtendsToBeUsed {
|
||||||
|
/** @psalm-suppress InvalidReturnType */
|
||||||
|
public static function of($value) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bar(Foo $f, string $s) : string {
|
||||||
|
return $f::of($s);
|
||||||
|
}'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user