Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 8.2] Fixed deprecated dynamic property creation #3094

Merged

Conversation

elidrissidev
Copy link
Member

@elidrissidev elidrissidev commented Mar 16, 2023

Description (*)

This PR will fix some PHP 8.2 deprecations related to dynamic property creation, I found these by searching for doc blocks containing @property, so it's possible that there's more.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added Component: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex Component: CurrencySymbol Relates to Mage_CurrencySymbol Component: Customer Relates to Mage_Customer Component: ImportExport Relates to Mage_ImportExport Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review labels Mar 16, 2023
@elidrissidev elidrissidev added the PHP 8.2 Related to PHP 8.2 label Mar 16, 2023
Comment on lines -33 to -44
/**
* @var string
*/
private $_controller;

public function __construct()
{
$this->_blockGroup = 'currencysymbol_system';
$this->_controller = 'adminhtml_system_currencysymbol';
parent::__construct();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted this since I couldn't find any usages for those variables.

@@ -158,8 +156,6 @@ public function getProductEntityTypeId()
*/
protected function _joinFields()
{
$this->_totals = new Varien_Object();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No usages found for this variable.

@luigifab
Copy link
Contributor

Strangely, I don't have any deprecated notice for that with PHP 8.2... on my Sentry instance.

@elidrissidev
Copy link
Member Author

@luigifab I too didn't discover these through the logs, I only found them by looking for classes with @property in their PHPDoc comments. Did you try navigating to a page that uses one of the modified files? I reviewed the changes carefully, and by the looks of it, they should be throwing deprecation errors.

@fballiano fballiano requested a review from kiatng March 30, 2023 09:14
@fballiano fballiano changed the title [PHP 8.2] Fix deprecated dynamic property creation [PHP 8.2] Fixed deprecated dynamic property creation Mar 31, 2023
@fballiano fballiano merged commit 3e093cf into OpenMage:1.9.4.x Mar 31, 2023
@fballiano
Copy link
Contributor

merged and 20ed

fballiano added a commit that referenced this pull request Mar 31, 2023
Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
@elidrissidev elidrissidev deleted the fix/dynamic-property-creation branch March 31, 2023 10:53
@luigifab
Copy link
Contributor

luigifab commented Apr 4, 2023

Yes I tried to navigate to products page, categories page, made some orders... no notice for these properties.

@elidrissidev
Copy link
Member Author

I found out that some of the modified classes are not even being used at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex Component: CurrencySymbol Relates to Mage_CurrencySymbol Component: Customer Relates to Mage_Customer Component: ImportExport Relates to Mage_ImportExport Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review PHP 8.2 Related to PHP 8.2 phpstan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants