Loading src/Engine/Decoder.php +6 −6 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ final class Decoder $this->stream = $stream; $this->options = array_merge(self::DEFAULT_OPTIONS, $options); if (!is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { if (!\is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { throw new InvalidArgumentException('Input is not a valid stream'); } } Loading Loading @@ -210,7 +210,7 @@ final class Decoder $str = $len === 0 ? '' : fread($this->stream, $len); if (strlen($str) !== $len) { if (\strlen($str) !== $len) { throw new ParseErrorException('Unexpected end of file while processing string'); } Loading Loading @@ -250,12 +250,12 @@ final class Decoder $prevKey = null; // we have an array [key1, value1, key2, value2, key3, value3, ...] while (count($this->value)) { while (\count($this->value)) { $dictKey = array_shift($this->value); if (is_string($dictKey) === false) { if (\is_string($dictKey) === false) { throw new ParseErrorException('Non string key found in the dictionary'); } if (count($this->value) === 0) { if (\count($this->value) === 0) { throw new ParseErrorException("Dictionary key without corresponding value: '{$dictKey}'"); } if ($prevKey && strcmp($prevKey, $dictKey) >= 0) { Loading Loading @@ -331,7 +331,7 @@ final class Decoder } if (is_callable($type)) { return call_user_func($type, $array); return \call_user_func($type, $array); } if (class_exists($type)) { Loading src/Engine/Encoder.php +6 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ final class Encoder $this->data = $data; $this->stream = $stream; if (!is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { if (!\is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { throw new InvalidArgumentException('Output is not a valid stream'); } } Loading @@ -56,7 +56,7 @@ final class Encoder // true is converted to integer 1 case $value === true: case is_int($value): case \is_int($value): case $value instanceof BigIntType: case $value instanceof \GMP: case $value instanceof BigInteger: Loading @@ -65,11 +65,11 @@ final class Encoder break; // process arrays case is_array($value): case \is_array($value): $this->encodeArray($value); break; case is_object($value): case \is_object($value): $this->encodeObject($value); break; Loading Loading @@ -127,7 +127,7 @@ final class Encoder { $string = (string)$string; fwrite($this->stream, (string)strlen($string)); fwrite($this->stream, (string)\strlen($string)); fwrite($this->stream, ':'); fwrite($this->stream, $string); } Loading Loading @@ -157,7 +157,7 @@ final class Encoder } // do not use php array keys here to prevent numeric strings becoming integers again $dictData[] = [strval($key), $value]; $dictData[] = [\strval($key), $value]; } // sort by keys - rfc requirement Loading src/Types/ListType.php +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ final class ListType implements \IteratorAggregate { // Cannot typehint iterable in PHP 7.0 // so wrap array with ArrayIterator and then typehint Traversable if (is_array($iterable)) { if (\is_array($iterable)) { $iterable = new \ArrayIterator($iterable); } Loading src/Util/Util.php +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ final class Util // false and empty string will be 0 and the test will pass // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated $funcOverload = intval(ini_get('mbstring.func_overload')); $funcOverload = \intval(ini_get('mbstring.func_overload')); if ($funcOverload & self::MBSTRING_OVERLOAD_CONFLICT) { // @codeCoverageIgnoreStart Loading tests/BigIntTypeTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ class BigIntTypeTest extends TestCase { $int = new BigIntType('123'); self::assertEquals(gmp_init('123'), $int->toGMP()); self::assertEquals(\gmp_init('123'), $int->toGMP()); self::assertEquals(true, (new \Math_BigInteger('123'))->equals($int->toPear())); self::assertEquals(true, BigInteger::of('123')->isEqualTo($int->toBrickMath())); } Loading Loading
src/Engine/Decoder.php +6 −6 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ final class Decoder $this->stream = $stream; $this->options = array_merge(self::DEFAULT_OPTIONS, $options); if (!is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { if (!\is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { throw new InvalidArgumentException('Input is not a valid stream'); } } Loading Loading @@ -210,7 +210,7 @@ final class Decoder $str = $len === 0 ? '' : fread($this->stream, $len); if (strlen($str) !== $len) { if (\strlen($str) !== $len) { throw new ParseErrorException('Unexpected end of file while processing string'); } Loading Loading @@ -250,12 +250,12 @@ final class Decoder $prevKey = null; // we have an array [key1, value1, key2, value2, key3, value3, ...] while (count($this->value)) { while (\count($this->value)) { $dictKey = array_shift($this->value); if (is_string($dictKey) === false) { if (\is_string($dictKey) === false) { throw new ParseErrorException('Non string key found in the dictionary'); } if (count($this->value) === 0) { if (\count($this->value) === 0) { throw new ParseErrorException("Dictionary key without corresponding value: '{$dictKey}'"); } if ($prevKey && strcmp($prevKey, $dictKey) >= 0) { Loading Loading @@ -331,7 +331,7 @@ final class Decoder } if (is_callable($type)) { return call_user_func($type, $array); return \call_user_func($type, $array); } if (class_exists($type)) { Loading
src/Engine/Encoder.php +6 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ final class Encoder $this->data = $data; $this->stream = $stream; if (!is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { if (!\is_resource($this->stream) || get_resource_type($this->stream) !== 'stream') { throw new InvalidArgumentException('Output is not a valid stream'); } } Loading @@ -56,7 +56,7 @@ final class Encoder // true is converted to integer 1 case $value === true: case is_int($value): case \is_int($value): case $value instanceof BigIntType: case $value instanceof \GMP: case $value instanceof BigInteger: Loading @@ -65,11 +65,11 @@ final class Encoder break; // process arrays case is_array($value): case \is_array($value): $this->encodeArray($value); break; case is_object($value): case \is_object($value): $this->encodeObject($value); break; Loading Loading @@ -127,7 +127,7 @@ final class Encoder { $string = (string)$string; fwrite($this->stream, (string)strlen($string)); fwrite($this->stream, (string)\strlen($string)); fwrite($this->stream, ':'); fwrite($this->stream, $string); } Loading Loading @@ -157,7 +157,7 @@ final class Encoder } // do not use php array keys here to prevent numeric strings becoming integers again $dictData[] = [strval($key), $value]; $dictData[] = [\strval($key), $value]; } // sort by keys - rfc requirement Loading
src/Types/ListType.php +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ final class ListType implements \IteratorAggregate { // Cannot typehint iterable in PHP 7.0 // so wrap array with ArrayIterator and then typehint Traversable if (is_array($iterable)) { if (\is_array($iterable)) { $iterable = new \ArrayIterator($iterable); } Loading
src/Util/Util.php +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ final class Util // false and empty string will be 0 and the test will pass // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated $funcOverload = intval(ini_get('mbstring.func_overload')); $funcOverload = \intval(ini_get('mbstring.func_overload')); if ($funcOverload & self::MBSTRING_OVERLOAD_CONFLICT) { // @codeCoverageIgnoreStart Loading
tests/BigIntTypeTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ class BigIntTypeTest extends TestCase { $int = new BigIntType('123'); self::assertEquals(gmp_init('123'), $int->toGMP()); self::assertEquals(\gmp_init('123'), $int->toGMP()); self::assertEquals(true, (new \Math_BigInteger('123'))->equals($int->toPear())); self::assertEquals(true, BigInteger::of('123')->isEqualTo($int->toBrickMath())); } Loading