mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Merge pull request #6552 from orklah/manipulator
This commit is contained in:
commit
377d3bddf0
@ -123,6 +123,14 @@ class FunctionDocblockManipulator
|
||||
$this->docblock_end = $function_start = (int)$stmt->getAttribute('startFilePos');
|
||||
$function_end = (int)$stmt->getAttribute('endFilePos');
|
||||
|
||||
$attributes = $stmt->getAttrGroups();
|
||||
foreach ($attributes as $attribute) {
|
||||
// if we have attribute groups, we need to consider that the function starts after them
|
||||
if ((int) $attribute->getAttribute('endFilePos') > $function_start) {
|
||||
$function_start = (int) $attribute->getAttribute('endFilePos');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($stmt->params as $param) {
|
||||
if ($param->var instanceof PhpParser\Node\Expr\Variable
|
||||
&& \is_string($param->var->name)
|
||||
|
@ -1088,6 +1088,32 @@ class MissingReturnTypeTest extends FileManipulationTestCase
|
||||
false,
|
||||
true,
|
||||
],
|
||||
'WithAttributes' => [
|
||||
'<?php
|
||||
|
||||
class A
|
||||
{
|
||||
#[Foo()]
|
||||
public function bar()
|
||||
{
|
||||
}
|
||||
}
|
||||
',
|
||||
'<?php
|
||||
|
||||
class A
|
||||
{
|
||||
#[Foo()]
|
||||
public function bar(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
',
|
||||
'7.1',
|
||||
['MissingReturnType'],
|
||||
true,
|
||||
true,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user