Skip to content

Commit 675cf24

Browse files
committed
CS: remove blank line at end of functions
These made sense for readability with the noisy `//end ...` comments, but not without those... they really are not needed. Includes removing the rule from the PHPCS native ruleset and adding another one to enforce the opposite, i.e. no blank line between function body and close curly. Includes updating the comment format used for "required method which we don't use" comments in four sniffs to not run into "Empty line required after block comment" issues.
1 parent 771d9da commit 675cf24

File tree

645 files changed

+12
-2413
lines changed

Some content is hidden

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

645 files changed

+12
-2413
lines changed

autoload.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ public static function load(string $className)
140140
}
141141

142142
return false;
143-
144143
}
145144

146145

@@ -183,7 +182,6 @@ public static function loadFile(string $path)
183182
self::$loadedClasses[$path] = $className;
184183
self::$loadedFiles[$className] = $path;
185184
return self::$loadedClasses[$path];
186-
187185
}
188186

189187

@@ -244,7 +242,6 @@ static function ($remaining, $current) {
244242
}
245243

246244
return $className;
247-
248245
}
249246

250247

@@ -259,7 +256,6 @@ static function ($remaining, $current) {
259256
public static function addSearchPath(string $path, string $nsPrefix = '')
260257
{
261258
self::$searchPaths[$path] = rtrim(trim((string) $nsPrefix), '\\');
262-
263259
}
264260

265261

@@ -271,7 +267,6 @@ public static function addSearchPath(string $path, string $nsPrefix = '')
271267
public static function getSearchPaths()
272268
{
273269
return self::$searchPaths;
274-
275270
}
276271

277272

@@ -290,7 +285,6 @@ public static function getLoadedClassName(string $path)
290285
}
291286

292287
return self::$loadedClasses[$path];
293-
294288
}
295289

296290

@@ -309,7 +303,6 @@ public static function getLoadedFileName(string $className)
309303
}
310304

311305
return self::$loadedFiles[$className];
312-
313306
}
314307

315308

@@ -321,7 +314,6 @@ public static function getLoadedFileName(string $className)
321314
public static function getLoadedClasses()
322315
{
323316
return self::$loadedClasses;
324-
325317
}
326318

327319

@@ -333,7 +325,6 @@ public static function getLoadedClasses()
333325
public static function getLoadedFiles()
334326
{
335327
return self::$loadedFiles;
336-
337328
}
338329

339330

phpcs.xml.dist

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@
6464
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
6565
<rule ref="Generic.Strings.UnnecessaryHeredoc"/>
6666
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
67-
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/>
67+
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace">
68+
<exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose"/>
69+
</rule>
70+
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
6871
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
6972
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/>
7073
<rule ref="PSR12.Operators.OperatorSpacing"/>

requirements.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,4 @@ function checkRequirements()
6969
fwrite(STDERR, sprintf($error, $required, $missing));
7070
exit($exitCode);
7171
}
72-
7372
}

scripts/BuildRequirementsCheckMatrix.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public function getBuilds()
7171
);
7272

7373
return $builds;
74-
7574
}
7675

7776

@@ -105,7 +104,6 @@ private function getValidBuilds()
105104
}
106105

107106
return $builds;
108-
109107
}
110108

111109

@@ -137,7 +135,6 @@ private function getInvalidPHPBuilds()
137135
}
138136

139137
return $builds;
140-
141138
}
142139

143140

@@ -181,7 +178,6 @@ private function getMissingExtensionsBuilds()
181178
}//end foreach
182179

183180
return $builds;
184-
185181
}
186182

187183

scripts/build-phar.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function stripWhitespaceAndComments(string $fullpath, Config $config)
7575
}
7676

7777
return $stripped;
78-
7978
}
8079

8180

src/Config.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ public function __get(string $name)
275275
}
276276

277277
return $this->settings[$name];
278-
279278
}
280279

281280

@@ -348,7 +347,6 @@ public function __set(string $name, $value)
348347
}//end switch
349348

350349
$this->settings[$name] = $value;
351-
352350
}
353351

354352

@@ -362,7 +360,6 @@ public function __set(string $name, $value)
362360
public function __isset(string $name)
363361
{
364362
return isset($this->settings[$name]);
365-
366363
}
367364

368365

@@ -376,7 +373,6 @@ public function __isset(string $name)
376373
public function __unset(string $name)
377374
{
378375
$this->settings[$name] = null;
379-
380376
}
381377

382378

@@ -388,7 +384,6 @@ public function __unset(string $name)
388384
public function getSettings()
389385
{
390386
return $this->settings;
391-
392387
}
393388

394389

