diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index 4d85c3c8413..ec081db6f22 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -618,7 +618,7 @@ public function start(PhpParser\Node\FunctionLike $stmt, bool $fake_method = fal } //no docblock type was provided for param but we have one for property - if ($param_storage->type === null && $var_comment_type) { + if ($var_comment_type) { $param_storage->type = $var_comment_type; } diff --git a/tests/AnnotationTest.php b/tests/AnnotationTest.php index 0fee6db51a6..908de6f4dd1 100644 --- a/tests/AnnotationTest.php +++ b/tests/AnnotationTest.php @@ -1955,8 +1955,24 @@ public function __construct( ', 'error_message' => 'InvalidDocblock', ], + 'promotedPropertyWithParamDocblockAndSignatureType' => [ + 'licenseType = "dudidu"; + echo $a->licenseType;', + 'error_message' => 'InvalidArgument', + ], ]; } }