Browse Source

Specify PHP 7.1 requirement

multi-byte
J. King 4 years ago
parent
commit
464bc4a0a9
  1. 2
      composer.json
  2. 9
      lib/Encoding/AbstractEncoding.php
  3. 2
      lib/Encoding/Encoding.php
  4. 4
      lib/Encoding/ISO2022JP.php
  5. 2
      lib/Encoding/Replacement.php

2
composer.json

@ -13,7 +13,7 @@
],
"require": {
"php": "^7.0"
"php": "^7.1"
},
"require-dev": {
"ext-intl": "*",

9
lib/Encoding/AbstractEncoding.php

@ -51,7 +51,7 @@ abstract class AbstractEncoding implements Encoding {
return $this->posChar;
}
public function rewind() {
public function rewind(): void {
$this->posByte = 0;
$this->posChar = 0;
$this->errMark = -1;
@ -163,7 +163,7 @@ abstract class AbstractEncoding implements Encoding {
}
/** Sets the decoder's state to the values specified */
protected function stateApply(array $state) {
protected function stateApply(array $state): void {
while (sizeof($this->errStack) > $state['errCount']) {
list($this->errMark, $this->errSync) = array_pop($this->errStack);
}
@ -174,8 +174,7 @@ abstract class AbstractEncoding implements Encoding {
}
/** Handles decoding errors */
protected function errDec(int $mode, int $charOffset, int $byteOffset) {
assert(in_array($mode, [self::MODE_NULL, self::MODE_REPLACE, self::MODE_FATAL]), "Invalid error mode $mode");
protected function errDec(int $mode, int $charOffset, int $byteOffset): ?int {
if ($mode !== self::MODE_NULL) {
// expose the error to the user; this disambiguates a literal replacement character
$this->posErr = $this->posChar;
@ -195,7 +194,7 @@ abstract class AbstractEncoding implements Encoding {
}
/** Handles encoding errors */
protected static function errEnc(bool $htmlMode, $data = null) {
protected static function errEnc(bool $htmlMode, $data = null): string {
if ($htmlMode) {
return "&#".(string) $data.";";
} else {

2
lib/Encoding/Encoding.php

@ -54,7 +54,7 @@ interface Encoding {
*
* This is usually faster than using the seek method for the same purpose
*/
public function rewind();
public function rewind(): void;
/** Retrieves the next $num characters (in UTF-8 encoding) from the string without advancing the character pointer
*

4
lib/Encoding/ISO2022JP.php

@ -178,7 +178,7 @@ class ISO2022JP extends AbstractEncoding implements Encoding {
return $out;
}
protected function stateApply(array $state) {
protected function stateApply(array $state): void {
while (sizeof($this->modeStack) > $state['modeCount']) {
list($this->modeMark, $this->mode) = array_pop($this->modeStack);
}
@ -186,7 +186,7 @@ class ISO2022JP extends AbstractEncoding implements Encoding {
parent::stateApply($state);
}
public function rewind() {
public function rewind(): void {
$this->modeStack = [];
$this->modeMark = \PHP_INT_MIN;
$this->mode = self::ASCII_STATE;

2
lib/Encoding/Replacement.php

@ -75,7 +75,7 @@ class Replacement implements Encoding {
return $distance;
}
public function rewind() {
public function rewind(): void {
$this->done = false;
}

Loading…
Cancel
Save