@@ -402,7 +397,6 @@ public function getSettings()
402397
public function setSettings(array $settings)
403398
{
404399
$this->settings = $settings;
405-
406400
}
407401

408402

@@ -487,7 +481,6 @@ public function __construct(array $cliArgs = [], bool $dieOnUnknownArg = true)
487481
}//end if
488482

489483
fclose($handle);
490-
491484
}
492485

493486

@@ -538,7 +531,6 @@ public function setCommandLineValues(array $args)
538531
$this->processUnknownArgument($arg, $i);
539532
}//end if
540533
}//end for
541-
542534
}
543535

544536

@@ -662,7 +654,6 @@ public function restoreDefaults()
662654
if ($parallel !== null) {
663655
$this->parallel = max((int) $parallel, 1);
664656
}
665-
666657
}
667658

668659

@@ -774,7 +765,6 @@ public function processShortArgument(string $arg, int $pos)
774765
$this->processUnknownArgument('-' . $arg, $pos);
775766
}
776767
}//end switch
777-
778768
}
779769

780770

@@ -1306,7 +1296,6 @@ public function processLongArgument(string $arg, int $pos)
13061296
}//end if
13071297
break;
13081298
}//end switch
1309-
13101299
}
13111300

13121301

@@ -1393,7 +1382,6 @@ static function ($carry, $item) {
13931382
}
13941383

13951384
return $sniffs;
1396-
13971385
}
13981386

13991387

@@ -1422,7 +1410,6 @@ public function processUnknownArgument(string $arg, int $pos)
14221410
}
14231411

14241412
$this->processFilePath($arg);
1425-
14261413
}
14271414

14281415

@@ -1458,7 +1445,6 @@ public function processFilePath(string $path)
14581445
$this->files = $files;
14591446
$this->overriddenDefaults['files'] = true;
14601447
}
1461-
14621448
}
14631449

14641450

@@ -1478,7 +1464,6 @@ public function printUsage()
14781464
}
14791465

14801466
echo PHP_EOL;
1481-
14821467
}
14831468

14841469

@@ -1505,7 +1490,6 @@ public function printShortUsage(bool $returnOutput = false)
15051490
}
15061491

15071492
echo $usage;
1508-
15091493
}
15101494

15111495

@@ -1531,7 +1515,6 @@ public function printPHPCSUsage()
15311515
$shortOptions = Help::DEFAULT_SHORT_OPTIONS . 'aems';
15321516

15331517
(new Help($this, $longOptions, $shortOptions))->display();
1534-
15351518
}
15361519

15371520

@@ -1547,7 +1530,6 @@ public function printPHPCBFUsage()
15471530
$shortOptions = Help::DEFAULT_SHORT_OPTIONS;
15481531

15491532
(new Help($this, $longOptions, $shortOptions))->display();
1550-
15511533
}
15521534

15531535

@@ -1573,7 +1555,6 @@ public static function getConfigData(string $key)
15731555
}
15741556

15751557
return $phpCodeSnifferConfig[$key];
1576-
15771558
}
15781559

15791560

@@ -1614,7 +1595,6 @@ public static function getExecutablePath(string $name)
16141595

16151596
self::$executablePaths[$name] = $result;
16161597
return $result;
1617-
16181598
}
16191599

16201600

@@ -1696,7 +1676,6 @@ public function setConfigData(string $key, ?string $value, bool $temp = false)
16961676
}
16971677

16981678
return true;
1699-
17001679
}
17011680

17021681

@@ -1738,7 +1717,6 @@ public static function getAllConfigData()
17381717
self::$configDataFile = $configFile;
17391718
self::$configData = $phpCodeSnifferConfig;
17401719
return self::$configData;
1741-
17421720
}
17431721

17441722

@@ -1773,7 +1751,6 @@ public function prepareConfigDataForDisplay(array $data)
17731751
}
17741752

17751753
return $output;
1776-
17771754
}
17781755

17791756

@@ -1789,7 +1766,6 @@ public function prepareConfigDataForDisplay(array $data)
17891766
public function printConfigData(array $data)
17901767
{
17911768
echo $this->prepareConfigDataForDisplay($data);
1792-
17931769
}
17941770

17951771

src/Files/DummyFile.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function __construct(string $content, Ruleset $ruleset, Config $config)
5555
}
5656

5757
parent::__construct($path, $ruleset, $config);
58-
5958
}
6059

6160

@@ -85,7 +84,6 @@ public function setErrorCounts(
8584
$this->fixableWarningCount = $fixableWarningCount;
8685
$this->fixedErrorCount = $fixedErrorCount;
8786
$this->fixedWarningCount = $fixedWarningCount;
88-
8987
}
9088

9189

0 commit comments

Comments
 (0)