Skip to content

Commit 1a8e1ff

Browse files
committed
:octocat: mark nullable types explicitly (#276)
1 parent a702ac3 commit 1a8e1ff

31 files changed

+70
-70
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@
4949
"require": {
5050
"php": "^8.2",
5151
"ext-mbstring": "*",
52-
"chillerlan/php-settings-container": "^3.2"
52+
"chillerlan/php-settings-container": "^3.2.1"
5353
},
5454
"require-dev": {
55-
"chillerlan/php-authenticator": "^5.1",
55+
"chillerlan/php-authenticator": "^5.2.1",
5656
"intervention/image": "^3.7",
5757
"phpbench/phpbench": "^1.2.15",
5858
"phan/phan": "^5.4",
5959
"phpunit/phpunit": "^11.2",
6060
"phpmd/phpmd": "^2.15",
6161
"setasign/fpdf": "^1.8.2",
62-
"squizlabs/php_codesniffer": "^3.9"
62+
"squizlabs/php_codesniffer": "^3.10"
6363
},
6464
"suggest": {
6565
"chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.",

examples/custom_output.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function getDefaultModuleValue(bool $isDark):mixed{
4848
/**
4949
* @inheritDoc
5050
*/
51-
public function dump(string $file = null):string{
51+
public function dump(string|null $file = null):string{
5252
$output = '';
5353

5454
for($y = 0; $y < $this->moduleCount; $y++){

examples/imageWithLogo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class QRImageWithLogo extends QRGdImagePNG{
3030
* @return string
3131
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
3232
*/
33-
public function dump(string $file = null, string $logo = null):string{
33+
public function dump(string|null $file = null, string|null $logo = null):string{
3434
// set returnResource to true to skip further processing for now
3535
$this->options->returnResource = true;
3636

examples/imageWithText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QRImageWithText extends QRGdImagePNG{
2626
/**
2727
* @inheritDoc
2828
*/
29-
public function dump(string $file = null, string $text = null):string{
29+
public function dump(string|null $file = null, string|null $text = null):string{
3030
// set returnResource to true to skip further processing for now
3131
$this->options->returnResource = true;
3232

examples/imagickConvertSVGtoPNG.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function header():string{
4747
}
4848

4949
/** @inheritDoc */
50-
public function dump(string $file = null):string{
50+
public function dump(string|null $file = null):string{
5151
$base64 = $this->options->outputBase64;
5252
// we don't want the SVG in base64
5353
$this->options->outputBase64 = false;

examples/imagickWithLogo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class QRImagickWithLogo extends QRImagick{
2828
* @inheritDoc
2929
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
3030
*/
31-
public function dump(string $file = null):string{
31+
public function dump(string|null $file = null):string{
3232
// set returnResource to true to skip further processing for now
3333
$this->options->returnResource = true;
3434

src/Common/ECICharset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function getID():int{
118118
* @see \mb_convert_encoding()
119119
* @see \iconv()
120120
*/
121-
public function getName():?string{
121+
public function getName():string|null{
122122
return (self::MB_ENCODINGS[$this->charsetID] ?? null);
123123
}
124124

src/Common/GenericGFPoly.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class GenericGFPoly{
3535
* @throws \chillerlan\QRCode\QRCodeException if argument is null or empty, or if leading coefficient is 0 and this
3636
* is not a constant polynomial (that is, it is not the monomial "0")
3737
*/
38-
public function __construct(array $coefficients, int $degree = null){
38+
public function __construct(array $coefficients, int|null $degree = null){
3939
$degree ??= 0;
4040

4141
if(empty($coefficients)){

src/Common/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function getDimension():int{
257257
/**
258258
* the version pattern for the given version
259259
*/
260-
public function getVersionPattern():?int{
260+
public function getVersionPattern():int|null{
261261
return (self::VERSION_PATTERN[$this->version] ?? null);
262262
}
263263

src/Data/QRMatrix.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ class QRMatrix{
110110
/**
111111
* the matrix version - always set in QRMatrix, may be null in BitMatrix
112112
*/
113-
protected ?Version $version = null;
113+
protected Version|null $version = null;
114114

115115
/**
116116
* the current ECC level - always set in QRMatrix, may be null in BitMatrix
117117
*/
118-
protected ?EccLevel $eccLevel = null;
118+
protected EccLevel|null $eccLevel = null;
119119

120120
/**
121121
* the mask pattern that was used in the most recent operation, set via:
@@ -124,7 +124,7 @@ class QRMatrix{
124124
* - QRMatrix::mask()
125125
* - BitMatrix::readFormatInformation()
126126
*/
127-
protected ?MaskPattern $maskPattern = null;
127+
protected MaskPattern|null $maskPattern = null;
128128

129129
/**
130130
* the size (side length) of the matrix, including quiet zone (if created)
@@ -175,7 +175,7 @@ public function initFunctionalPatterns():static{
175175
*
176176
* @return int[][]|bool[][]
177177
*/
178-
public function getMatrix(bool $boolean = null):array{
178+
public function getMatrix(bool|null $boolean = null):array{
179179

180180
if($boolean !== true){
181181
return $this->matrix;
@@ -193,21 +193,21 @@ public function getMatrix(bool $boolean = null):array{
193193
/**
194194
* Returns the current version number
195195
*/
196-
public function getVersion():?Version{
196+
public function getVersion():Version|null{
197197
return $this->version;
198198
}
199199

200200
/**
201201
* Returns the current ECC level
202202
*/
203-
public function getEccLevel():?EccLevel{
203+
public function getEccLevel():EccLevel|null{
204204
return $this->eccLevel;
205205
}
206206

207207
/**
208208
* Returns the current mask pattern
209209
*/
210-
public function getMaskPattern():?MaskPattern{
210+
public function getMaskPattern():MaskPattern|null{
211211
return $this->maskPattern;
212212
}
213213

@@ -342,7 +342,7 @@ public function isDark(int $M_TYPE):bool{
342342
* 7 # 3
343343
* 6 5 4
344344
*/
345-
public function checkNeighbours(int $x, int $y, int $M_TYPE = null):int{
345+
public function checkNeighbours(int $x, int $y, int|null $M_TYPE = null):int{
346346
$bits = 0;
347347

348348
foreach($this::neighbours as $bit => [$ix, $iy]){
@@ -507,7 +507,7 @@ public function setVersionNumber():static{
507507
*
508508
* ISO/IEC 18004:2000 Section 8.9
509509
*/
510-
public function setFormatInfo(MaskPattern $maskPattern = null):static{
510+
public function setFormatInfo(MaskPattern|null $maskPattern = null):static{
511511
$this->maskPattern = $maskPattern;
512512
$bits = 0; // sets all format fields to false (test mode)
513513

@@ -633,7 +633,7 @@ public function invert():static{
633633
*
634634
* @throws \chillerlan\QRCode\Data\QRCodeDataException
635635
*/
636-
public function setLogoSpace(int $width, int $height = null, int $startX = null, int $startY = null):static{
636+
public function setLogoSpace(int $width, int|null $height = null, int|null $startX = null, int|null $startY = null):static{
637637
$height ??= $width;
638638

639639
// if width and height happen to be negative or 0 (default value), just return - nothing to do

0 commit comments

Comments
 (0)