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:
parent
fa26499dd9
commit
d46c6ac0e4
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user