Skip to content

Commit ec02431

Browse files
authored
Merge pull request #140 from PHPCSStandards/feature/various-minor-tweaks
Various minor tweaks
2 parents fc924ab + e4a3ccb commit ec02431

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

PHPCSUtils/BackCompat/Helper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
namespace PHPCSUtils\BackCompat;
1212

13-
use PHP_CodeSniffer\Files\File;
1413
use PHP_CodeSniffer\Exceptions\RuntimeException;
14+
use PHP_CodeSniffer\Files\File;
1515

1616
/**
1717
* Utility methods to retrieve (configuration) information from PHP_CodeSniffer.
@@ -86,7 +86,7 @@ public static function setConfigData($key, $value, $temp = false, $config = null
8686
return $config->setConfigData($key, $value, $temp);
8787
}
8888

89-
if (version_compare(self::getVersion(), '3.99.99', '>') === true) {
89+
if (\version_compare(self::getVersion(), '3.99.99', '>') === true) {
9090
throw new RuntimeException('Passing the $config parameter is required in PHPCS 4.x');
9191
}
9292

@@ -183,7 +183,7 @@ public static function getEncoding(File $phpcsFile = null)
183183

184184
if (isset($default) === false) {
185185
$default = 'utf-8';
186-
if (version_compare(self::getVersion(), '2.99.99', '<=') === true) {
186+
if (\version_compare(self::getVersion(), '2.99.99', '<=') === true) {
187187
// In PHPCS 2.x, the default encoding is `iso-8859-1`.
188188
$default = 'iso-8859-1';
189189
}

PHPCSUtils/Utils/NamingConventions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class NamingConventions
6666
*/
6767
public static function isValidIdentifierName($name)
6868
{
69-
if (is_string($name) === false || $name === '' || \strpos($name, ' ') !== false) {
69+
if (\is_string($name) === false || $name === '' || \strpos($name, ' ') !== false) {
7070
return false;
7171
}
7272

PHPCSUtils/Utils/Numbers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public static function getCompleteNumber(File $phpcsFile, $stackPtr)
254254

255255
while (isset($tokens[++$next], self::$numericLiteralAcceptedTokens[$tokens[$next]['code']]) === true) {
256256
if ($tokens[$next]['code'] === \T_STRING
257-
&& \preg_match($regex, $tokens[$next]['content'], $matches) !== 1
257+
&& \preg_match($regex, $tokens[$next]['content']) !== 1
258258
) {
259259
break;
260260
}

PHPCSUtils/Utils/TextStrings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static function getCompleteTextString(File $phpcsFile, $stackPtr, $stripQ
9393

9494
if ($stripNewline === true) {
9595
// Heredoc/nowdoc: strip the new line at the end of the string to emulate how PHP sees the string.
96-
$string = rtrim($string, "\r\n");
96+
$string = \rtrim($string, "\r\n");
9797
}
9898

9999
if ($stripQuotes === true) {

Tests/BackCompat/Helper/ConfigDataTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ConfigDataTest extends TestCase
3434
*/
3535
public function testConfigData34()
3636
{
37-
if (version_compare(Helper::getVersion(), '2.99.99', '<=') === true) {
37+
if (\version_compare(Helper::getVersion(), '2.99.99', '<=') === true) {
3838
$this->markTestSkipped('Test only applicable to PHPCS > 2.x');
3939
}
4040

@@ -59,7 +59,7 @@ public function testConfigData34()
5959
*/
6060
public function testConfigDataPHPCS23()
6161
{
62-
if (version_compare(Helper::getVersion(), '3.99.99', '>') === true) {
62+
if (\version_compare(Helper::getVersion(), '3.99.99', '>') === true) {
6363
$this->markTestSkipped('Test only applicable to PHPCS < 4.x');
6464
}
6565

@@ -83,7 +83,7 @@ public function testConfigDataPHPCS23()
8383
*/
8484
public function testConfigDataPHPCS4Exception()
8585
{
86-
if (version_compare(Helper::getVersion(), '3.99.99', '<=') === true) {
86+
if (\version_compare(Helper::getVersion(), '3.99.99', '<=') === true) {
8787
$this->markTestSkipped('Test only applicable to PHPCS 4.x');
8888
}
8989

Tests/BackCompat/Helper/GetVersionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GetVersionTest extends TestCase
3232
*
3333
* @var string
3434
*/
35-
const DEVMASTER = '3.5.4';
35+
const DEVMASTER = '3.5.6';
3636

3737
/**
3838
* Test the method.

Tests/Fixers/SpacesFixer/SpacesFixerNoSpaceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SpacesFixerNoSpaceTest extends UtilityMethodTestCase
5353
*
5454
* @var string
5555
*/
56-
const CODE = 'PHPCSUtils.SpacerFixer.Test.Found';
56+
const CODE = 'PHPCSUtils.SpacesFixer.Test.Found';
5757

5858
/**
5959
* Dummy metric name to use for the test.
@@ -88,7 +88,7 @@ class SpacesFixerNoSpaceTest extends UtilityMethodTestCase
8888
*
8989
* @var array
9090
*/
91-
protected static $selectedSniff = ['PHPCSUtils.SpacerFixer.Test'];
91+
protected static $selectedSniff = ['PHPCSUtils.SpacesFixer.Test'];
9292

9393
/**
9494
* Initialize PHPCS & tokenize the test case file.

Tests/Fixers/SpacesFixer/TrailingCommentHandlingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class TrailingCommentHandlingTest extends UtilityMethodTestCase
5353
*
5454
* @var string
5555
*/
56-
const CODE = 'PHPCSUtils.SpacerFixer.Test.Found';
56+
const CODE = 'PHPCSUtils.SpacesFixer.Test.Found';
5757

5858
/**
5959
* Dummy metric name to use for the test.
@@ -67,7 +67,7 @@ class TrailingCommentHandlingTest extends UtilityMethodTestCase
6767
*
6868
* @var array
6969
*/
70-
protected static $selectedSniff = ['PHPCSUtils.SpacerFixer.Test'];
70+
protected static $selectedSniff = ['PHPCSUtils.SpacesFixer.Test'];
7171

7272
/**
7373
* Test that violations are correctly reported.

Tests/Tokens/Collections/ArrowFunctionTokensBCTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public function testArrowFunctionTokensBC()
4444
$expected[\T_FN] = \T_FN;
4545
}
4646

47-
$this->assertSame($expected, Collections::ArrowFunctionTokensBC());
47+
$this->assertSame($expected, Collections::arrowFunctionTokensBC());
4848
}
4949
}

0 commit comments

Comments
 (0)