Skip to content

Commit cd9457b

Browse files
authored
Merge pull request #63 from chrisastley/master
Fix nullable is deprecated error on PHP 8.4
2 parents 0b2e482 + 58b7e25 commit cd9457b

File tree

8 files changed

+41
-41
lines changed

8 files changed

+41
-41
lines changed

Api/Data/ProductStoreView.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class ProductStoreView
104104
/** @var CustomOptionValue[][] */
105105
protected $customOptionValues = [];
106106

107-
public function setName(string $name = null)
107+
public function setName(?string $name = null)
108108
{
109109
$this->attributes[self::ATTR_NAME] = ($name === null) ? null : trim($name);
110110
}
@@ -137,7 +137,7 @@ public function removeStoreViewId()
137137
*
138138
* @param int|null $status
139139
*/
140-
public function setStatus(int $status = null)
140+
public function setStatus(?int $status = null)
141141
{
142142
$this->attributes[self::ATTR_STATUS] = $status;
143143
}
@@ -147,35 +147,35 @@ public function setStatus(int $status = null)
147147
*
148148
* @param int|null $available
149149
*/
150-
public function setGiftMessageAvailable(int $available = null)
150+
public function setGiftMessageAvailable(?int $available = null)
151151
{
152152
$this->attributes[self::ATTR_GIFT_MESSAGE_AVAILABLE] = $available;
153153
}
154154

155-
public function setDescription(string $description = null)
155+
public function setDescription(?string $description = null)
156156
{
157157
// textarea input: not trimmed
158158
$this->attributes[self::ATTR_DESCRIPTION] = $description;
159159
}
160160

161-
public function setShortDescription(string $shortDescription = null)
161+
public function setShortDescription(?string $shortDescription = null)
162162
{
163163
// textarea input: not trimmed
164164
$this->attributes[self::ATTR_SHORT_DESCRIPTION] = $shortDescription;
165165
}
166166

167-
public function setMetaTitle(string $metaTitle = null)
167+
public function setMetaTitle(?string $metaTitle = null)
168168
{
169169
$this->attributes[self::ATTR_META_TITLE] = ($metaTitle === null) ? null : trim($metaTitle);
170170
}
171171

172-
public function setMetaDescription(string $metaDescription = null)
172+
public function setMetaDescription(?string $metaDescription = null)
173173
{
174174
// textarea input: not trimmed
175175
$this->attributes[self::ATTR_META_DESCRIPTION] = $metaDescription;
176176
}
177177

