Browse Source

Apply stricter house style where possible

multi-byte
J. King 4 years ago
parent
commit
befd1feb3a
  1. 63
      .php_cs.dist
  2. 14
      RoboFile.php
  3. 1
      lib/Encoding/Big5.php
  4. 10
      lib/Encoding/Encoding.php
  5. 2
      lib/Encoding/XUserDefined.php
  6. 26
      tests/cases/Encoding/TestBig5.php
  7. 26
      tests/cases/Encoding/TestEUCKR.php
  8. 26
      tests/cases/Encoding/TestGB18030.php
  9. 26
      tests/cases/Encoding/TestSingleByte.php
  10. 22
      tests/cases/Encoding/TestUTF16LE.php
  11. 24
      tests/cases/Encoding/TestUTF8.php
  12. 22
      tests/cases/Encoding/TestXUserDefined.php
  13. 2
      tests/lib/CoderDecoderTest.php

63
.php_cs.dist

@ -4,6 +4,7 @@ declare(strict_types=1);
* Copyright 2018 J. King et al. * Copyright 2018 J. King et al.
* See LICENSE and AUTHORS files for details */ * See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace MensBeam\UTF8; namespace MensBeam\UTF8;
const BASE = __DIR__.DIRECTORY_SEPARATOR; const BASE = __DIR__.DIRECTORY_SEPARATOR;
@ -19,11 +20,63 @@ $paths = [
BASE."tools", BASE."tools",
]; ];
$rules = [ $rules = [
// house rules where PSR series is silent
'align_multiline_comment' => ['comment_type' => "phpdocs_only"],
'array_syntax' => ['syntax' => "short"],
'binary_operator_spaces' => [
//'default' => "single_space",
//'operators' => ['=>' => "align_single_space"],
],
'cast_spaces' => ['space' => "single"],
'concat_space' => ['spacing' => "none"],
//'list_syntax' => ['syntax' => "short"],
'magic_constant_casing' => true,
'magic_method_casing' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,
'no_binary_string' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_extra_blank_lines' => true, // this could probably use more configuration
'no_mixed_echo_print' => ['use' => "echo"],
'no_short_bool_cast' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
'pow_to_exponentiation' => true,
'set_type_to_cast' => true,
'standardize_not_equals' => true,
'trailing_comma_in_multiline_array' => true,
'unary_operator_spaces' => true,
'yoda_style' => false,
// PSR standard to apply
'@PSR2' => true, '@PSR2' => true,
'declare_strict_types' => true, // PSR-12 rules; php-cs-fixer does not yet support PSR-12 natively
'braces' => ['position_after_functions_and_oop_constructs' => "same"], 'compact_nullable_typehint' => true,
'function_declaration' => ['closure_function_spacing' => "none"], 'declare_equal_normalize' => ['space' => "none"],
]; 'function_typehint_space' => true,
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'no_alternative_syntax' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => ['space_before' => "none"],
'single_trait_insert_per_statement' => true,
'short_scalar_cast' => true,
//'visibility_required' => ['elements' => ["const", "property", "method"]],
// house exceptions to PSR rules
'braces' => ['position_after_functions_and_oop_constructs' => "same"],
'function_declaration' => ['closure_function_spacing' => "none"],
'new_with_braces' => false, // no option to specify absence of braces
];
$finder = \PhpCsFixer\Finder::create(); $finder = \PhpCsFixer\Finder::create();
foreach ($paths as $path) { foreach ($paths as $path) {
@ -33,4 +86,4 @@ foreach ($paths as $path) {
$finder = $finder->in($path); $finder = $finder->in($path);
} }
} }
return \PhpCsFixer\Config::create()->setRules($rules)->setFinder($finder); return \PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules($rules)->setFinder($finder);

14
RoboFile.php

