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

Fix #1395 - set all callable types as coming from a docblock

This commit is contained in:
Brown 2019-02-27 14:52:51 -05:00
parent fa26499dd9
commit d46c6ac0e4
2 changed files with 32 additions and 0 deletions

View File

@ -236,4 +236,26 @@ trait CallableTrait
$this->return_type->replaceTemplateTypesWithArgTypes($template_types);
}
}
/**
* @return void
*/
public function setFromDocblock()
{
$this->from_docblock = true;
if ($this->params) {
foreach ($this->params as $param) {
if (!$param->type) {
continue;
}
$param->type->setFromDocblock();
}
}
if ($this->return_type) {
$this->return_type->setFromDocblock();
}
}
}

View File

@ -234,6 +234,16 @@ class Php71Test extends TestCase
return $i;
}',
],
'noReservedWordInDocblock' => [
'<?php
/**
* @param Closure():(resource|false) $op
* @return resource|false
*/
function create_resource($op) {
return $op();
}'
],
];
}