砍掉函数参数,但如果一个参数是多行数组并且行不是很长,则保持原样
Chop down function arguments, but keep as-is if one argument is a multi line array and line is not to long
我一直在使用所有 PhpStorm 格式设置选项,但如果按照我想要的方式运行,我找不到方法。
所以基本上我希望 PhpStorm 能够:
1.转这个:
myfunction('hello',
'world');
进入这个:
myfunction(
'hello',
'world'
);
2。保持原样:
myfunction([
'hello' => 'world',
]);
此外,不应重新格式化:
myfunction($variableOne, [
'hello' => 'world',
]);
这可能吗?
据我所知,目前这是不可能的。
现在获得这个能力
myfunction([
'hello' => 'world',
]);
myfunction($variableOne, [
'hello' => 'world',
]);
您可以在这个位置设置选项:
但是要在新行中设置不同参数的换行
myfunction(
'hello',
'world'
);
您需要另一个选项列表:
但在这种情况下,数组的包装不符合您的条件。
在 JetBrains issue tracker 上留下您的功能请求。只有他们可以帮助您使用此功能。
您需要一些选项,例如 Don't wrap array declaration
。
但是你也有一次碰撞的情况:
如果你想在这种情况下换行
myfunction(
'hello',
'world'
);
你为什么不想要这个?
myfunction(
$variableOne, [
'hello' => 'world',
]
);
myfunction(
[
'hello' => 'world',
]
);
或者您甚至可能需要 Leave array declaration braces with comma/brace in method call
这样的选项。在那种情况下,它将以
的方式工作
myfunction($variableOne, [
'hello' => 'world',
]);
myfunction([
'hello' => 'world',
]);
但是这里你还需要一些选项,比如Don't wrap argument if it no long and contain array declaration
。
恕我直言,解决此问题的最佳方法是留下功能请求并详细描述包装规则,例如在接下来的情况下要做什么
myfunction($variableOne, $variableTwo, [
'hello' => 'world',
]);
myfunction($variableOne, $variableTwo, [
'hello' => 'world',
], [
'another' => 'array',
]);
还有如何处理 PHP 5.3- 方法调用中的数组声明 array('key' => 'value')
。
我一直在使用所有 PhpStorm 格式设置选项,但如果按照我想要的方式运行,我找不到方法。
所以基本上我希望 PhpStorm 能够:
1.转这个:
myfunction('hello',
'world');
进入这个:
myfunction(
'hello',
'world'
);
2。保持原样:
myfunction([
'hello' => 'world',
]);
此外,不应重新格式化:
myfunction($variableOne, [
'hello' => 'world',
]);
这可能吗?
据我所知,目前这是不可能的。
现在获得这个能力
myfunction([
'hello' => 'world',
]);
myfunction($variableOne, [
'hello' => 'world',
]);
您可以在这个位置设置选项:
但是要在新行中设置不同参数的换行
myfunction(
'hello',
'world'
);
您需要另一个选项列表:
但在这种情况下,数组的包装不符合您的条件。
在 JetBrains issue tracker 上留下您的功能请求。只有他们可以帮助您使用此功能。
您需要一些选项,例如 Don't wrap array declaration
。
但是你也有一次碰撞的情况: 如果你想在这种情况下换行
myfunction(
'hello',
'world'
);
你为什么不想要这个?
myfunction(
$variableOne, [
'hello' => 'world',
]
);
myfunction(
[
'hello' => 'world',
]
);
或者您甚至可能需要 Leave array declaration braces with comma/brace in method call
这样的选项。在那种情况下,它将以
myfunction($variableOne, [
'hello' => 'world',
]);
myfunction([
'hello' => 'world',
]);
但是这里你还需要一些选项,比如Don't wrap argument if it no long and contain array declaration
。
恕我直言,解决此问题的最佳方法是留下功能请求并详细描述包装规则,例如在接下来的情况下要做什么
myfunction($variableOne, $variableTwo, [
'hello' => 'world',
]);
myfunction($variableOne, $variableTwo, [
'hello' => 'world',
], [
'another' => 'array',
]);
还有如何处理 PHP 5.3- 方法调用中的数组声明 array('key' => 'value')
。