Skip to content

Commit e4b71d4

Browse files
committed
Trailing commas in calls
1 parent acd6894 commit e4b71d4

567 files changed

Lines changed: 2190 additions & 2184 deletions

File tree

Some content is hidden

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

build/rector-downgrade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php declare(strict_types=1);
22

33
use Rector\Core\Configuration\Option;
4+
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector;
45
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
56
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
67

@@ -15,4 +16,5 @@
1516

1617
$services = $containerConfigurator->services();
1718
$services->set(DowngradeTypedPropertyRector::class);
19+
$services->set(DowngradeTrailingCommasInFunctionCallsRector::class);
1820
};

compiler/src/Console/CompileCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private function renamePhpStormStubs(): void
119119

120120
$renameSuccess = rename(
121121
$path,
122-
dirname($path) . '/' . $stubFile->getBasename('.php') . '.stub'
122+
dirname($path) . '/' . $stubFile->getBasename('.php') . '.stub',
123123
);
124124
if ($renameSuccess === false) {
125125
throw new ShouldNotHappenException(sprintf('Could not rename %s', $path));
@@ -156,7 +156,7 @@ private function renamePhp8Stubs(): void
156156

157157
$renameSuccess = rename(
158158
$path,
159-
dirname($path) . '/' . $stubFile->getBasename('.php') . '.stub'
159+
dirname($path) . '/' . $stubFile->getBasename('.php') . '.stub',
160160
);
161161
if ($renameSuccess === false) {
162162
throw new ShouldNotHappenException(sprintf('Could not rename %s', $path));
@@ -246,7 +246,7 @@ private function patchFile(OutputInterface $output, string $originalFile, string
246246
'patch -d %s %s %s',
247247
escapeshellarg($this->buildDir),
248248
escapeshellarg($originalFile),
249-
escapeshellarg($patchFile)
249+
escapeshellarg($patchFile),
250250
), $outputLines, $exitCode);
251251
if ($exitCode === 0) {
252252
return;

compiler/tests/Console/CompileCommandTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public function testCommand(): void
3030
}
3131
}
3232
}
33-
EOT
34-
);
33+
EOT);
3534

3635
$process = $this->createMock(Process::class);
3736

phpcs.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@
125125
<rule ref="Consistence.NamingConventions.ValidVariableName.NotCamelCaps">
126126
<exclude-pattern>src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php</exclude-pattern>
127127
</rule>
128+
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall">
129+
<properties>
130+
<property name="enable" value="true"/>
131+
</properties>
132+
</rule>
128133
<exclude-pattern>tests/*/data</exclude-pattern>
129134
<exclude-pattern>tests/e2e/resultCache_1.php</exclude-pattern>
130135
<exclude-pattern>tests/e2e/resultCache_2.php</exclude-pattern>

src/Analyser/Analyser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function analyse(
8080
$file,
8181
$allAnalysedFiles,
8282
$this->registry,
83-
null
83+
null,
8484
);
8585
$errors = array_merge($errors, $fileAnalyserResult->getErrors());
8686
$dependencies[$file] = $fileAnalyserResult->getDependencies();
@@ -99,7 +99,7 @@ public function analyse(
9999
'%sRun PHPStan with --debug option and post the stack trace to:%s%s',
100100
"\n",
101101
"\n",
102-
'https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md'
102+
'https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md',
103103
);
104104
$errors[] = new Error($internalErrorMessage, $file, null, $t);
105105
if ($internalErrorsCount >= $this->internalErrorsCountLimit) {
@@ -124,7 +124,7 @@ public function analyse(
124124
[],
125125
$internalErrorsCount === 0 ? $dependencies : null,
126126
$exportedNodes,
127-
$reachedInternalErrorsCountLimit
127+
$reachedInternalErrorsCountLimit,
128128
);
129129
}
130130

src/Analyser/AnalyserResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static function (Error $a, Error $b): int {
5353
$b->getLine(),
5454
$b->getMessage(),
5555
];
56-
}
56+
},
5757
);
5858

5959
$this->errors = $errors;

src/Analyser/ConditionalExpressionHolder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getKey(): string
5656
'%s => %s (%s)',
5757
implode(' && ', $parts),
5858
$this->typeHolder->getType()->describe(VerbosityLevel::precise()),
59-
$this->typeHolder->getCertainty()->describe()
59+
$this->typeHolder->getCertainty()->describe(),
6060
);
6161
}
6262

src/Analyser/DirectScopeFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function create(
140140
$this->dynamicConstantNames,
141141
$this->treatPhpDocTypesAsCertain,
142142
$afterExtractCall,
143-
$parentScope
143+
$parentScope,
144144
);
145145
}
146146

src/Analyser/Error.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function changeFilePath(string $newFilePath): self
109109
$this->nodeLine,
110110
$this->nodeType,
111111
$this->identifier,
112-
$this->metadata
112+
$this->metadata,
113113
);
114114
}
115115

@@ -126,7 +126,7 @@ public function changeTraitFilePath(string $newFilePath): self
126126
$this->nodeLine,
127127
$this->nodeType,
128128
$this->identifier,
129-
$this->metadata
129+
$this->metadata,
130130
);
131131
}
132132

@@ -170,7 +170,7 @@ public function withoutTip(): self
170170
$this->traitFilePath,
171171
null,
172172
$this->nodeLine,
173-
$this->nodeType
173+
$this->nodeType,
174174
);
175175
}
176176

@@ -237,7 +237,7 @@ public static function decode(array $json): self
237237
$json['nodeLine'] ?? null,
238238
$json['nodeType'] ?? null,
239239
$json['identifier'] ?? null,
240-
$json['metadata'] ?? []
240+
$json['metadata'] ?? [],
241241
);
242242
}
243243

@@ -257,7 +257,7 @@ public static function __set_state(array $properties): self
257257
$properties['nodeLine'] ?? null,
258258
$properties['nodeType'] ?? null,
259259
$properties['identifier'] ?? null,
260-
$properties['metadata'] ?? []
260+
$properties['metadata'] ?? [],
261261
);
262262
}
263263

src/Analyser/FileAnalyser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function analyseFile(
174174
$nodeLine,
175175
$nodeType,
176176
$identifier,
177-
$metadata
177+
$metadata,
178178
);
179179
}
180180
}
@@ -213,7 +213,7 @@ public function analyseFile(
213213
$this->nodeScopeResolver->processNodes(
214214
$parserNodes,
215215
$scope,
216-
$nodeCallback
216+
$nodeCallback,
217217
);
218218
$unmatchedLineIgnores = $linesToIgnore;
219219
foreach ($temporaryFileErrors as $tmpFileError) {
@@ -248,7 +248,7 @@ public function analyseFile(
248248
null,
249249
null,
250250
null,
251-
'ignoredError.unmatchedOnLine'
251+
'ignoredError.unmatchedOnLine',
252252
);
253253
}
254254
}

0 commit comments

Comments
 (0)