phel-lang
phel-lang copied to clipboard
Add trailing comma in multiline arrays, arguments and parameters
π Description
Since PHP 8.0, it's possible to add trailing comma for multiline arrays, arguments, parameters and closures (RFCΒΉ & RFCΒ²).
It's also possible to add the rule on .php-cs-fixer.dist.php, having this rule, the code will be more standard along the project, also, when we want to add a new parameter to a function/whatever it applies, we will have to update a single line instead of two, eg:
return new FileCompiler(
$this->getCompilerFacade(),
- $this->createNamespaceExtractor()
);
# ππΌππΌππΌ
return new FileCompiler(
$this->getCompilerFacade(),
+ $this->createNamespaceExtractor(),
+ $this->otherDependency()
);
# π‘ will become to
return new FileCompiler(
$this->getCompilerFacade(),
$this->createNamespaceExtractor(),
);
# ππΌππΌππΌ
return new FileCompiler(
$this->getCompilerFacade(),
$this->createNamespaceExtractor(),
+ $this->otherDependency(),
);