Add default types to method tag arguments

This commit is contained in:
Jaapio
2022-10-28 22:37:28 +02:00
parent e4ac07bc40
commit 81553b535f
3 changed files with 28 additions and 1 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Method;
use phpDocumentor\Reflection\DocBlock\Tags\MethodParameter;
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\Types\Context;
use phpDocumentor\Reflection\Types\Mixed_;
use phpDocumentor\Reflection\Types\Void_;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode;
@@ -49,7 +50,7 @@ final class MethodFactory implements PHPStanFactory
function (MethodTagValueParameterNode $param) use ($context) {
return new MethodParameter(
trim($param->parameterName, '$'),
$this->typeFactory->createType($param->type, $context),
$this->typeFactory->createType($param->type, $context) ?? new Mixed_(),
$param->isReference,
$param->isVariadic,
(string) $param->defaultValue
+1
View File
@@ -328,6 +328,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
/**
* @param array{name: string, type: Type} $arguments
*
* @return MethodParameter[]
*/
private function fromLegacyArguments(array $arguments): array