mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 01:09:38 +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_column;
|
||||||
use function array_fill_keys;
|
use function array_fill_keys;
|
||||||
use function array_map;
|
use function array_map;
|
||||||
|
use function count;
|
||||||
use function implode;
|
use function implode;
|
||||||
|
|
||||||
abstract class FunctionLikeStorage
|
abstract class FunctionLikeStorage
|
||||||
@ -239,15 +240,18 @@ abstract class FunctionLikeStorage
|
|||||||
*/
|
*/
|
||||||
public function getHoverMarkdown(): string
|
public function getHoverMarkdown(): string
|
||||||
{
|
{
|
||||||
$symbol_text = 'function ' . $this->cased_name . '(' . "\n" . implode(
|
$params = count($this->params) > 0 ? "\n" . implode(
|
||||||
',' . "\n",
|
",\n",
|
||||||
array_map(
|
array_map(
|
||||||
function (FunctionLikeParameter $param): string {
|
function (FunctionLikeParameter $param): string {
|
||||||
return ' ' . ($param->type ?: 'mixed') . ' $' . $param->name;
|
$realType = $param->type ?: 'mixed';
|
||||||
|
return " {$realType} \${$param->name}";
|
||||||
},
|
},
|
||||||
$this->params
|
$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) {
|
if (!$this instanceof MethodStorage) {
|
||||||
return $symbol_text;
|
return $symbol_text;
|
||||||
|
Loading…
Reference in New Issue
Block a user