Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS: various minor fixes #339

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading