mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
fix new lines in funcs with no params
This commit is contained in:
parent
f8fd0fef60
commit
6394e2d548
@ -10,6 +10,7 @@ use Psalm\Type\Union;
|
||||
use function array_column;
|
||||
use function array_fill_keys;
|
||||
use function array_map;
|
||||
use function count;
|
||||
use function implode;
|
||||
|
||||
abstract class FunctionLikeStorage
|
||||
@ -239,15 +240,18 @@ abstract class FunctionLikeStorage
|
||||
*/
|
||||
public function getHoverMarkdown(): string
|
||||
{
|
||||
$symbol_text = 'function ' . $this->cased_name . '(' . "\n" . implode(
|
||||
',' . "\n",
|
||||
$params = count($this->params) > 0 ? "\n" . implode(
|
||||
",\n",
|
||||
array_map(
|
||||
function (FunctionLikeParameter $param): string {
|
||||
return ' ' . ($param->type ?: 'mixed') . ' $' . $param->name;
|
||||
$realType = $param->type ?: 'mixed';
|
||||
return " {$realType} \${$param->name}";
|
||||
},
|
||||
$this->params
|
||||
)
|
||||
) . "\n" . ') : ' . ($this->return_type ?: 'mixed');
|
||||
) . "\n" : '';
|
||||
$return_type = $this->return_type ?: 'mixed';
|
||||
$symbol_text = "function {$this->cased_name}({$params}): {$return_type}";
|
||||
|
||||
if (!$this instanceof MethodStorage) {
|
||||
return $symbol_text;
|
||||
|
Loading…
Reference in New Issue
Block a user