mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
allow signature type for promoted property as well as property docblock (that will be used for param as well)
This commit is contained in:
parent
f327c986d0
commit
d409c063f3
@ -606,7 +606,7 @@ class FunctionLikeNodeScanner
|
||||
}
|
||||
|
||||
//both way to document type were used
|
||||
if ($param_storage->type && $var_comment_type) {
|
||||
if ($param_storage->type && $param_storage->type->from_docblock && $var_comment_type) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InvalidDocblock(
|
||||
'Param ' . $param_storage->name . ' of ' . $cased_function_id .
|
||||
@ -625,7 +625,7 @@ class FunctionLikeNodeScanner
|
||||
|
||||
$property_storage = $classlike_storage->properties[$param_storage->name] = new PropertyStorage();
|
||||
$property_storage->is_static = false;
|
||||
$property_storage->type = $param_storage->type ?? $var_comment_type;
|
||||
$property_storage->type = $param_storage->type;
|
||||
$property_storage->signature_type = $param_storage->signature_type;
|
||||
$property_storage->signature_type_location = $param_storage->signature_type_location;
|
||||
$property_storage->type_location = $param_storage->type_location;
|
||||
|
@ -1319,6 +1319,19 @@ class AnnotationTest extends TestCase
|
||||
new UserRole(new stdClass(), new stdClass());
|
||||
'
|
||||
],
|
||||
'promotedPropertiesDocumentationForPropertyAndSignature' => [
|
||||
'<?php
|
||||
final class A
|
||||
{
|
||||
public function __construct(
|
||||
/**
|
||||
* @var iterable<string>
|
||||
*/
|
||||
private iterable $strings,
|
||||
) {
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user