Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implicitly nullable params #175

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Common/BitMatrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Common/ReedSolomonCodec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Encoder/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading