Skip to content

Commit

Permalink
Merge pull request #339 from PHPCSStandards/feature/various-minor-cs-…
Browse files Browse the repository at this point in the history
…cleanup

CS: various minor fixes
  • Loading branch information
jrfnl committed Feb 15, 2024
2 parents 814896b + 479b4dc commit 3e582fe
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getErrorList($testFile='')
];

case 'DisallowTabIndentUnitTest.3.inc':
if (\PHP_VERSION_ID >= 70300) {
if (PHP_VERSION_ID >= 70300) {
return [
7 => 1,
13 => 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function process(File $phpcsFile, $stackPtr)
$indent = str_repeat(' ', ($tokens[$first]['column'] - 1));
$phpcsFile->fixer->beginChangeset();

if ($tokens[($prev + 1)]['code'] === \T_WHITESPACE) {
if ($tokens[($prev + 1)]['code'] === T_WHITESPACE) {
$phpcsFile->fixer->replaceToken(($prev + 1), '');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Squiz/Sniffs/PHP/InnerFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function process(File $phpcsFile, $stackPtr)
break;
}

if (\array_key_exists($condition, Tokens::$ooScopeTokens) === true) {
if (array_key_exists($condition, Tokens::$ooScopeTokens) === true) {
// Ignore methods in OOP structures defined within functions.
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function process(File $phpcsFile, $stackPtr)
}

// Skip HTML whitespace.
if ($tokens[$i]['code'] === T_INLINE_HTML && \trim($tokens[$i]['content']) === '') {
if ($tokens[$i]['code'] === T_INLINE_HTML && trim($tokens[$i]['content']) === '') {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -3106,7 +3106,7 @@ protected function processAdditional()
}

if ($suspectedType === 'property or parameter') {
unset($allowed[\T_STATIC]);
unset($allowed[T_STATIC]);
}

$typeTokenCount = 0;
Expand Down
1 change: 0 additions & 1 deletion tests/Core/AbstractMethodUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Tests\ConfigDouble;
use PHPUnit\Framework\TestCase;
use ReflectionProperty;

abstract class AbstractMethodUnitTest extends TestCase
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Core/File/GetClassPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public static function dataNotAClassException()
return [
'interface' => [
'testMarker' => '/* testNotAClass */',
'tokenType' => \T_INTERFACE,
'tokenType' => T_INTERFACE,
],
'anon-class' => [
'testMarker' => '/* testAnonClass */',
'tokenType' => \T_ANON_CLASS,
'tokenType' => T_ANON_CLASS,
],
'enum' => [
'testMarker' => '/* testEnum */',
'tokenType' => \T_ENUM,
'tokenType' => T_ENUM,
],
];

Expand All @@ -79,7 +79,7 @@ public static function dataNotAClassException()
*/
public function testGetClassProperties($testMarker, $expected)
{
$class = $this->getTargetToken($testMarker, \T_CLASS);
$class = $this->getTargetToken($testMarker, T_CLASS);
$result = self::$phpcsFile->getClassProperties($class);
$this->assertSame($expected, $result);

Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Filters/AbstractFilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function getMockedClass($className, array $constructorArgs=[], $method
{
$mockedObj = $this->getMockBuilder($className);

if (\method_exists($mockedObj, 'onlyMethods') === true) {
if (method_exists($mockedObj, 'onlyMethods') === true) {
// PHPUnit 8+.
if (is_array($methodsToMock) === true) {
return $mockedObj
Expand Down
1 change: 0 additions & 1 deletion tests/Core/Filters/Filter/AcceptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace PHP_CodeSniffer\Tests\Core\Filters\Filter;

use PHP_CodeSniffer\Config;
use PHP_CodeSniffer\Filters\Filter;
use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Tests\ConfigDouble;
Expand Down

0 comments on commit 3e582fe

Please sign in to comment.