Skip to content

Commit a6afaed

Browse files
authored
Merge pull request #1239 from PHPCSStandards/phpcs-4.x/feature/155-normalize-some-code-style-rules-2
CS: normalize code style rules [2]
2 parents c5e7f48 + 42bc6c5 commit a6afaed

File tree

172 files changed

+340
-336
lines changed

Some content is hidden

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

172 files changed

+340
-336
lines changed

autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static function ($remaining, $current) {
256256
*
257257
* @return void
258258
*/
259-
public static function addSearchPath(string $path, string $nsPrefix='')
259+
public static function addSearchPath(string $path, string $nsPrefix = '')
260260
{
261261
self::$searchPaths[$path] = rtrim(trim((string) $nsPrefix), '\\');
262262

phpcs.xml.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353
<exclude name="Squiz.Commenting.VariableComment.LinkTagNotAllowed"/>
5454
</rule>
5555
<rule ref="Squiz.Formatting.OperatorBracket"/>
56-
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
56+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
57+
<properties>
58+
<property name="equalsSpacing" value="1"/>
59+
</properties>
60+
</rule>
5761
<rule ref="Squiz.Operators.ComparisonOperatorUsage"/>
5862
<rule ref="Squiz.PHP.DisallowInlineIf"/>
5963
<rule ref="Squiz.Scope.MethodScope"/>

src/Config.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public function setSettings(array $settings)
415415
*
416416
* @return void
417417
*/
418-
public function __construct(array $cliArgs=[], bool $dieOnUnknownArg=true)
418+
public function __construct(array $cliArgs = [], bool $dieOnUnknownArg = true)
419419
{
420420
if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
421421
// Let everything through during testing so that we can
@@ -1490,7 +1490,7 @@ public function printUsage()
14901490
*
14911491
* @return string|void
14921492
*/
1493-
public function printShortUsage(bool $returnOutput=false)
1493+
public function printShortUsage(bool $returnOutput = false)
14941494
{
14951495
if (PHP_CODESNIFFER_CBF === true) {
14961496
$usage = 'Run "phpcbf --help" for usage information';
@@ -1633,7 +1633,7 @@ public static function getExecutablePath(string $name)
16331633
* @see getConfigData()
16341634
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the config file can not be written.
16351635
*/
1636-
public function setConfigData(string $key, ?string $value, bool $temp=false)
1636+
public function setConfigData(string $key, ?string $value, bool $temp = false)
16371637
{
16381638
if (isset($this->overriddenDefaults['runtime-set']) === true
16391639
&& isset($this->overriddenDefaults['runtime-set'][$key]) === true

src/Files/File.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,9 @@ public function addError(
674674
string $error,
675675
?int $stackPtr,
676676
string $code,
677-
array $data=[],
678-
int $severity=0,
679-
bool $fixable=false
677+
array $data = [],
678+
int $severity = 0,
679+
bool $fixable = false
680680
) {
681681
if ($stackPtr === null) {
682682
$line = 1;
@@ -708,9 +708,9 @@ public function addWarning(
708708
string $warning,
709709
?int $stackPtr,
710710
string $code,
711-
array $data=[],
712-
int $severity=0,
713-
bool $fixable=false
711+
array $data = [],
712+
int $severity = 0,
713+
bool $fixable = false
714714
) {
715715
if ($stackPtr === null) {
716716
$line = 1;
@@ -741,8 +741,8 @@ public function addErrorOnLine(
741741
string $error,
742742
int $line,
743743
string $code,
744-
array $data=[],
745-
int $severity=0
744+
array $data = [],
745+
int $severity = 0
746746
) {
747747
return $this->addMessage(true, $error, $line, 1, $code, $data, $severity, false);
748748

@@ -765,8 +765,8 @@ public function addWarningOnLine(
765765
string $warning,
766766
int $line,
767767
string $code,
768-
array $data=[],
769-
int $severity=0
768+
array $data = [],
769+
int $severity = 0
770770
) {
771771
return $this->addMessage(false, $warning, $line, 1, $code, $data, $severity, false);
772772

@@ -791,8 +791,8 @@ public function addFixableError(
791791
string $error,
792792
int $stackPtr,
793793
string $code,
794-
array $data=[],
795-
int $severity=0
794+
array $data = [],
795+
int $severity = 0
796796
) {
797797
$recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true);
798798
if ($recorded === true && $this->fixer->enabled === true) {
@@ -822,8 +822,8 @@ public function addFixableWarning(
822822
string $warning,
823823
int $stackPtr,
824824
string $code,
825-
array $data=[],
826-
int $severity=0
825+
array $data = [],
826+
int $severity = 0
827827
) {
828828
$recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true);
829829
if ($recorded === true && $this->fixer->enabled === true) {
@@ -2264,7 +2264,7 @@ public function isReference(int $stackPtr)
22642264
* @return string The token contents.
22652265
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position does not exist.
22662266
*/
2267-
public function getTokensAsString($start, $length, bool $origContent=false)
2267+
public function getTokensAsString($start, $length, bool $origContent = false)
22682268
{
22692269
if (is_int($start) === false || isset($this->tokens[$start]) === false) {
22702270
throw new RuntimeException('The $start position for getTokensAsString() must exist in the token stack');
@@ -2324,10 +2324,10 @@ public function getTokensAsString($start, $length, bool $origContent=false)
23242324
public function findPrevious(
23252325
$types,
23262326
int $start,
2327-
?int $end=null,
2328-
bool $exclude=false,
2329-
?string $value=null,
2330-
bool $local=false
2327+
?int $end = null,
2328+
bool $exclude = false,
2329+
?string $value = null,
2330+
bool $local = false
23312331
) {
23322332
$types = (array) $types;
23332333

@@ -2405,10 +2405,10 @@ public function findPrevious(
24052405
public function findNext(
24062406
$types,
24072407
int $start,
2408-
?int $end=null,
2409-
bool $exclude=false,
2410-
?string $value=null,
2411-
bool $local=false
2408+
?int $end = null,
2409+
bool $exclude = false,
2410+
?string $value = null,
2411+
bool $local = false
24122412
) {
24132413
$types = (array) $types;
24142414

@@ -2451,7 +2451,7 @@ public function findNext(
24512451
*
24522452
* @return int
24532453
*/
2454-
public function findStartOfStatement(int $start, $ignore=null)
2454+
public function findStartOfStatement(int $start, $ignore = null)
24552455
{
24562456
$startTokens = Tokens::BLOCK_OPENERS;
24572457
$startTokens[T_OPEN_SHORT_ARRAY] = true;
@@ -2642,7 +2642,7 @@ public function findStartOfStatement(int $start, $ignore=null)
26422642
*
26432643
* @return int
26442644
*/
2645-
public function findEndOfStatement(int $start, $ignore=null)
2645+
public function findEndOfStatement(int $start, $ignore = null)
26462646
{
26472647
$endTokens = [
26482648
T_COLON => true,
@@ -2769,7 +2769,7 @@ public function findEndOfStatement(int $start, $ignore=null)
27692769
* FALSE when no matching token could be found between the start of
27702770
* the line and the start token.
27712771
*/
2772-
public function findFirstOnLine($types, int $start, bool $exclude=false, ?string $value=null)
2772+
public function findFirstOnLine($types, int $start, bool $exclude = false, ?string $value = null)
27732773
{
27742774
if (is_array($types) === false) {
27752775
$types = [$types];
@@ -2860,7 +2860,7 @@ public function hasCondition(int $stackPtr, $types)
28602860
*
28612861
* @return int|false
28622862
*/
2863-
public function getCondition(int $stackPtr, $type, bool $first=true)
2863+
public function getCondition(int $stackPtr, $type, bool $first = true)
28642864
{
28652865
// Check for the existence of the token.
28662866
if (isset($this->tokens[$stackPtr]) === false) {

src/Files/FileList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function __construct(Config $config, Ruleset $ruleset)
117117
*
118118
* @return void
119119
*/
120-
public function addFile(string $path, ?File $file=null)
120+
public function addFile(string $path, ?File $file = null)
121121
{
122122
// No filtering is done for STDIN when the filename
123123
// has not been specified.

src/Fixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function fixFile()
235235
*
236236
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException When the diff command fails.
237237
*/
238-
public function generateDiff(?string $filePath=null, bool $colors=true)
238+
public function generateDiff(?string $filePath = null, bool $colors = true)
239239
{
240240
if ($filePath === null) {
241241
$filePath = $this->currentFile->getFilename();
@@ -689,7 +689,7 @@ public function revertToken(int $stackPtr)
689689
*
690690
* @return bool If the change was accepted.
691691
*/
692-
public function substrToken(int $stackPtr, int $start, ?int $length=null)
692+
public function substrToken(int $stackPtr, int $start, ?int $length = null)
693693
{
694694
$current = $this->getTokenContent($stackPtr);
695695

src/Reports/Cbf.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Cbf implements Report
4242
* @return bool
4343
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
4444
*/
45-
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
45+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
4646
{
4747
$errors = $phpcsFile->getFixableCount();
4848
if ($errors !== 0) {
@@ -139,10 +139,10 @@ public function generate(
139139
int $totalErrors,
140140
int $totalWarnings,
141141
int $totalFixable,
142-
bool $showSources=false,
143-
int $width=80,
144-
bool $interactive=false,
145-
bool $toScreen=true
142+
bool $showSources = false,
143+
int $width = 80,
144+
bool $interactive = false,
145+
bool $toScreen = true
146146
) {
147147
$lines = explode(PHP_EOL, $cachedData);
148148
array_pop($lines);

src/Reports/Checkstyle.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Checkstyle implements Report
3232
*
3333
* @return bool
3434
*/
35-
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
35+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
3636
{
3737
$out = new XMLWriter;
3838
$out->openMemory();
@@ -95,10 +95,10 @@ public function generate(
9595
int $totalErrors,
9696
int $totalWarnings,
9797
int $totalFixable,
98-
bool $showSources=false,
99-
int $width=80,
100-
bool $interactive=false,
101-
bool $toScreen=true
98+
bool $showSources = false,
99+
int $width = 80,
100+
bool $interactive = false,
101+
bool $toScreen = true
102102
) {
103103
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
104104
echo '<checkstyle version="'.Config::VERSION.'">'.PHP_EOL;

src/Reports/Code.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Code implements Report
3434
*
3535
* @return bool
3636
*/
37-
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
37+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
3838
{
3939
if ($report['errors'] === 0 && $report['warnings'] === 0) {
4040
// Nothing to print.
@@ -340,10 +340,10 @@ public function generate(
340340
int $totalErrors,
341341
int $totalWarnings,
342342
int $totalFixable,
343-
bool $showSources=false,
344-
int $width=80,
345-
bool $interactive=false,
346-
bool $toScreen=true
343+
bool $showSources = false,
344+
int $width = 80,
345+
bool $interactive = false,
346+
bool $toScreen = true
347347
) {
348348
if ($cachedData === '') {
349349
return;

src/Reports/Csv.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Csv implements Report
3030
*
3131
* @return bool
3232
*/
33-
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
33+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
3434
{
3535
if ($report['errors'] === 0 && $report['warnings'] === 0) {
3636
// Nothing to print.
@@ -78,10 +78,10 @@ public function generate(
7878
int $totalErrors,
7979
int $totalWarnings,
8080
int $totalFixable,
81-
bool $showSources=false,
82-
int $width=80,
83-
bool $interactive=false,
84-
bool $toScreen=true
81+
bool $showSources = false,
82+
int $width = 80,
83+
bool $interactive = false,
84+
bool $toScreen = true
8585
) {
8686
echo 'File,Line,Column,Type,Message,Source,Severity,Fixable'.PHP_EOL;
8787
echo $cachedData;

0 commit comments

Comments
 (0)