Skip to content

Commit f8c1bef

Browse files
committed
Require trailing comma in function declaration
1 parent ab4d365 commit f8c1bef

File tree

400 files changed

+679
-669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

400 files changed

+679
-669
lines changed

build/rector-downgrade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
77
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
88
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
9+
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
910
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
1011

1112

@@ -33,6 +34,10 @@
3334

3435
$services = $containerConfigurator->services();
3536

37+
if ($targetPhpVersionId < 80000) {
38+
$services->set(DowngradeTrailingCommasInParamUseRector::class);
39+
}
40+
3641
if ($targetPhpVersionId < 70400) {
3742
$services->set(DowngradeTypedPropertyRector::class);
3843
$services->set(DowngradeNullCoalescingOperatorRector::class);

compiler/src/Console/CompileCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(
4747
Filesystem $filesystem,
4848
ProcessFactory $processFactory,
4949
string $dataDir,
50-
string $buildDir
50+
string $buildDir,
5151
)
5252
{
5353
parent::__construct();

phpcs.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
</properties>
148148
</rule>
149149
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration"/>
150+
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration">
151+
<properties>
152+
<property name="enable" value="true"/>
153+
</properties>
154+
</rule>
150155
<exclude-pattern>tests/*/data</exclude-pattern>
151156
<exclude-pattern>tests/e2e/resultCache_1.php</exclude-pattern>
152157
<exclude-pattern>tests/e2e/resultCache_2.php</exclude-pattern>

src/Analyser/Analyser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(
3333
FileAnalyser $fileAnalyser,
3434
Registry $registry,
3535
NodeScopeResolver $nodeScopeResolver,
36-
int $internalErrorsCountLimit
36+
int $internalErrorsCountLimit,
3737
)
3838
{
3939
$this->fileAnalyser = $fileAnalyser;
@@ -53,7 +53,7 @@ public function analyse(
5353
?Closure $preFileCallback = null,
5454
?Closure $postFileCallback = null,
5555
bool $debug = false,
56-
?array $allAnalysedFiles = null
56+
?array $allAnalysedFiles = null,
5757
): AnalyserResult
5858
{
5959
if ($allAnalysedFiles === null) {

src/Analyser/AnalyserResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(
3636
array $internalErrors,
3737
?array $dependencies,
3838
array $exportedNodes,
39-
bool $reachedInternalErrorsCountLimit
39+
bool $reachedInternalErrorsCountLimit,
4040
)
4141
{
4242
$this->unorderedErrors = $errors;

src/Analyser/ConditionalExpressionHolder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConditionalExpressionHolder
2222
*/
2323
public function __construct(
2424
array $conditionExpressionTypes,
25-
VariableTypeHolder $typeHolder
25+
VariableTypeHolder $typeHolder,
2626
)
2727
{
2828
if (count($conditionExpressionTypes) === 0) {

src/Analyser/DirectScopeFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(
6060
NodeScopeResolver $nodeScopeResolver,
6161
bool $treatPhpDocTypesAsCertain,
6262
Container $container,
63-
PhpVersion $phpVersion
63+
PhpVersion $phpVersion,
6464
)
6565
{
6666
$this->scopeClass = $scopeClass;
@@ -104,7 +104,7 @@ public function create(
104104
array $nativeExpressionTypes = [],
105105
array $inFunctionCallsStack = [],
106106
bool $afterExtractCall = false,
107-
?Scope $parentScope = null
107+
?Scope $parentScope = null,
108108
): MutatingScope
109109
{
110110
$scopeClass = $this->scopeClass;

src/Analyser/EnsuredNonNullabilityResultExpression.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class EnsuredNonNullabilityResultExpression
1717
public function __construct(
1818
Expr $expression,
1919
Type $originalType,
20-
Type $originalNativeType
20+
Type $originalNativeType,
2121
)
2222
{
2323
$this->expression = $expression;

src/Analyser/Error.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(
5757
?int $nodeLine = null,
5858
?string $nodeType = null,
5959
?string $identifier = null,
60-
array $metadata = []
60+
array $metadata = [],
6161
)
6262
{
6363
$this->message = $message;

src/Analyser/ExpressionContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ExpressionContext
1616
private function __construct(
1717
bool $isDeep,
1818
?string $inAssignRightSideVariableName,
19-
?Type $inAssignRightSideType
19+
?Type $inAssignRightSideType,
2020
)
2121
{
2222
$this->isDeep = $isDeep;

0 commit comments

Comments
 (0)