Skip to content

Commit

Permalink
See if this improves things
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Apr 11, 2022
1 parent 714687a commit 66ea260
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
12 changes: 4 additions & 8 deletions PHPCSUtils/BackCompat/Helper.php
Expand Up @@ -182,14 +182,10 @@ public static function getTabWidth(File $phpcsFile)
*/
public static function getEncoding(File $phpcsFile = null)
{
static $default;

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

if ($phpcsFile instanceof File) {
Expand Down
7 changes: 1 addition & 6 deletions PHPCSUtils/Utils/MessageHelper.php
Expand Up @@ -120,12 +120,7 @@ public static function stringToErrorcode($text)
*/
public static function hasNewLineSupport()
{
static $supported;
if (isset($supported) === false) {
$supported = \version_compare(Helper::getVersion(), '3.3.1', '>=');
}

return $supported;
return \version_compare(Helper::getVersion(), '3.3.1', '>=');
}

/**
Expand Down
8 changes: 2 additions & 6 deletions PHPCSUtils/Utils/Orthography.php
Expand Up @@ -102,13 +102,9 @@ public static function isFirstCharLowercase($textString)
*/
public static function isLastCharPunctuation($textString, $allowedChars = self::TERMINAL_POINTS)
{
static $encoding;

if (isset($encoding) === false) {
$encoding = Helper::getEncoding();
}

$encoding = Helper::getEncoding();
$textString = \rtrim($textString);

if (\function_exists('iconv_substr') === true) {
$lastChar = \iconv_substr($textString, -1, 1, $encoding);
} else {
Expand Down
6 changes: 6 additions & 0 deletions Tests/BackCompat/BCTokens/EmptyTokensTest.php
Expand Up @@ -18,8 +18,14 @@
/**
* Test class.
*
* These tests should be run in a separate process to allow for code coverage to be
* recorded for the setting of function local static variables.
*
* @group tokens
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*
* @since 1.0.0
*/
class EmptyTokensTest extends TestCase
Expand Down
6 changes: 6 additions & 0 deletions Tests/Utils/Namespaces/NamespaceTypeTest.php
Expand Up @@ -18,12 +18,18 @@
* \PHPCSUtils\Utils\Namespaces::isOperator() and the.
* \PHPCSUtils\Utils\Namespaces::getType() methods.
*
* These tests should be run in a separate process to allow for code coverage to be
* recorded for the setting of function local static variables.
*
* @covers \PHPCSUtils\Utils\Namespaces::isDeclaration
* @covers \PHPCSUtils\Utils\Namespaces::isOperator
* @covers \PHPCSUtils\Utils\Namespaces::getType
*
* @group namespaces
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*
* @since 1.0.0
*/
class NamespaceTypeTest extends UtilityMethodTestCase
Expand Down
6 changes: 6 additions & 0 deletions Tests/Utils/Numbers/GetCompleteNumberTest.php
Expand Up @@ -17,10 +17,16 @@
/**
* Tests for the \PHPCSUtils\Utils\Numbers::getCompleteNumber() method.
*
* These tests should be run in a separate process to allow for code coverage to be
* recorded for the setting of function local static variables.
*
* @covers \PHPCSUtils\Utils\Numbers::getCompleteNumber
*
* @group numbers
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*
* @since 1.0.0
*/
class GetCompleteNumberTest extends UtilityMethodTestCase
Expand Down

0 comments on commit 66ea260

Please sign in to comment.