Skip to content

Commit f01cf3b

Browse files
committed
Fixed PHP 8.2 deprecation warnings: 'creation of dynamic property'.
1 parent cfaeeae commit f01cf3b

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ abstract class AbstractEntity
145145
*/
146146
protected $_storeManager;
147147

148+
/**
149+
* @var array
150+
*/
151+
private $_storeIdToCode = [];
152+
153+
/**
154+
* @var array
155+
*/
156+
private $_invalidRows = [];
157+
148158
/**
149159
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
150160
* @param \Magento\Eav\Model\Config $config
@@ -172,10 +182,8 @@ public function __construct(
172182
protected function _initStores()
173183
{
174184
foreach ($this->_storeManager->getStores(true) as $store) {
175-
// phpstan:ignore "Access to an undefined property"
176185
$this->_storeIdToCode[$store->getId()] = $store->getCode();
177186
}
178-
// phpstan:ignore "Access to an undefined property"
179187
ksort($this->_storeIdToCode);
180188
// to ensure that 'admin' store (ID is zero) goes first
181189

@@ -350,7 +358,6 @@ public function addRowError($errorCode, $errorRowNum)
350358
$errorCode = (string)$errorCode;
351359
$this->_errors[$errorCode][] = $errorRowNum + 1;
352360
// one added for human readability
353-
// phpstan:ignore "Access to an undefined property"
354361
$this->_invalidRows[$errorRowNum] = true;
355362
$this->_errorsCount++;
356363

@@ -508,7 +515,6 @@ public function getErrorsCount()
508515
*/
509516
public function getInvalidRowsCount()
510517
{
511-
// phpstan:ignore "Access to an undefined property"
512518
return count($this->_invalidRows);
513519
}
514520

app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Shipping\Model\Carrier;
88

99
use Magento\Quote\Model\Quote\Address\RateResult\Error;
10+
use Magento\Shipping\Model\Rate\Result as RateResult;
1011
use Magento\Shipping\Model\Shipment\Request;
1112

1213
/**
@@ -45,6 +46,11 @@ abstract class AbstractCarrier extends \Magento\Framework\DataObject implements
4546
*/
4647
protected $_isFixed = false;
4748

49+
/**
50+
* @var ?RateResult
51+
*/
52+
private $_result;
53+
4854
/**
4955
* @var string[]
5056
*/
@@ -331,7 +337,7 @@ public function processAdditionalValidation(\Magento\Framework\DataObject $reque
331337
* @param \Magento\Framework\DataObject $request
332338
* @return $this|bool|\Magento\Framework\DataObject
333339
* @deprecated 100.2.6
334-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
340+
* @see processAdditionalValidation()
335341
*/
336342
public function proccessAdditionalValidation(\Magento\Framework\DataObject $request)
337343
{
@@ -426,7 +432,6 @@ protected function _updateFreeMethodQuote($request)
426432
return;
427433
}
428434
$freeRateId = false;
429-
// phpstan:ignore
430435
if (is_object($this->_result)) {
431436
foreach ($this->_result->getAllRates() as $i => $item) {
432437
if ($item->getMethod() == $freeMethod) {

dev/tests/integration/testsuite/Magento/Setup/Fixtures/FixturesAsserts/SimpleProductsAssert.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@
1313
* Class performs assertion that generated simple products are valid
1414
* after running setup:performance:generate-fixtures command
1515
*/
16-
#[\AllowDynamicProperties]
1716
class SimpleProductsAssert
1817
{
1918
/**
2019
* @var \Magento\Catalog\Api\ProductRepositoryInterface
2120
*/
2221
private $productRepository;
2322

23+
/**
24+
* @var \Magento\ConfigurableProduct\Api\OptionRepositoryInterface
25+
*/
26+
private $optionRepository;
27+
2428
/**
2529
* @var \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert
2630
*/

pub/errors/processor.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2121
* phpcs:ignoreFile
2222
*/
23-
#[\AllowDynamicProperties]
2423
class Processor
2524
{
2625
const MAGE_ERRORS_LOCAL_XML = 'local.xml';
@@ -156,6 +155,21 @@ class Processor
156155
*/
157156
private $documentRoot;
158157

158+
/**
159+
* @var string
160+
*/
161+
private $_errorDir;
162+
163+
/**
164+
* @var string
165+
*/
166+
private $_reportDir;
167+
168+
/**
169+
* @var string
170+
*/
171+
private $_indexDir;
172+
159173
/**
160174
* @param Http $response
161175
* @param Json $serializer

0 commit comments

Comments
 (0)