Skip to content

Commit f78fa6f

Browse files
committed
Merge branch 'feature/girlscouting-various-minor-fixes' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 631f8a2 + c280c14 commit f78fa6f

31 files changed

+52
-56
lines changed

src/Files/File.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,9 +895,9 @@ protected function addMessage($error, $message, $line, $column, $code, $data, $s
895895
// due to the use of the --sniffs command line argument.
896896
if ($includeAll === false
897897
&& ((empty($this->configCache['sniffs']) === false
898-
&& in_array(strtolower($listenerCode), $this->configCache['sniffs']) === false)
898+
&& in_array(strtolower($listenerCode), $this->configCache['sniffs'], true) === false)
899899
|| (empty($this->configCache['exclude']) === false
900-
&& in_array(strtolower($listenerCode), $this->configCache['exclude']) === true))
900+
&& in_array(strtolower($listenerCode), $this->configCache['exclude'], true) === true))
901901
) {
902902
return false;
903903
}
@@ -2346,7 +2346,7 @@ public function hasCondition($stackPtr, $types)
23462346
$conditions = $this->tokens[$stackPtr]['conditions'];
23472347

23482348
foreach ($types as $type) {
2349-
if (in_array($type, $conditions) === true) {
2349+
if (in_array($type, $conditions, true) === true) {
23502350
// We found a token with the required type.
23512351
return true;
23522352
}

src/Files/FileList.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace PHP_CodeSniffer\Files;
1313

14+
use PHP_CodeSniffer\Autoload;
1415
use PHP_CodeSniffer\Util;
1516
use PHP_CodeSniffer\Ruleset;
1617
use PHP_CodeSniffer\Config;
@@ -151,7 +152,7 @@ private function getFilterClass()
151152
throw new DeepExitException($error, 3);
152153
}
153154

154-
$filterClass = \PHP_CodeSniffer\Autoload::loadFile($filename);
155+
$filterClass = Autoload::loadFile($filename);
155156
} else {
156157
$filterClass = '\PHP_CodeSniffer\Filters\\'.$filterType;
157158
}

src/Reports/Notifysend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct()
6868

6969
$showOk = Config::getConfigData('notifysend_showok');
7070
if ($showOk !== null) {
71-
$this->showOk = (boolean) $showOk;
71+
$this->showOk = (bool) $showOk;
7272
}
7373

7474
$this->version = str_replace(

src/Ruleset.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public function processRuleset($rulesetPath, $depth=0)
410410
}
411411
} else if (empty($newSniffs) === false) {
412412
$newSniff = $newSniffs[0];
413-
if (in_array($newSniff, $ownSniffs) === false) {
413+
if (in_array($newSniff, $ownSniffs, true) === false) {
414414
// Including a sniff that hasn't been included higher up, but
415415
// only including a single message from it. So turn off all messages in
416416
// the sniff, except this one.
@@ -578,7 +578,7 @@ public function processRuleset($rulesetPath, $depth=0)
578578
// sniff list, but filter out any excluded sniffs.
579579
$files = [];
580580
foreach ($includedSniffs as $sniff) {
581-
if (in_array($sniff, $excludedSniffs) === true) {
581+
if (in_array($sniff, $excludedSniffs, true) === true) {
582582
continue;
583583
} else {
584584
$files[] = Util\Common::realpath($sniff);
@@ -715,7 +715,7 @@ private function expandRulesetReference($ref, $rulesetDir, $depth=0)
715715
if (Util\Common::isPharFile($path) === true && strpos($path, 'ruleset.xml') === false) {
716716
// If the ruleset exists inside the phar file, use it.
717717
if (file_exists($path.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
718-
$path = $path.DIRECTORY_SEPARATOR.'ruleset.xml';
718+
$path .= DIRECTORY_SEPARATOR.'ruleset.xml';
719719
} else {
720720
$path = null;
721721
}

src/Sniffs/AbstractPatternSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ final public function process(File $phpcsFile, $stackPtr)
195195

196196
$tokens = $phpcsFile->getTokens();
197197

198-
if (in_array($tokens[$stackPtr]['code'], $this->supplementaryTokens) === true) {
198+
if (in_array($tokens[$stackPtr]['code'], $this->supplementaryTokens, true) === true) {
199199
$this->processSupplementary($phpcsFile, $stackPtr);
200200
}
201201

src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function process(File $phpcsFile, $stackPtr)
153153
break;
154154
}
155155

156-
if (in_array($tokens[$end]['code'], $fixableScopeOpeners) === true
156+
if (in_array($tokens[$end]['code'], $fixableScopeOpeners, true) === true
157157
&& isset($tokens[$end]['scope_opener']) === false
158158
) {
159159
// The best way to fix nested inline scopes is middle-out.

src/Standards/Generic/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function register()
4848
}
4949

5050
if ($this->phpVersion < 70000) {
51-
$this->aspTags = (boolean) ini_get('asp_tags');
51+
$this->aspTags = (bool) ini_get('asp_tags');
5252
}
5353

5454
return [

src/Standards/Generic/Sniffs/PHP/DisallowShortOpenTagSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function register()
2929
T_OPEN_TAG_WITH_ECHO,
3030
];
3131

32-
$shortOpenTags = (boolean) ini_get('short_open_tag');
32+
$shortOpenTags = (bool) ini_get('short_open_tag');
3333
if ($shortOpenTags === false) {
3434
$targets[] = T_INLINE_HTML;
3535
}

src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function process(File $phpcsFile, $stackPtr)
173173
// Remove the pattern delimiters and modifier.
174174
$pattern = substr($pattern, 1, -2);
175175
} else {
176-
if (in_array($function, $this->forbiddenFunctionNames) === false) {
176+
if (in_array($function, $this->forbiddenFunctionNames, true) === false) {
177177
return;
178178
}
179179
}//end if

src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ public function process(File $phpcsFile, $stackPtr)
776776

777777
if ($checkToken !== null
778778
&& isset(Tokens::$scopeOpeners[$tokens[$checkToken]['code']]) === true
779-
&& in_array($tokens[$checkToken]['code'], $this->nonIndentingScopes) === false
779+
&& in_array($tokens[$checkToken]['code'], $this->nonIndentingScopes, true) === false
780780
&& isset($tokens[$checkToken]['scope_opener']) === true
781781
) {
782782
$exact = true;
@@ -1133,7 +1133,7 @@ public function process(File $phpcsFile, $stackPtr)
11331133

11341134
$condition = $tokens[$tokens[$i]['scope_condition']]['code'];
11351135
if (isset(Tokens::$scopeOpeners[$condition]) === true
1136-
&& in_array($condition, $this->nonIndentingScopes) === false
1136+
&& in_array($condition, $this->nonIndentingScopes, true) === false
11371137
) {
11381138
if ($this->debug === true) {
11391139
$line = $tokens[$i]['line'];

0 commit comments

Comments
 (0)