Browse Source

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
span
J. King 6 years ago
parent
commit
e683167905
  1. 2
      .php_cs.dist
  2. 2
      lib/Encoding/GBCommon.php
  3. 2
      tests/cases/Encoding/TestGB18030.php
  4. 2
      tests/cases/Encoding/TestSingleByte.php
  5. 3
      tests/lib/EncodingTest.php

2
.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",

2
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) {

2
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"],

2
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 = [

3
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);

Loading…
Cancel
Save