mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Support PHP7 return types
This commit is contained in:
parent
6b4039aae3
commit
98b4029ebd
@ -175,6 +175,10 @@ class FunctionChecker extends FunctionLikeChecker
|
||||
|
||||
$this->suppressed_issues = $docblock_info['suppress'];
|
||||
|
||||
if (isset($function->returnType)) {
|
||||
$return_type = Type::parseString($function->returnType);
|
||||
}
|
||||
|
||||
if ($config->use_docblock_types) {
|
||||
if ($docblock_info['return_type']) {
|
||||
$return_type =
|
||||
|
@ -249,6 +249,10 @@ class MethodChecker extends FunctionLikeChecker
|
||||
|
||||
self::$method_suppress[$method_id] = [];
|
||||
|
||||
if (isset($method->returnType)) {
|
||||
$return_type = Type::parseString($method->returnType);
|
||||
}
|
||||
|
||||
if ($doc_comment) {
|
||||
$docblock_info = CommentChecker::extractDocblockInfo((string)$doc_comment);
|
||||
|
||||
|
@ -4364,7 +4364,13 @@ class StatementsChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
$stmt->inferredType = FunctionChecker::getReturnTypeFromCallMap($method_id, $stmt->args, $this->checked_file_name, $stmt->getLine(), $this->suppressed_issues);
|
||||
try {
|
||||
$stmt->inferredType = FunctionChecker::getFunctionReturnTypes($method_id, $this->checked_file_name);
|
||||
}
|
||||
catch (\InvalidArgumentException $e) {
|
||||
$stmt->inferredType = FunctionChecker::getReturnTypeFromCallMap($method_id, $stmt->args, $this->checked_file_name, $stmt->getLine(), $this->suppressed_issues);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($stmt->name instanceof PhpParser\Node\Name && $stmt->name->parts === ['get_class'] && $stmt->args) {
|
||||
|
Loading…
Reference in New Issue
Block a user