From e683167905c4d2b1715826bb79b0a84696eadb48 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Wed, 29 Aug 2018 23:47:42 -0400 Subject: [PATCH] Style fixes Because of the large arrays in the GBCommon class and its test suite, memory limits had to be disabled in php-cs-fixer --- .php_cs.dist | 2 ++ lib/Encoding/GBCommon.php | 2 +- tests/cases/Encoding/TestGB18030.php | 2 +- tests/cases/Encoding/TestSingleByte.php | 2 +- tests/lib/EncodingTest.php | 3 +-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index d39f997..ea58175 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -7,6 +7,8 @@ namespace MensBeam\UTF8; const BASE = __DIR__.DIRECTORY_SEPARATOR; +ini_set("memory_limit", "-1"); + $paths = [ __FILE__, BASE."RoboFile.php", diff --git a/lib/Encoding/GBCommon.php b/lib/Encoding/GBCommon.php index 7df62c9..108c13b 100644 --- a/lib/Encoding/GBCommon.php +++ b/lib/Encoding/GBCommon.php @@ -26,7 +26,7 @@ abstract class GBCommon implements StatelessEncoding { $second = 0; $third = 0; $this->posChar++; - while(($b = @$this->string[$this->posByte++]) !== "") { + while (($b = @$this->string[$this->posByte++]) !== "") { $b = ord($b); if ($first === 0) { if ($b < 0x80) { diff --git a/tests/cases/Encoding/TestGB18030.php b/tests/cases/Encoding/TestGB18030.php index 5b0a376..729bb09 100644 --- a/tests/cases/Encoding/TestGB18030.php +++ b/tests/cases/Encoding/TestGB18030.php @@ -136,7 +136,7 @@ class TestGB18030 extends \MensBeam\Intl\Test\EncodingTest { public function provideCodePoints() { // bytes confirmed using Firefox - $series = [ + $series = [ "GBK ASCII (fatal)" => [GBK::class, true, 0x64, "64"], "GBK 0x20AC (fatal)" => [GBK::class, true, 0x20AC, "80"], "GBK 0x2164 (fatal)" => [GBK::class, true, 0x2164, "A2 F5"], diff --git a/tests/cases/Encoding/TestSingleByte.php b/tests/cases/Encoding/TestSingleByte.php index ec4d9bb..c2ea422 100644 --- a/tests/cases/Encoding/TestSingleByte.php +++ b/tests/cases/Encoding/TestSingleByte.php @@ -10,7 +10,7 @@ use MensBeam\Intl\Encoding\SingleByteEncoding; use MensBeam\Intl\Encoding\EncoderException; use MensBeam\Intl\Encoding\DecoderException; -class TestSingleByte extends \MensBeam\Intl\Test\EncodingTest { +class TestSingleByte extends \MensBeam\Intl\Test\EncodingTest { // maps taken from https://github.com/web-platform-tests/wpt/blob/d6c29bef8d4bcdfe4f689defca73360b07647d71/encoding/single-byte-decoder.html // ISO-8859-8 was duplicated for ISO-8859-8-I protected static $maps = [ diff --git a/tests/lib/EncodingTest.php b/tests/lib/EncodingTest.php index be7932a..b6d6df8 100644 --- a/tests/lib/EncodingTest.php +++ b/tests/lib/EncodingTest.php @@ -10,7 +10,6 @@ use MensBeam\Intl\Encoding\EncoderException; use MensBeam\Intl\Encoding\DecoderException; abstract class EncodingTest extends \PHPUnit\Framework\TestCase { - public function testEncodeCodePoints(bool $fatal, $input, $exp) { $class = $this->testedClass; if ($exp instanceof \Throwable) { @@ -60,7 +59,7 @@ abstract class EncodingTest extends \PHPUnit\Framework\TestCase { $exp = array_reverse($exp); $act = []; while ($s->nextCode() !== false); - while($s->posByte()) { + while ($s->posByte()) { $s->seek(-1); $act[] = $s->nextCode(); $s->seek(-1);