Here is my formatting settings:
{
"[php]": {
"editor.defaultFormatter": "DEVSENSE.phptools-vscode"
},
"phpTools.language": "en",
"php.format.codeStyle": "Laravel",
"php.inlayHints.types.return": false,
"php.inlayHints.parameters.enabled": false,
"php.completion.parameters": "parentheses",
"php.format.rules.keepControlStatementsOnOneLine": true,
"php.format.rules.spaceAfterCast": true,
"php.format.rules.alignConsecutiveAssignments": false,
"php.format.rules.spaceWithinArrayInitilizersParens": false,
"php.format.rules.arrayInitializersNewLineAfterLastElement": true,
"php.format.rules.arrayInitializersNewLineBeforeFirstElement": true,
"php.format.rules.groupUseNewLineBeforeFirstDeclaration": false,
"php.format.rules.switchStatementNewLineAfterLeftParen": true,
"php.format.rules.callParametersNewLineBeforeRightParen": true,
"php.format.rules.callParametersNewLineAfterLeftParen": true,
"php.format.rules.whileStatementNewLineAfterLeftParen": true,
"php.format.rules.ifStatementNewLineBeforeRightParen": true,
"php.format.rules.openBraceOnNewLineForFunctions": true,
"php.format.rules.ifStatementNewLineAfterLeftParen": true,
"php.format.rules.openBraceOnNewLineForBlocks": false,
"php.format.rules.declParametersNewLineAfterLeftParen": true,
"php.format.rules.whileStatementNewLineBeforeRightParen": true,
"php.format.rules.endWithNewLine": false,
"php.format.rules.chainedMethodCallsSemicolonOnNewLine": false,
"php.format.rules.declParametersWrap": "onEveryItem",
"php.format.rules.spaceAroundConcatenation": true,
"php.format.rules.spaceBeforeColonInReturnType": false,
"php.format.rules.spaceAfterUnaryNot": false,
"php.format.rules.removeReduntandClosingTag": true,
"php.format.rules.addCommaAfterLastDeclParameter": false,
"php.format.rules.addCommaAfterLastArrayElement": true,
"php.format.rules.arrayInitializersWrap": "onEveryItem",
"php.format.rules.spaceWithinBrackets": false,
"php.format.rules.spaceWithinForParens": true,
"php.format.rules.callParametersWrap": "onEveryItem",
"php.format.rules.addCommaAfterLastCallParameter": false,
"php.format.rules.alignConstants": false,
"php.format.rules.alignEnumCases": true,
"php.format.rules.alignMatchArmBodies": false,
"php.format.rules.chainedMethodCallsWrap": "always",
"php.format.rules.arrayInitializersAlignKeyValuePairs": false,
"php.completion.showParameters": true,
"php.format.rules.declCompactEmptyBody": false,
"php.format.rules.spaceBeforeParenthesesInControlStatements": true,
"php.format.rules.declKeepRightParenAndOpenBraceOnOneLine": true,
"php.format.rules.forStatementNewLineBeforeRightParen": true,
"php.format.rules.switchStatementNewLineBeforeRightParen": true,
"php.hover.parametersFullName": true,
"php.completion.showDeprecated": "showStrikethrough",
"php.problems.excludeGitIgnore": true,
"php.format.rules.indentBraces": false,
"php.codeLens.enabled": false,
"php.format.rules.declParametersNewLineBeforeRightParen": false,
}
I observed that the issue shows up when the parameters has multiple lines. Here is the example file:
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Carbon;
class Test
{
public function set($key, $value, $options)
{
return $this;
}
public function bar()
{
return $this;
}
public function foo()
{
$date = Carbon::now();
// Here it is not working.
$this->set(
$date->copy()
->endOfDay()
,
$date->copy()
->startOfDay()
,
['timezone' => 'UTC']
)
->bar();
}
public function zoo()
{
$date = Carbon::now();
// Here it is working.
$this->set(
$date->copy(),
$date->copy(),
['timezone' => 'UTC']
)
->bar();
}
public function baz()
{
// Here it is working fine.
$this->set(
'parameters',
'value',
['option' => 'value']
)
->bar();
}
}