mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Merge pull request #7013 from orklah/6951
Allow overriding the signature type by a param docblock for promoted properties
This commit is contained in:
commit
8bc71fcf85
@ -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