magento / magento2-functional-testing-framework

Magento2 Functional Testing Framework
Other
155 stars 133 forks source link

Fixed PHP 8.2 deprecation warnings: 'creation of dynamic property'. #905

Closed hostep closed 11 months ago

hostep commented 1 year ago

Description

This fixes most PHP 8.2 deprecated usages of 'creation of dynamic property': https://www.php.net/manual/en/migration82.deprecated.php#migration82.deprecated.core.dynamic-properties

The phpstan tool is able to find these problems:

$ /path/to/phpstan analyse --level=0 src | grep 'Access to an undefined property'
  66     Access to an undefined property Magento\FunctionalTestingFramework\Allure\Adapter\MagentoAllureAdapter::$options.
  67     Access to an undefined property Magento\FunctionalTestingFramework\Allure\Adapter\MagentoAllureAdapter::$options.
  187    Access to an undefined property Magento\FunctionalTestingFramework\Allure\Adapter\MagentoAllureAdapter::$emptyStep.
  51     Access to an undefined property Magento\FunctionalTestingFramework\Config\Reader::$isValidated.
  68     Access to an undefined property Magento\FunctionalTestingFramework\ObjectManager\Config\Reader\Dom::$_idAttributes.
  68     Access to an undefined property Magento\FunctionalTestingFramework\ObjectManager\Config\Reader\Dom::$_perFileSchema.
  75     Access to an undefined property Magento\FunctionalTestingFramework\StaticCheck\CreatedDataFromOutsideActionGroupCheck::$actionGroupXmlFile.
  133    Access to an undefined property Magento\FunctionalTestingFramework\StaticCheck\CreatedDataFromOutsideActionGroupCheck::$actionGroupXmlFile.
  49     Access to an undefined property Magento\FunctionalTestingFramework\StaticCheck\UnusedEntityCheck::$errors.
  50     Access to an undefined property Magento\FunctionalTestingFramework\StaticCheck\UnusedEntityCheck::$output.
  622    Access to an undefined property Magento\FunctionalTestingFramework\StaticCheck\UnusedEntityCheck::$errors.
  632    Access to an undefined property Magento\FunctionalTestingFramework\StaticCheck\UnusedEntityCheck::$output.
  340    Access to an undefined property Magento\FunctionalTestingFramework\Test\Objects\TestObject::$customData.

$ /path/to/phpstan analyse --level=0 dev | grep 'Access to an undefined property'
  45     Access to an undefined property tests\unit\Magento\FunctionalTestFramework\Util\UnusedEntityCheckTest::$scriptUtil.
  85     Access to an undefined property tests\unit\Magento\FunctionalTestFramework\Util\UnusedEntityCheckTest::$scriptUtil.
  122    Access to an undefined property tests\unit\Magento\FunctionalTestFramework\Util\UnusedEntityCheckTest::$scriptUtil.
  167    Access to an undefined property tests\unit\Magento\FunctionalTestFramework\Util\UnusedEntityCheckTest::$scriptUtil.

Since I'm not familiar with this MFTF tool, please review all changes carefully.

Fixed Issues (if relevant)

  1. https://github.com/magento/adobe-commerce-beta/issues/61

Contribution checklist