Skip to content

Commit 6f33e27

Browse files
committed
CS/QA: various minor fixes
* Use the correct case for functions. * Don't return result of a `void` function. * A few type consistency fixes.
1 parent c93eb90 commit 6f33e27

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed

src/Ruleset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ public function processRuleset($rulesetPath, $depth=0)
572572
$autoloadPath = (string) $autoload;
573573

574574
// Try relative autoload paths first.
575-
$relativePath = Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
575+
$relativePath = Common::realpath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
576576

577577
if ($relativePath !== false && is_file($relativePath) === true) {
578578
$autoloadPath = $relativePath;

src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function process(File $phpcsFile, $stackPtr)
152152
for ($i = $openingBrace; $i > $prev; $i--) {
153153
if ($tokens[$i]['line'] === $tokens[$openingBrace]['line']) {
154154
if ($tokens[$i]['column'] === 1) {
155-
$phpcsFile->fixer->addNewLineBefore($i);
155+
$phpcsFile->fixer->addNewlineBefore($i);
156156
}
157157

158158
continue;

src/Standards/PSR12/Sniffs/ControlStructures/ControlStructureSpacingSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public function process(File $phpcsFile, $stackPtr)
8787

8888
if ($tokens[$parenOpener]['line'] === $tokens[$parenCloser]['line']) {
8989
// Conditions are all on the same line, so follow PSR2.
90-
return $this->psr2ControlStructureSpacing->process($phpcsFile, $stackPtr);
90+
$this->psr2ControlStructureSpacing->process($phpcsFile, $stackPtr);
91+
return;
9192
}
9293

9394
$next = $phpcsFile->findNext(T_WHITESPACE, ($parenOpener + 1), $parenCloser, true);

src/Standards/PSR12/Sniffs/Files/DeclareStatementSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function process(File $phpcsFile, $stackPtr)
249249
$phpcsFile->fixer->replaceToken($i, '');
250250
}
251251

252-
$phpcsFile->fixer->addNewLineBefore($token);
252+
$phpcsFile->fixer->addNewlineBefore($token);
253253

254254
$phpcsFile->fixer->endChangeset();
255255
}

src/Standards/PSR2/Sniffs/ControlStructures/SwitchDeclarationSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function process(File $phpcsFile, $stackPtr)
152152
$error = 'Terminating statement must be on a line by itself';
153153
$fix = $phpcsFile->addFixableError($error, $nextCloser, 'BreakNotNewLine');
154154
if ($fix === true) {
155-
$phpcsFile->fixer->addNewLine($prev);
155+
$phpcsFile->fixer->addNewline($prev);
156156
$phpcsFile->fixer->replaceToken($nextCloser, trim($tokens[$nextCloser]['content']));
157157
}
158158
} else {

src/Util/Standards.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function getInstalledStandardPaths()
3636
$resolvedInstalledPaths = [];
3737
foreach ($installedPaths as $installedPath) {
3838
if (substr($installedPath, 0, 1) === '.') {
39-
$installedPath = Common::realPath(__DIR__.$ds.'..'.$ds.'..'.$ds.$installedPath);
39+
$installedPath = Common::realpath(__DIR__.$ds.'..'.$ds.'..'.$ds.$installedPath);
4040
if ($installedPath === false) {
4141
continue;
4242
}
@@ -239,7 +239,7 @@ public static function isInstalledStandard($standard)
239239
} else {
240240
// This could be a custom standard, installed outside our
241241
// standards directory.
242-
$standard = Common::realPath($standard);
242+
$standard = Common::realpath($standard);
243243
if ($standard === false) {
244244
return false;
245245
}

tests/Core/File/GetConditionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function setUpCaches()
153153
*/
154154
public function testNonExistentToken()
155155
{
156-
$result = self::$phpcsFile->getCondition(100000, Tokens::$ooScopeTokens);
156+
$result = self::$phpcsFile->getCondition(100000, T_CLASS);
157157
$this->assertFalse($result);
158158

159159
$result = self::$phpcsFile->hasCondition(100000, T_IF);

tests/Core/Tokenizers/Tokenizer/RecurseScopeMapWithNamespaceOperatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class RecurseScopeMapWithNamespaceOperatorTest extends AbstractTokenizerTe
2828
*
2929
* @return void
3030
*/
31-
public function testScopeSetting($testMarker, $tokenTypes, $open=T_OPEN_CURLY_BRACKET, $close=T_CLOSE_CURLY_BRACKET)
31+
public function testScopeSetting($testMarker, $tokenTypes, $open=[T_OPEN_CURLY_BRACKET], $close=[T_CLOSE_CURLY_BRACKET])
3232
{
3333
$tokens = $this->phpcsFile->getTokens();
3434

0 commit comments

Comments
 (0)