:octocat: mark nullable types explicitly (https://github.com/chillerlan/php-qrcode/issues/276)

This commit is contained in:
smiley
2024-07-17 10:19:31 +02:00
parent a702ac3193
commit 1a8e1ffd2b
31 changed files with 70 additions and 70 deletions
+4 -4
View File
@@ -251,7 +251,7 @@ final class BitMatrix extends QRMatrix{
/**
* Returns information about the format it specifies, or null if it doesn't seem to match any known pattern
*/
private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?int{
private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):int|null{
$bestDifference = PHP_INT_MAX;
$bestFormatInfo = 0;
@@ -347,7 +347,7 @@ final class BitMatrix extends QRMatrix{
/**
* Decodes the version information from the given bit sequence, returns null if no valid match is found.
*/
private function decodeVersionInformation(int $versionBits):?Version{
private function decodeVersionInformation(int $versionBits):Version|null{
$bestDifference = PHP_INT_MAX;
$bestVersion = 0;
@@ -414,7 +414,7 @@ final class BitMatrix extends QRMatrix{
* @codeCoverageIgnore
* @throws \chillerlan\QRCode\Data\QRCodeDataException
*/
public function setQuietZone(int $quietZoneSize = null):static{
public function setQuietZone(int|null $quietZoneSize = null):static{
throw new QRCodeDataException('not supported');
}
@@ -422,7 +422,7 @@ final class BitMatrix extends QRMatrix{
* @codeCoverageIgnore
* @throws \chillerlan\QRCode\Data\QRCodeDataException
*/
public function setLogoSpace(int $width, int $height = null, int $startX = null, int $startY = null):static{
public function setLogoSpace(int $width, int|null $height = null, int|null $startX = null, int|null $startY = null):static{
throw new QRCodeDataException('not supported');
}
+3 -3
View File
@@ -31,9 +31,9 @@ final class Decoder{
* @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface
*/
private SettingsContainerInterface|QROptions $options;
private ?Version $version = null;
private ?EccLevel $eccLevel = null;
private ?MaskPattern $maskPattern = null;
private Version|null $version = null;
private EccLevel|null $eccLevel = null;
private MaskPattern|null $maskPattern = null;
private BitBuffer $bitBuffer;
public function __construct(SettingsContainerInterface|QROptions $options = new QROptions){
+1 -1
View File
@@ -41,7 +41,7 @@ final class DecoderResult{
/**
* DecoderResult constructor.
*/
public function __construct(iterable $properties = null){
public function __construct(iterable|null $properties = null){
if(!empty($properties)){