mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Allow overriding the signature type by a param docblock for promoted properties
This commit is contained in:
parent
b42c2814a9
commit
a6e4230d2d
@ -618,7 +618,7 @@ class FunctionLikeNodeScanner
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
|
@ -1955,8 +1955,24 @@ class AnnotationTest extends TestCase
|
||||
',
|
||||
'error_message' => 'InvalidDocblock',
|
||||
],
|
||||
'promotedPropertyWithParamDocblockAndSignatureType' => [
|
||||
'<?php
|
||||
|
||||
class A
|
||||
{
|
||||
public function __construct(
|
||||
/** @var "cti"|"basic"|"teams"|"" */
|
||||
public string $licenseType = "",
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A("ladida");
|
||||
$a->licenseType = "dudidu";
|
||||
|
||||
echo $a->licenseType;',
|
||||
'error_message' => 'InvalidArgument',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user