178-
public function setMetaKeywords(string $metaKeywords = null)
178+
public function setMetaKeywords(?string $metaKeywords = null)
179179
{
180180
// textarea input: not trimmed
181181
$this->attributes[self::ATTR_META_KEYWORDS] = $metaKeywords;
@@ -184,23 +184,23 @@ public function setMetaKeywords(string $metaKeywords = null)
184184
/**
185185
* @param string|null $price A 12.4 / 20.6 decimal field
186186
*/
187-
public function setPrice(string $price = null)
187+
public function setPrice(?string $price = null)
188188
{
189189
$this->attributes[self::ATTR_PRICE] = Decimal::formatPrice($price);
190190
}
191191

192192
/**
193193
* @param string|null $cost A 12.4 decimal field
194194
*/
195-
public function setCost(string $cost = null)
195+
public function setCost(?string $cost = null)
196196
{
197197
$this->attributes[self::ATTR_COST] = Decimal::format($cost);
198198
}
199199

200200
/**
201201
* @param string|null $msrp Manufacturer Suggested Retail Price. A 12.4 decimal field
202202
*/
203-
public function setMsrp(string $msrp = null)
203+
public function setMsrp(?string $msrp = null)
204204
{
205205
$this->attributes[self::ATTR_MSRP] = Decimal::format($msrp);
206206
}
@@ -210,7 +210,7 @@ public function setMsrp(string $msrp = null)
210210
*
211211
* @param int|null $type
212212
*/
213-
public function setMsrpDisplayActualPriceType(int $type = null)
213+
public function setMsrpDisplayActualPriceType(?int $type = null)
214214
{
215215
$this->attributes[self::ATTR_MSRP_DISPLAY_ACTUAL_PRICE_TYPE] = $type;
216216
}
@@ -220,22 +220,22 @@ public function setMsrpDisplayActualPriceType(int $type = null)
220220
*
221221
* @param int|null $visibility
222222
*/
223-
public function setVisibility(int $visibility = null)
223+
public function setVisibility(?int $visibility = null)
224224
{
225225
$this->attributes[self::ATTR_VISIBILITY] = $visibility;
226226
}
227227

228-
public function setTaxClassId(int $taxClassId = null)
228+
public function setTaxClassId(?int $taxClassId = null)
229229
{
230230
$this->attributes[self::ATTR_TAX_CLASS_ID] = $taxClassId;
231231
}
232232

233-
public function setTaxClassName(string $taxClassName = null)
233+
public function setTaxClassName(?string $taxClassName = null)
234234
{
235235
$this->unresolvedAttributes[self::ATTR_TAX_CLASS_ID] = ($taxClassName === null) ? null : trim($taxClassName);
236236
}
237237

238-
public function setUrlKey(string $urlKey = null)
238+
public function setUrlKey(?string $urlKey = null)
239239
{
240240
$this->attributes[self::ATTR_URL_KEY] = ($urlKey === null) ? null : trim($urlKey);
241241
}
@@ -256,71 +256,71 @@ public function generateUrlKey()
256256
/**
257257
* @param string|null $weight A 12.4 decimal field
258258
*/
259-
public function setWeight(string $weight = null)
259+
public function setWeight(?string $weight = null)
260260
{
261261
$this->attributes[self::ATTR_WEIGHT] = Decimal::format($weight);
262262
}
263263

264264
/**
265265
* @param string|null $specialPrice A 12.4 decimal field
266266
*/
267-
public function setSpecialPrice(string $specialPrice = null)
267+
public function setSpecialPrice(?string $specialPrice = null)
268268
{
269269
$this->attributes[self::ATTR_SPECIAL_PRICE] = Decimal::formatPrice($specialPrice);
270270
}
271271

272272
/**
273273
* @param string|null $specialPriceFromDate A y-m-d MySql date
274274
*/
275-
public function setSpecialFromDate(string $specialPriceFromDate = null)
275+
public function setSpecialFromDate(?string $specialPriceFromDate = null)
276276
{
277277
$this->attributes[self::ATTR_SPECIAL_FROM_DATE] = ($specialPriceFromDate === null) ? null : trim($specialPriceFromDate);
278278
}
279279

280280
/**
281281
* @param string|null $specialPriceToDate A y-m-d MySql date
282282
*/
283-
public function setSpecialToDate(string $specialPriceToDate = null)
283+
public function setSpecialToDate(?string $specialPriceToDate = null)
284284
{
285285
$this->attributes[self::ATTR_SPECIAL_TO_DATE] = ($specialPriceToDate === null) ? null : trim($specialPriceToDate);
286286
}
287287

288288
/**
289289
* @param string|null $newsFromDate A y-m-d MySql date
290290
*/
291-
public function setNewsFromDate(string $newsFromDate = null)
291+
public function setNewsFromDate(?string $newsFromDate = null)
292292
{
293293
$this->attributes[self::ATTR_NEWS_FROM_DATE] = ($newsFromDate === null) ? null : trim($newsFromDate);
294294
}
295295

296296
/**
297297
* @param string|null $newsToDate A y-m-d MySql date
298298
*/
299-
public function setNewsToDate(string $newsToDate = null)
299+
public function setNewsToDate(?string $newsToDate = null)
300300
{
301301
$this->attributes[self::ATTR_NEWS_TO_DATE] = ($newsToDate === null) ? null : trim($newsToDate);
302302
}
303303

304304
/**
305305
* @param string|null $option The admin name of the manufacturer attribute option
306306
*/
307-
public function setManufacturer(string $option = null)
307+
public function setManufacturer(?string $option = null)
308308
{
309309
$this->unresolvedSelects[self::ATTR_MANUFACTURER] = ($option === null) ? null : trim($option);
310310
}
311311

312312
/**
313313
* @param string|null $countryCode 2 characters, uppercase
314314
*/
315-
public function setCountryOfManufacture(string $countryCode = null)
315+
public function setCountryOfManufacture(?string $countryCode = null)
316316
{
317317
$this->attributes[self::ATTR_COUNTRY_OF_MANUFACTURE] = ($countryCode === null) ? null : trim($countryCode);
318318
}
319319

320320
/**
321321
* @param string|null $option The admin name of the color attribute option
322322
*/
323-
public function setColor(string $option = null)
323+
public function setColor(?string $option = null)
324324
{
325325
$this->unresolvedSelects[self::ATTR_COLOR] = ($option === null) ? null : trim($option);
326326
}
@@ -332,7 +332,7 @@ public function setColor(string $option = null)
332332
* @param string $attributeCode
333333
* @param string|null $value
334334
*/
335-
public function setCustomAttribute(string $attributeCode, string $value = null)
335+
public function setCustomAttribute(string $attributeCode, ?string $value = null)
336336
{
337337
// value is not trimmed, because it may have textarea as input, or it may be null
338338
$this->attributes[trim($attributeCode)] = $value;
@@ -427,7 +427,7 @@ public function getImageRoles()
427427
* @param string $attributeCode
428428
* @param string $option The admin name of the attribute option
429429
*/
430-
public function setSelectAttribute(string $attributeCode, string $option = null)
430+
public function setSelectAttribute(string $attributeCode, ?string $option = null)
431431
{
432432
$this->unresolvedSelects[trim($attributeCode)] = ($option === null) ? null : trim($option);
433433
}
@@ -441,12 +441,12 @@ public function setSelectAttributeOptionId(string $attributeCode, $optionId = nu
441441
* @param string $attributeCode
442442
* @param array $options The admin names of the attribute options
443443
*/
444-
public function setMultipleSelectAttribute(string $attributeCode, array $options = null)
444+
public function setMultipleSelectAttribute(string $attributeCode, ?array $options = null)
445445
{
446446
$this->unresolvedMultipleSelects[trim($attributeCode)] = ($options === null) ? null : array_map('trim', $options);
447447
}
448448

449-
public function setMultiSelectAttributeOptionIds(string $attributeCode, array $optionIds = null)
449+
public function setMultiSelectAttributeOptionIds(string $attributeCode, ?array $optionIds = null)
450450
{
451451
$this->attributes[$attributeCode] = ($optionIds === null) ? null : implode(',', array_map('trim', $optionIds));
452452
}

Api/Data/TierPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TierPrice
3939
* @param string|null $websiteCode The code of the website. Null means: all websites
4040
* @param string $percentageValue Since Magento 2.2
4141
*/
42-
public function __construct(string $quantity, string $value, string $customerGroupName = null, string $websiteCode = null, string $percentageValue = null)
42+
public function __construct(string $quantity, string $value, ?string $customerGroupName = null, ?string $websiteCode = null, ?string $percentageValue = null)
4343
{
4444
$this->quantity = Decimal::format($quantity);
4545
$this->value = Decimal::formatPrice($value);

Api/Data/Weee.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Weee
2727
* @param string|null $websiteId
2828
* @param string|null $state
2929
*/
30-
public function __construct(string $country, string $value, string $websiteId = null, string $state = null)
30+
public function __construct(string $country, string $value, ?string $websiteId = null, ?string $state = null)
3131
{
3232
$this->country = $country;
3333
$this->value = Decimal::format($value);
@@ -42,7 +42,7 @@ public function __construct(string $country, string $value, string $websiteId =
4242
* @param string|null $state
4343
* @return Weee
4444
*/
45-
public static function createWeee(string $country, string $value, string $websiteId = null, string $state = null)
45+
public static function createWeee(string $country, string $value, ?string $websiteId = null, ?string $state = null)
4646
{
4747
return new Weee($country, $value, $websiteId, $state);
4848
}

Console/Command/ProductImportCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ProductImportCommand extends Command
4646

4747
public function __construct(
4848
ObjectManagerInterface $objectManager,
49-
string $name = null)
49+
?string $name = null)
5050
{
5151
$this->objectManager = $objectManager;
5252

@@ -258,7 +258,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
258258
}
259259
}
260260

261-
protected function guessImageSourceDir(string $fileName, string $imageSourceDirOption = null)
261+
protected function guessImageSourceDir(string $fileName, ?string $imageSourceDirOption = null)
262262
{
263263
// select specified dir
264264
$dirName = $imageSourceDirOption;

Console/Command/ProductUrlRewriteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ProductUrlRewriteCommand extends Command
2828

2929
public function __construct(
3030
ObjectManagerInterface $objectManager,
31-
string $name = null
31+
?string $name = null
3232
)
3333
{
3434
$this->objectManager = $objectManager;
@@ -108,4 +108,4 @@ protected function execute(InputInterface $input, OutputInterface $output)
108108

109109
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
110110
}
111-
}
111+
}

Helper/Decimal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Decimal
2626
* @param string|null $in
2727
* @return string|null
2828
*/
29-
public static function format(string $in = null)
29+
public static function format(?string $in = null)
3030
{
3131
if ($in === null) {
3232
return $in;
@@ -49,7 +49,7 @@ public static function format(string $in = null)
4949
* @param string|null $in
5050
* @return string|null
5151
*/
52-
public static function formatPrice(string $in = null)
52+
public static function formatPrice(?string $in = null)
5353
{
5454
if ($in === null) {
5555
return $in;

Model/Data/LinkInfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class LinkInfo
2121
/** @var int */
2222
public $defaultQuantityAttributeId;
2323

24-
public function __construct(int $typeId, int $positionAttributeId, int $defaultQuantityAttributeId = null)
24+
public function __construct(int $typeId, int $positionAttributeId, ?int $defaultQuantityAttributeId = null)
2525
{
2626
$this->typeId = $typeId;
2727
$this->positionAttributeId = $positionAttributeId;
2828
$this->defaultQuantityAttributeId = $defaultQuantityAttributeId;
2929
}
3030

31-
}
31+
}

Model/Persistence/HttpCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function useCache(array $headers, int $now)
135135
return false;
136136
}
137137

138-
public function downloadFromUrl(string $url, string $localTargetFile, array $conditions = null)
138+
public function downloadFromUrl(string $url, string $localTargetFile, ?array $conditions = null)
139139
{
140140
$responseHeaders = [
141141
self::UNIX_TIME => time(),

0 commit comments

Comments
 (0)