1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Check callable types too

This commit is contained in:
Matthew Brown 2019-02-11 01:41:28 -05:00
parent 867ea1fa34
commit e5360a6faa

View File

@ -400,6 +400,34 @@ abstract class Atomic
} }
} }
if ($this instanceof Type\Atomic\Fn
|| $this instanceof Type\Atomic\TCallable
) {
if ($this->params) {
foreach ($this->params as $param) {
if ($param->type) {
$param->type->check(
$source,
$code_location,
$suppressed_issues,
$phantom_classes,
$inferred
);
}
}
}
if ($this->return_type) {
$this->return_type->check(
$source,
$code_location,
$suppressed_issues,
$phantom_classes,
$inferred
);
}
}
if ($this instanceof Type\Atomic\TArray if ($this instanceof Type\Atomic\TArray
|| $this instanceof Type\Atomic\TGenericObject || $this instanceof Type\Atomic\TGenericObject
|| $this instanceof Type\Atomic\TIterable || $this instanceof Type\Atomic\TIterable
@ -556,7 +584,10 @@ abstract class Atomic
} }
} }
if ($this instanceof Type\Atomic\TArray || $this instanceof Type\Atomic\TGenericObject) { if ($this instanceof Type\Atomic\TArray
|| $this instanceof Type\Atomic\TGenericObject
|| $this instanceof Type\Atomic\TIterable
) {
foreach ($this->type_params as $type_param) { foreach ($this->type_params as $type_param) {
$type_param->queueClassLikesForScanning( $type_param->queueClassLikesForScanning(
$codebase, $codebase,
@ -565,6 +596,30 @@ abstract class Atomic
); );
} }
} }
if ($this instanceof Type\Atomic\Fn
|| $this instanceof Type\Atomic\TCallable
) {
if ($this->params) {
foreach ($this->params as $param) {
if ($param->type) {
$param->type->queueClassLikesForScanning(
$codebase,
$file_storage,
$phantom_classes
);
}
}
}
if ($this->return_type) {
$this->return_type->queueClassLikesForScanning(
$codebase,
$file_storage,
$phantom_classes
);
}
}
} }
/** /**