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

Fix #896 - improve ReflectionParameter::getType return

This commit is contained in:
Matthew Brown 2018-07-17 08:45:42 -04:00
parent 0fa7cbeb02
commit 9a9adf897d
2 changed files with 13 additions and 1 deletions

View File

@ -9543,7 +9543,7 @@ return [
'ReflectionParameter::getDefaultValueConstantName' => ['string'],
'ReflectionParameter::getName' => ['string'],
'ReflectionParameter::getPosition' => ['int'],
'ReflectionParameter::getType' => ['ReflectionType'],
'ReflectionParameter::getType' => ['ReflectionType|null'],
'ReflectionParameter::hasType' => ['bool'],
'ReflectionParameter::isArray' => ['bool'],
'ReflectionParameter::isCallable' => ['bool'],

View File

@ -166,6 +166,18 @@ class MethodCallTest extends TestCase
return $b->getAttribute("bat");
}',
],
'reflectionParameter' => [
'<?php
function getTypeName(ReflectionParameter $parameter): string {
$type = $parameter->getType();
if ($type === null) {
return "mixed";
}
return $type->getName();
}'
],
];
}