@ -25,7 +25,7 @@ class RoboFile extends \Robo\Tasks {
* ./robo test --testsuite TTRSS --exclude-group slow --testdox * ./robo test --testsuite TTRSS --exclude-group slow --testdox
* *
* Please see the PHPUnit documentation for available options. * Please see the PHPUnit documentation for available options.
*/ */
public function test(array $args): Result { public function test(array $args): Result {
return $this->runTests(escapeshellarg(\PHP_BINARY), "typical", $args); return $this->runTests(escapeshellarg(\PHP_BINARY), "typical", $args);
} }
@ -34,7 +34,7 @@ class RoboFile extends \Robo\Tasks {
* *
* This includes pedantic tests which may help to identify problems. * This includes pedantic tests which may help to identify problems.
* See help for the "test" task for more details. * See help for the "test" task for more details.
*/ */
public function testFull(array $args): Result { public function testFull(array $args): Result {
return $this->runTests(escapeshellarg(\PHP_BINARY), "full", $args); return $this->runTests(escapeshellarg(\PHP_BINARY), "full", $args);
} }
@ -43,7 +43,7 @@ class RoboFile extends \Robo\Tasks {
* Runs a quick subset of the test suite * Runs a quick subset of the test suite
* *
* See help for the "test" task for more details. * See help for the "test" task for more details.
*/ */
public function testQuick(array $args): Result { public function testQuick(array $args): Result {
return $this->runTests(escapeshellarg(\PHP_BINARY), "quick", $args); return $this->runTests(escapeshellarg(\PHP_BINARY), "quick", $args);
} }
@ -57,7 +57,7 @@ class RoboFile extends \Robo\Tasks {
* Robo first tries to use phpdbg and will fall back to Xdebug if available. * Robo first tries to use phpdbg and will fall back to Xdebug if available.
* Because Xdebug slows down non-coverage tasks, however, phpdbg is highly * Because Xdebug slows down non-coverage tasks, however, phpdbg is highly
* recommended if debugging facilities are not otherwise needed. * recommended if debugging facilities are not otherwise needed.
*/ */
public function coverage(array $args): Result { public function coverage(array $args): Result {
// run tests with code coverage reporting enabled // run tests with code coverage reporting enabled
$exec = $this->findCoverageEngine(); $exec = $this->findCoverageEngine();
@ -72,7 +72,7 @@ class RoboFile extends \Robo\Tasks {
* run all tests which may cover code. * run all tests which may cover code.
* *
* See also help for the "coverage" task for more details. * See also help for the "coverage" task for more details.
*/ */
public function coverageFull(array $args): Result { public function coverageFull(array $args): Result {
// run tests with code coverage reporting enabled // run tests with code coverage reporting enabled
$exec = $this->findCoverageEngine(); $exec = $this->findCoverageEngine();
@ -93,7 +93,7 @@ class RoboFile extends \Robo\Tasks {
* *
* The performance of the library's basic functionality is tested against * The performance of the library's basic functionality is tested against
* the IntlCodePointBreakIterator class * the IntlCodePointBreakIterator class
*/ */
public function perf(array $args): Result { public function perf(array $args): Result {
$execpath = realpath(norm(BASE."perf/perf.php")); $execpath = realpath(norm(BASE."perf/perf.php"));
return $this->taskExec("php")->arg($execpath)->args($args)->run(); return $this->taskExec("php")->arg($execpath)->args($args)->run();
@ -114,7 +114,7 @@ class RoboFile extends \Robo\Tasks {
} }
} }
protected function runTests(string $executor, string $set, array $args) : Result { protected function runTests(string $executor, string $set, array $args): Result {
switch ($set) { switch ($set) {
case "typical": case "typical":
$set = ["--exclude-group", "optional"]; $set = ["--exclude-group", "optional"];

1
lib/Encoding/Big5.php

@ -22,7 +22,6 @@ class Big5 implements StatelessEncoding {
protected $bufferedCode = 0; protected $bufferedCode = 0;
public function nextCode() { public function nextCode() {
$this->posChar++; $this->posChar++;
if ($this->bufferedCode > 0) { if ($this->bufferedCode > 0) {

10
lib/Encoding/Encoding.php

@ -47,7 +47,7 @@ interface Encoding {
/** Advance $distance characters through the string /** Advance $distance characters through the string
* *
* If the end (or beginning) of the string was reached before the end of the operation, the remaining number of requested characters is returned * If the end (or beginning) of the string was reached before the end of the operation, the remaining number of requested characters is returned
* *
* @param int $distance The number of characters to advance. If negative, the operation will seek back toward the beginning of the string * @param int $distance The number of characters to advance. If negative, the operation will seek back toward the beginning of the string
*/ */
public function seek(int $distance): int; public function seek(int $distance): int;
@ -55,17 +55,17 @@ interface Encoding {
/** Seeks to the start of the string /** Seeks to the start of the string
* *
* This is usually faster than using the seek method for the same purpose * This is usually faster than using the seek method for the same purpose
*/ */
public function rewind(); public function rewind();
/** Retrieves the next $num characters (in UTF-8 encoding) from the string without advancing the character pointer /** Retrieves the next $num characters (in UTF-8 encoding) from the string without advancing the character pointer
* *
* @param int $num The number of characters to retrieve * @param int $num The number of characters to retrieve
*/ */
public function peekChar(int $num = 1): string; public function peekChar(int $num = 1): string;
/** Retrieves the next $num code points from the string, without advancing the character pointer /** Retrieves the next $num code points from the string, without advancing the character pointer
* *
* @param int $num The number of code points to retrieve * @param int $num The number of code points to retrieve
*/ */
public function peekCode(int $num = 1): array; public function peekCode(int $num = 1): array;
@ -76,7 +76,7 @@ interface Encoding {
/** Calculates the length of the string in code points /** Calculates the length of the string in code points
* *
* Note that this may involve processing to the end of the string * Note that this may involve processing to the end of the string
*/ */
public function lenChar(): int; public function lenChar(): int;
/** Returns whether the character pointer is at the end of the string */ /** Returns whether the character pointer is at the end of the string */

2
lib/Encoding/XUserDefined.php

@ -87,7 +87,7 @@ class XUserDefined implements Encoding {
/** Calculates the length of the string in code points /** Calculates the length of the string in code points
* *
* Note that this may involve processing to the end of the string * Note that this may involve processing to the end of the string
*/ */
public function lenChar(): int { public function lenChar(): int {
return $this->lenByte; return $this->lenByte;
} }

26
tests/cases/Encoding/TestBig5.php

File diff suppressed because one or more lines are too long

26
tests/cases/Encoding/TestEUCKR.php

File diff suppressed because one or more lines are too long

26
tests/cases/Encoding/TestGB18030.php

File diff suppressed because one or more lines are too long

26
tests/cases/Encoding/TestSingleByte.php

@ -84,7 +84,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
/** /**
* @dataProvider provideCodePoints * @dataProvider provideCodePoints
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::encode * @covers MensBeam\Intl\Encoding\SingleByteEncoding::encode
*/ */
public function testEncodeCodePoints(bool $fatal, $input, $exp, string $class = SingleByteEncoding::class) { public function testEncodeCodePoints(bool $fatal, $input, $exp, string $class = SingleByteEncoding::class) {
$out = ""; $out = "";
foreach ($input as $code) { foreach ($input as $code) {
@ -97,7 +97,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::__construct * @covers MensBeam\Intl\Encoding\SingleByteEncoding::__construct
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::nextCode * @covers MensBeam\Intl\Encoding\SingleByteEncoding::nextCode
*/ */
public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp, string $class = SingleByteEncoding::class) { public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp, string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp); return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp);
@ -107,7 +107,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::__construct * @covers MensBeam\Intl\Encoding\SingleByteEncoding::__construct
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::nextChar * @covers MensBeam\Intl\Encoding\SingleByteEncoding::nextChar
*/ */
public function testDecodeMultipleCharactersAsStrings(string $input, array $exp, string $class = SingleByteEncoding::class) { public function testDecodeMultipleCharactersAsStrings(string $input, array $exp, string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testDecodeMultipleCharactersAsStrings($input, $exp); return parent::testDecodeMultipleCharactersAsStrings($input, $exp);
@ -116,7 +116,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @coversNothing * @coversNothing
*/ */
public function testSTepBackThroughAString(string $input, array $exp, string $class = SingleByteEncoding::class) { public function testSTepBackThroughAString(string $input, array $exp, string $class = SingleByteEncoding::class) {
// this test has no meaning for single-byte encodings // this test has no meaning for single-byte encodings
$this->testedClass = $class; $this->testedClass = $class;
@ -129,7 +129,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::posChar * @covers MensBeam\Intl\Encoding\SingleByteEncoding::posChar
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte * @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::rewind * @covers MensBeam\Intl\Encoding\SingleByteEncoding::rewind
*/ */
public function testSeekThroughAString(string $class = SingleByteEncoding::class) { public function testSeekThroughAString(string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testSeekThroughAString(); return parent::testSeekThroughAString();
@ -140,7 +140,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::posChar * @covers MensBeam\Intl\Encoding\SingleByteEncoding::posChar
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte * @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::eof * @covers MensBeam\Intl\Encoding\SingleByteEncoding::eof
*/ */
public function testTraversePastTheEndOfAString(string $class = SingleByteEncoding::class) { public function testTraversePastTheEndOfAString(string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testTraversePastTheEndOfAString(); return parent::testTraversePastTheEndOfAString();
@ -153,7 +153,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte * @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateSave * @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateSave
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateApply * @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateApply
*/ */
public function testPeekAtCharacters(string $class = SingleByteEncoding::class) { public function testPeekAtCharacters(string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testPeekAtCharacters(); return parent::testPeekAtCharacters();
@ -166,7 +166,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte * @covers MensBeam\Intl\Encoding\SingleByteEncoding::posByte
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateSave * @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateSave
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateApply * @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateApply
*/ */
public function testPeekAtCodePoints(string $class = SingleByteEncoding::class) { public function testPeekAtCodePoints(string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testPeekAtCodePoints(); return parent::testPeekAtCodePoints();
@ -178,7 +178,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::lenByte * @covers MensBeam\Intl\Encoding\SingleByteEncoding::lenByte
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateSave * @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateSave
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateApply * @covers MensBeam\Intl\Encoding\SingleByteEncoding::stateApply
*/ */
public function testGetStringLength(string $input, array $points, string $class = SingleByteEncoding::class) { public function testGetStringLength(string $input, array $points, string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testGetStringLength($input, $points); return parent::testGetStringLength($input, $points);
@ -187,7 +187,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
/** /**
* @dataProvider provideBrokenStrings * @dataProvider provideBrokenStrings
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::err * @covers MensBeam\Intl\Encoding\SingleByteEncoding::err
*/ */
public function testReplacementModes(string $input = "", string $class = SingleByteEncoding::class) { public function testReplacementModes(string $input = "", string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
$this->brokenChar = $input; $this->brokenChar = $input;
@ -199,7 +199,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::rewind * @covers MensBeam\Intl\Encoding\SingleByteEncoding::rewind
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::chars * @covers MensBeam\Intl\Encoding\SingleByteEncoding::chars
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::codes * @covers MensBeam\Intl\Encoding\SingleByteEncoding::codes
*/ */
public function testIterateThroughAString(string $input, array $exp, string $class = SingleByteEncoding::class) { public function testIterateThroughAString(string $input, array $exp, string $class = SingleByteEncoding::class) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testIterateThroughAString($input, $exp); return parent::testIterateThroughAString($input, $exp);
@ -208,7 +208,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @coversNothing * @coversNothing
*/ */
public function testIterateThroughAStringAllowingSurrogates(string $input, array $exp, $class = null) { public function testIterateThroughAStringAllowingSurrogates(string $input, array $exp, $class = null) {
$this->testedClass = $class; $this->testedClass = $class;
return parent::testIterateThroughAStringAllowingSurrogates($input, $exp, $exp); return parent::testIterateThroughAStringAllowingSurrogates($input, $exp, $exp);
@ -287,7 +287,7 @@ class TestSingleByte extends \MensBeam\Intl\Test\CoderDecoderTest {
* @dataProvider provideInvalids * @dataProvider provideInvalids
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::encode * @covers MensBeam\Intl\Encoding\SingleByteEncoding::encode
* @covers MensBeam\Intl\Encoding\SingleByteEncoding::err * @covers MensBeam\Intl\Encoding\SingleByteEncoding::err
*/ */
public function testEncodeInvalidCodePoints(string $class, bool $mode, int $input, $exp) { public function testEncodeInvalidCodePoints(string $class, bool $mode, int $input, $exp) {
if ($exp instanceof \Throwable) { if ($exp instanceof \Throwable) {
$this->expectException(get_class($exp)); $this->expectException(get_class($exp));

22
tests/cases/Encoding/TestUTF16LE.php

@ -31,7 +31,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF16::__construct * @covers MensBeam\Intl\Encoding\UTF16::__construct
* @covers MensBeam\Intl\Encoding\UTF16::nextCode * @covers MensBeam\Intl\Encoding\UTF16::nextCode
*/ */
public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp) { public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp) {
return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp); return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp);
} }
@ -40,7 +40,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF16::__construct * @covers MensBeam\Intl\Encoding\UTF16::__construct
* @covers MensBeam\Intl\Encoding\UTF16::nextChar * @covers MensBeam\Intl\Encoding\UTF16::nextChar
*/ */
public function testDecodeMultipleCharactersAsStrings(string $input, array $exp) { public function testDecodeMultipleCharactersAsStrings(string $input, array $exp) {
return parent::testDecodeMultipleCharactersAsStrings($input, $exp); return parent::testDecodeMultipleCharactersAsStrings($input, $exp);
} }
@ -48,7 +48,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF16::seekBack * @covers MensBeam\Intl\Encoding\UTF16::seekBack
*/ */
public function testSTepBackThroughAString(string $input, array $exp) { public function testSTepBackThroughAString(string $input, array $exp) {
return parent::testSTepBackThroughAString($input, $exp); return parent::testSTepBackThroughAString($input, $exp);
} }
@ -58,7 +58,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\UTF16::posChar * @covers MensBeam\Intl\Encoding\UTF16::posChar
* @covers MensBeam\Intl\Encoding\UTF16::posByte * @covers MensBeam\Intl\Encoding\UTF16::posByte
* @covers MensBeam\Intl\Encoding\UTF16::rewind * @covers MensBeam\Intl\Encoding\UTF16::rewind
*/ */
public function testSeekThroughAString() { public function testSeekThroughAString() {
return parent::testSeekThroughAString(); return parent::testSeekThroughAString();
} }
@ -67,7 +67,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\UTF16::posChar * @covers MensBeam\Intl\Encoding\UTF16::posChar
* @covers MensBeam\Intl\Encoding\UTF16::posByte * @covers MensBeam\Intl\Encoding\UTF16::posByte
* @covers MensBeam\Intl\Encoding\UTF16::eof * @covers MensBeam\Intl\Encoding\UTF16::eof
*/ */
public function testTraversePastTheEndOfAString() { public function testTraversePastTheEndOfAString() {
return parent::testTraversePastTheEndOfAString(); return parent::testTraversePastTheEndOfAString();
} }
@ -76,7 +76,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\UTF16::peekChar * @covers MensBeam\Intl\Encoding\UTF16::peekChar
* @covers MensBeam\Intl\Encoding\UTF16::stateSave * @covers MensBeam\Intl\Encoding\UTF16::stateSave
* @covers MensBeam\Intl\Encoding\UTF16::stateApply * @covers MensBeam\Intl\Encoding\UTF16::stateApply
*/ */
public function testPeekAtCharacters() { public function testPeekAtCharacters() {
return parent::testPeekAtCharacters(); return parent::testPeekAtCharacters();
} }
@ -85,7 +85,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\UTF16::peekCode * @covers MensBeam\Intl\Encoding\UTF16::peekCode
* @covers MensBeam\Intl\Encoding\UTF16::stateSave * @covers MensBeam\Intl\Encoding\UTF16::stateSave
* @covers MensBeam\Intl\Encoding\UTF16::stateApply * @covers MensBeam\Intl\Encoding\UTF16::stateApply
*/ */
public function testPeekAtCodePoints() { public function testPeekAtCodePoints() {
return parent::testPeekAtCodePoints(); return parent::testPeekAtCodePoints();
} }
@ -96,14 +96,14 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\UTF16::lenByte * @covers MensBeam\Intl\Encoding\UTF16::lenByte
* @covers MensBeam\Intl\Encoding\UTF16::stateSave * @covers MensBeam\Intl\Encoding\UTF16::stateSave
* @covers MensBeam\Intl\Encoding\UTF16::stateApply * @covers MensBeam\Intl\Encoding\UTF16::stateApply
*/ */
public function testGetStringLength(string $input, array $points) { public function testGetStringLength(string $input, array $points) {
return parent::testGetStringLength($input, $points); return parent::testGetStringLength($input, $points);
} }
/** /**
* @covers MensBeam\Intl\Encoding\UTF16::err * @covers MensBeam\Intl\Encoding\UTF16::err
*/ */
public function testReplacementModes() { public function testReplacementModes() {
return parent::testReplacementModes(); return parent::testReplacementModes();
} }
@ -113,7 +113,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\UTF16::rewind * @covers MensBeam\Intl\Encoding\UTF16::rewind
* @covers MensBeam\Intl\Encoding\UTF16::chars * @covers MensBeam\Intl\Encoding\UTF16::chars
* @covers MensBeam\Intl\Encoding\UTF16::codes * @covers MensBeam\Intl\Encoding\UTF16::codes
*/ */
public function testIterateThroughAString(string $input, array $exp) { public function testIterateThroughAString(string $input, array $exp) {
return parent::testIterateThroughAString($input, $exp); return parent::testIterateThroughAString($input, $exp);
} }
@ -121,7 +121,7 @@ class TestUTF16LE extends \MensBeam\Intl\Test\DecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF16::nextCode * @covers MensBeam\Intl\Encoding\UTF16::nextCode
*/ */
public function testIterateThroughAStringAllowingSurrogates(string $input, array $strictExp, array $relaxedExp = null) { public function testIterateThroughAStringAllowingSurrogates(string $input, array $strictExp, array $relaxedExp = null) {
return parent::testIterateThroughAStringAllowingSurrogates($input, $strictExp, $relaxedExp); return parent::testIterateThroughAStringAllowingSurrogates($input, $strictExp, $relaxedExp);
} }

24
tests/cases/Encoding/TestUTF8.php

@ -32,7 +32,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @dataProvider provideCodePoints * @dataProvider provideCodePoints
* @covers MensBeam\Intl\Encoding\UTF8::encode * @covers MensBeam\Intl\Encoding\UTF8::encode
* @covers MensBeam\Intl\Encoding\UTF8::err * @covers MensBeam\Intl\Encoding\UTF8::err
*/ */
public function testEncodeCodePoints(bool $fatal, $input, $exp) { public function testEncodeCodePoints(bool $fatal, $input, $exp) {
return parent::testEncodeCodePoints($fatal, $input, $exp); return parent::testEncodeCodePoints($fatal, $input, $exp);
} }
@ -41,7 +41,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF8::__construct * @covers MensBeam\Intl\Encoding\UTF8::__construct
* @covers MensBeam\Intl\Encoding\UTF8::nextCode * @covers MensBeam\Intl\Encoding\UTF8::nextCode
*/ */
public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp) { public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp) {
return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp); return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp);
} }
@ -50,7 +50,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF8::__construct * @covers MensBeam\Intl\Encoding\UTF8::__construct
* @covers MensBeam\Intl\Encoding\UTF8::nextChar * @covers MensBeam\Intl\Encoding\UTF8::nextChar
*/ */
public function testDecodeMultipleCharactersAsStrings(string $input, array $exp) { public function testDecodeMultipleCharactersAsStrings(string $input, array $exp) {
return parent::testDecodeMultipleCharactersAsStrings($input, $exp); return parent::testDecodeMultipleCharactersAsStrings($input, $exp);
} }
@ -58,7 +58,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF8::seekBack * @covers MensBeam\Intl\Encoding\UTF8::seekBack
*/ */
public function testSTepBackThroughAString(string $input, array $exp) { public function testSTepBackThroughAString(string $input, array $exp) {
return parent::testSTepBackThroughAString($input, $exp); return parent::testSTepBackThroughAString($input, $exp);
} }
@ -68,7 +68,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\UTF8::posChar * @covers MensBeam\Intl\Encoding\UTF8::posChar
* @covers MensBeam\Intl\Encoding\UTF8::posByte * @covers MensBeam\Intl\Encoding\UTF8::posByte
* @covers MensBeam\Intl\Encoding\UTF8::rewind * @covers MensBeam\Intl\Encoding\UTF8::rewind
*/ */
public function testSeekThroughAString() { public function testSeekThroughAString() {
return parent::testSeekThroughAString(); return parent::testSeekThroughAString();
} }
@ -77,7 +77,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\UTF8::posChar * @covers MensBeam\Intl\Encoding\UTF8::posChar
* @covers MensBeam\Intl\Encoding\UTF8::posByte * @covers MensBeam\Intl\Encoding\UTF8::posByte
* @covers MensBeam\Intl\Encoding\UTF8::eof * @covers MensBeam\Intl\Encoding\UTF8::eof
*/ */
public function testTraversePastTheEndOfAString() { public function testTraversePastTheEndOfAString() {
return parent::testTraversePastTheEndOfAString(); return parent::testTraversePastTheEndOfAString();
} }
@ -86,7 +86,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\UTF8::peekChar * @covers MensBeam\Intl\Encoding\UTF8::peekChar
* @covers MensBeam\Intl\Encoding\UTF8::stateSave * @covers MensBeam\Intl\Encoding\UTF8::stateSave
* @covers MensBeam\Intl\Encoding\UTF8::stateApply * @covers MensBeam\Intl\Encoding\UTF8::stateApply
*/ */
public function testPeekAtCharacters() { public function testPeekAtCharacters() {
return parent::testPeekAtCharacters(); return parent::testPeekAtCharacters();
} }
@ -95,7 +95,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\UTF8::peekCode * @covers MensBeam\Intl\Encoding\UTF8::peekCode
* @covers MensBeam\Intl\Encoding\UTF8::stateSave * @covers MensBeam\Intl\Encoding\UTF8::stateSave
* @covers MensBeam\Intl\Encoding\UTF8::stateApply * @covers MensBeam\Intl\Encoding\UTF8::stateApply
*/ */
public function testPeekAtCodePoints() { public function testPeekAtCodePoints() {
return parent::testPeekAtCodePoints(); return parent::testPeekAtCodePoints();
} }
@ -106,14 +106,14 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\UTF8::lenByte * @covers MensBeam\Intl\Encoding\UTF8::lenByte
* @covers MensBeam\Intl\Encoding\UTF8::stateSave * @covers MensBeam\Intl\Encoding\UTF8::stateSave
* @covers MensBeam\Intl\Encoding\UTF8::stateApply * @covers MensBeam\Intl\Encoding\UTF8::stateApply
*/ */
public function testGetStringLength(string $input, array $points) { public function testGetStringLength(string $input, array $points) {
return parent::testGetStringLength($input, $points); return parent::testGetStringLength($input, $points);
} }
/** /**
* @covers MensBeam\Intl\Encoding\UTF8::err * @covers MensBeam\Intl\Encoding\UTF8::err
*/ */
public function testReplacementModes() { public function testReplacementModes() {
return parent::testReplacementModes(); return parent::testReplacementModes();
} }
@ -123,7 +123,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
* @covers MensBeam\Intl\Encoding\UTF8::rewind * @covers MensBeam\Intl\Encoding\UTF8::rewind
* @covers MensBeam\Intl\Encoding\UTF8::chars * @covers MensBeam\Intl\Encoding\UTF8::chars
* @covers MensBeam\Intl\Encoding\UTF8::codes * @covers MensBeam\Intl\Encoding\UTF8::codes
*/ */
public function testIterateThroughAString(string $input, array $exp) { public function testIterateThroughAString(string $input, array $exp) {
return parent::testIterateThroughAString($input, $exp); return parent::testIterateThroughAString($input, $exp);
} }
@ -131,7 +131,7 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\UTF8::nextCode * @covers MensBeam\Intl\Encoding\UTF8::nextCode
*/ */
public function testIterateThroughAStringAllowingSurrogates(string $input, array $strictExp, array $relaxedExp = null) { public function testIterateThroughAStringAllowingSurrogates(string $input, array $strictExp, array $relaxedExp = null) {
return parent::testIterateThroughAStringAllowingSurrogates($input, $strictExp, $relaxedExp); return parent::testIterateThroughAStringAllowingSurrogates($input, $strictExp, $relaxedExp);
} }

22
tests/cases/Encoding/TestXUserDefined.php

@ -21,7 +21,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\XUserDefined::__construct * @covers MensBeam\Intl\Encoding\XUserDefined::__construct
* @covers MensBeam\Intl\Encoding\XUserDefined::nextCode * @covers MensBeam\Intl\Encoding\XUserDefined::nextCode
*/ */
public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp) { public function testDecodeMultipleCharactersAsCodePoints(string $input, array $exp) {
return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp); return parent::testDecodeMultipleCharactersAsCodePoints($input, $exp);
} }
@ -30,7 +30,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @dataProvider provideStrings * @dataProvider provideStrings
* @covers MensBeam\Intl\Encoding\XUserDefined::__construct * @covers MensBeam\Intl\Encoding\XUserDefined::__construct
* @covers MensBeam\Intl\Encoding\XUserDefined::nextChar * @covers MensBeam\Intl\Encoding\XUserDefined::nextChar
*/ */
public function testDecodeMultipleCharactersAsStrings(string $input, array $exp) { public function testDecodeMultipleCharactersAsStrings(string $input, array $exp) {
return parent::testDecodeMultipleCharactersAsStrings($input, $exp); return parent::testDecodeMultipleCharactersAsStrings($input, $exp);
} }
@ -38,7 +38,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @coversNothing * @coversNothing
*/ */
public function testSTepBackThroughAString(string $input, array $exp) { public function testSTepBackThroughAString(string $input, array $exp) {
// this test has no meaning for x-user-defined // this test has no meaning for x-user-defined
return parent::testSTepBackThroughAString($input, $exp); return parent::testSTepBackThroughAString($input, $exp);
@ -49,7 +49,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\XUserDefined::posChar * @covers MensBeam\Intl\Encoding\XUserDefined::posChar
* @covers MensBeam\Intl\Encoding\XUserDefined::posByte * @covers MensBeam\Intl\Encoding\XUserDefined::posByte
* @covers MensBeam\Intl\Encoding\XUserDefined::rewind * @covers MensBeam\Intl\Encoding\XUserDefined::rewind
*/ */
public function testSeekThroughAString() { public function testSeekThroughAString() {
return parent::testSeekThroughAString(); return parent::testSeekThroughAString();
} }
@ -58,7 +58,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\XUserDefined::posChar * @covers MensBeam\Intl\Encoding\XUserDefined::posChar
* @covers MensBeam\Intl\Encoding\XUserDefined::posByte * @covers MensBeam\Intl\Encoding\XUserDefined::posByte
* @covers MensBeam\Intl\Encoding\XUserDefined::eof * @covers MensBeam\Intl\Encoding\XUserDefined::eof
*/ */
public function testTraversePastTheEndOfAString() { public function testTraversePastTheEndOfAString() {
return parent::testTraversePastTheEndOfAString(); return parent::testTraversePastTheEndOfAString();
} }
@ -67,7 +67,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\XUserDefined::peekChar * @covers MensBeam\Intl\Encoding\XUserDefined::peekChar
* @covers MensBeam\Intl\Encoding\XUserDefined::stateSave * @covers MensBeam\Intl\Encoding\XUserDefined::stateSave
* @covers MensBeam\Intl\Encoding\XUserDefined::stateApply * @covers MensBeam\Intl\Encoding\XUserDefined::stateApply
*/ */
public function testPeekAtCharacters() { public function testPeekAtCharacters() {
return parent::testPeekAtCharacters(); return parent::testPeekAtCharacters();
} }
@ -76,7 +76,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\XUserDefined::peekCode * @covers MensBeam\Intl\Encoding\XUserDefined::peekCode
* @covers MensBeam\Intl\Encoding\XUserDefined::stateSave * @covers MensBeam\Intl\Encoding\XUserDefined::stateSave
* @covers MensBeam\Intl\Encoding\XUserDefined::stateApply * @covers MensBeam\Intl\Encoding\XUserDefined::stateApply
*/ */
public function testPeekAtCodePoints() { public function testPeekAtCodePoints() {
return parent::testPeekAtCodePoints(); return parent::testPeekAtCodePoints();
} }
@ -87,14 +87,14 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\XUserDefined::lenByte * @covers MensBeam\Intl\Encoding\XUserDefined::lenByte
* @covers MensBeam\Intl\Encoding\XUserDefined::stateSave * @covers MensBeam\Intl\Encoding\XUserDefined::stateSave
* @covers MensBeam\Intl\Encoding\XUserDefined::stateApply * @covers MensBeam\Intl\Encoding\XUserDefined::stateApply
*/ */
public function testGetStringLength(string $input, array $points) { public function testGetStringLength(string $input, array $points) {
return parent::testGetStringLength($input, $points); return parent::testGetStringLength($input, $points);
} }
/** /**
* @covers MensBeam\Intl\Encoding\XUserDefined::err * @covers MensBeam\Intl\Encoding\XUserDefined::err
*/ */
public function testReplacementModes() { public function testReplacementModes() {
return parent::testReplacementModes(); return parent::testReplacementModes();
} }
@ -104,7 +104,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
* @covers MensBeam\Intl\Encoding\XUserDefined::rewind * @covers MensBeam\Intl\Encoding\XUserDefined::rewind
* @covers MensBeam\Intl\Encoding\XUserDefined::chars * @covers MensBeam\Intl\Encoding\XUserDefined::chars
* @covers MensBeam\Intl\Encoding\XUserDefined::codes * @covers MensBeam\Intl\Encoding\XUserDefined::codes
*/ */
public function testIterateThroughAString(string $input, array $exp) { public function testIterateThroughAString(string $input, array $exp) {
return parent::testIterateThroughAString($input, $exp); return parent::testIterateThroughAString($input, $exp);
} }
@ -112,7 +112,7 @@ class TestXUserDefined extends \MensBeam\Intl\Test\DecoderTest {
/** /**
* @dataProvider provideStrings * @dataProvider provideStrings
* @coversNothing * @coversNothing
*/ */
public function testIterateThroughAStringAllowingSurrogates(string $input, array $strictExp, array $relaxedExp = null) { public function testIterateThroughAStringAllowingSurrogates(string $input, array $strictExp, array $relaxedExp = null) {
return parent::testIterateThroughAStringAllowingSurrogates($input, $strictExp, $relaxedExp); return parent::testIterateThroughAStringAllowingSurrogates($input, $strictExp, $relaxedExp);
} }

2
tests/lib/CoderDecoderTest.php

@ -6,8 +6,6 @@
declare(strict_types=1); declare(strict_types=1);
namespace MensBeam\Intl\Test; namespace MensBeam\Intl\Test;
use MensBeam\Intl\Encoding\EncoderException;
abstract class CoderDecoderTest extends DecoderTest { abstract class CoderDecoderTest extends DecoderTest {
public function testEncodeCodePoints(bool $fatal, $input, $exp) { public function testEncodeCodePoints(bool $fatal, $input, $exp) {
$class = $this->testedClass; $class = $this->testedClass;

Loading…
Cancel
Save