diff --git a/src/Common/BitMatrix.php b/src/Common/BitMatrix.php index fc0d1f1..294afb4 100644 --- a/src/Common/BitMatrix.php +++ b/src/Common/BitMatrix.php @@ -40,7 +40,7 @@ class BitMatrix /** * @throws InvalidArgumentException if a dimension is smaller than zero */ - public function __construct(int $width, int $height = null) + public function __construct(int $width, ?int $height = null) { if (null === $height) { $height = $width; @@ -132,7 +132,7 @@ public function setRegion(int $left, int $top, int $width, int $height) : void /** * A fast method to retrieve one row of data from the matrix as a BitArray. */ - public function getRow(int $y, BitArray $row = null) : BitArray + public function getRow(int $y, ?BitArray $row = null) : BitArray { if (null === $row || $row->getSize() < $this->width) { $row = new BitArray($this->width); diff --git a/src/Common/ReedSolomonCodec.php b/src/Common/ReedSolomonCodec.php index 31d8030..d16a75e 100644 --- a/src/Common/ReedSolomonCodec.php +++ b/src/Common/ReedSolomonCodec.php @@ -208,7 +208,7 @@ public function encode(SplFixedArray $data, SplFixedArray $parity) : void /** * Decodes received data. */ - public function decode(SplFixedArray $data, SplFixedArray $erasures = null) : ?int + public function decode(SplFixedArray $data, ?SplFixedArray $erasures = null) : ?int { // This speeds up the initialization a bit. $numRootsPlusOne = SplFixedArray::fromArray(array_fill(0, $this->numRoots + 1, 0), false); diff --git a/src/Encoder/Encoder.php b/src/Encoder/Encoder.php index 5444c28..c363953 100644 --- a/src/Encoder/Encoder.php +++ b/src/Encoder/Encoder.php @@ -160,7 +160,7 @@ private static function getAlphanumericCode(int $code) : int /** * Chooses the best mode for a given content. */ - private static function chooseMode(string $content, string $encoding = null) : Mode + private static function chooseMode(string $content, ?string $encoding = null) : Mode { if (null !== $encoding && 0 === strcasecmp($encoding, 'SHIFT-JIS')) { return self::isOnlyDoubleByteKanji($content) ? Mode::KANJI() : Mode::BYTE();