mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix build
This commit is contained in:
parent
e8c755c7c0
commit
fa6cb8b84b
@ -731,10 +731,10 @@ class Methods
|
||||
$candidate_type = $storage->return_type;
|
||||
|
||||
if ($candidate_type && $candidate_type->isVoid()) {
|
||||
return $candidate_type;
|
||||
return clone $candidate_type;
|
||||
}
|
||||
|
||||
if (isset($class_storage->documenting_method_ids[$appearing_method_name]) && $source_analyzer) {
|
||||
if (isset($class_storage->documenting_method_ids[$appearing_method_name])) {
|
||||
$overridden_method_id = $class_storage->documenting_method_ids[$appearing_method_name];
|
||||
|
||||
// special override to allow inference of Iterator types
|
||||
@ -752,7 +752,7 @@ class Methods
|
||||
return Type::getVoid();
|
||||
}
|
||||
|
||||
if (!$candidate_type) {
|
||||
if (!$candidate_type || !$source_analyzer) {
|
||||
$self_class = $overridden_method_id->fq_class_name;
|
||||
|
||||
return clone $overridden_storage->return_type;
|
||||
|
@ -327,9 +327,7 @@ class Populator
|
||||
if (\in_array(
|
||||
$storage->documenting_method_ids[$method_name]->fq_class_name,
|
||||
$declaring_class_storage->parent_interfaces
|
||||
) || $storage->documenting_method_ids[$method_name]->fq_class_name
|
||||
=== $declaring_class_storage->name
|
||||
) {
|
||||
)) {
|
||||
$storage->documenting_method_ids[$method_name] = $declaring_method_id;
|
||||
$method_storage->inherited_return_type = true;
|
||||
} else {
|
||||
@ -339,7 +337,8 @@ class Populator
|
||||
if (!\in_array(
|
||||
$declaring_class,
|
||||
$documenting_class_storage->parent_interfaces
|
||||
)) {
|
||||
) && $documenting_class_storage->is_interface
|
||||
) {
|
||||
unset($storage->documenting_method_ids[$method_name]);
|
||||
$method_storage->inherited_return_type = null;
|
||||
}
|
||||
@ -835,19 +834,6 @@ class Populator
|
||||
) {
|
||||
$method_storage->throws += $interface_method_storage->throws;
|
||||
}
|
||||
|
||||
if ($interface_method_storage->return_type
|
||||
&& $interface_method_storage->signature_return_type
|
||||
&& $interface_method_storage->return_type
|
||||
!== $interface_method_storage->signature_return_type
|
||||
&& UnionTypeComparator::isSimplyContainedBy(
|
||||
$interface_method_storage->signature_return_type,
|
||||
$method_storage->signature_return_type
|
||||
)
|
||||
) {
|
||||
//$method_storage->return_type = $interface_method_storage->return_type;
|
||||
//$method_storage->inherited_return_type = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -296,50 +296,6 @@ class UnionTypeComparator
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for comparing docblock types to signature types before we know about all types
|
||||
*
|
||||
*/
|
||||
public static function isSimplyContainedBy(
|
||||
Type\Union $input_type,
|
||||
Type\Union $container_type
|
||||
) : bool {
|
||||
if ($input_type->getId() === $container_type->getId()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($input_type->isNullable() && !$container_type->isNullable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$input_type_not_null = clone $input_type;
|
||||
$input_type_not_null->removeType('null');
|
||||
|
||||
$container_type_not_null = clone $container_type;
|
||||
$container_type_not_null->removeType('null');
|
||||
|
||||
foreach ($input_type->getAtomicTypes() as $input_key => $input_type_part) {
|
||||
foreach ($container_type->getAtomicTypes() as $container_key => $container_type_part) {
|
||||
if (get_class($container_type_part) === TNamedObject::class
|
||||
&& $input_type_part instanceof TNamedObject
|
||||
&& $input_type_part->value === $container_type_part->value
|
||||
) {
|
||||
continue 2;
|
||||
}
|
||||
|
||||
if ($input_key === $container_key) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the input param type match the given param type
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@ class FromDocblockSetter extends NodeVisitor
|
||||
* @psalm-suppress MoreSpecificImplementedParamType
|
||||
*
|
||||
* @param \Psalm\Type\Atomic|\Psalm\Type\Union $type
|
||||
* @return self::STOP_TRAVERSAL|self::DONT_TRAVERSE_CHILDREN|null
|
||||
*/
|
||||
protected function enterNode(TypeNode $type) : ?int
|
||||
{
|
||||
|
@ -93,6 +93,7 @@ class TypeChecker extends NodeVisitor
|
||||
* @psalm-suppress MoreSpecificImplementedParamType
|
||||
*
|
||||
* @param \Psalm\Type\Atomic|\Psalm\Type\Union $type
|
||||
* @return self::STOP_TRAVERSAL|self::DONT_TRAVERSE_CHILDREN|null
|
||||
*/
|
||||
protected function enterNode(TypeNode $type) : ?int
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user