'phpcs - Prevent showing "Opening parenthesis of a multi-line function call must be the last content on the line"
The error occur for this code:
$posts = App\Post::whereHas('comments', function (Builder $query) {
$query->where('content', 'like', 'foo%');
});
I'm using phpcs vscode and need all of the default rules of phpcs except this one!
Could you please tell me how to
- Write a phpcs with all of the default rules
- How to exclude this rule
Solution 1:[1]
You can use ruleset.xml with this content
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>My custom coding standard.</description>
<rule ref="PEAR">
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
</rule>
</ruleset>
And then add this line in Phpcs: standards settings.json in VS code
{
"phpcs.standard": "path_to_your_standard/ruleset.xml"
}
More information about ruleset you can find here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Svyatoslav Kuznetsov |
