-
- Notifications
You must be signed in to change notification settings - Fork 449
rector: MakeInheritedMethodVisibilitySameAsParentRector #5174
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
base: main
Are you sure you want to change the base?
rector: MakeInheritedMethodVisibilitySameAsParentRector #5174
Conversation
sreichel commented Dec 20, 2025
- see https://getrector.com/rule-detail/make-inherited-method-visibility-same-as-parent-rector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR applies the Rector rule MakeInheritedMethodVisibilitySameAsParentRector to ensure that overridden methods have the same visibility as their parent class definitions. The changes correct method visibility from public to protected across test files and core application code.
- Changes method visibility from
publictoprotectedfor overridden methods - Updates 15 test files to use
protectedforsetUp()andtearDown()methods - Updates 66 core application files to use
protectedfor framework hook methods like_construct(),_beforeSave(),_prepareLayout(),_toHtml(), etc. - Enables the Rector rule by removing it from the skip list in
.rector.php
Reviewed changes
Copilot reviewed 83 out of 83 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/Varien/ObjectTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Varien/Data/Form/Filter/DatetimeTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Varien/Data/Form/Filter/DateTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Uploader/Block/AbstractTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Rule/Model/AbstractTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Page/Block/Html/HeaderTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Log/Model/VisitorTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Core/Model/StoreTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Core/Model/Email/Template/AbstractTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php | Changed setup() visibility from public to protected (critical: incorrect method name) |
| tests/unit/Mage/Cms/Model/PageTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Catalog/Model/Resource/Eav/AttributeTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/Adminhtml/Block/CacheTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Mage/AdminNotification/Model/FeedTest.php | Changed setUp() visibility from public to protected |
| tests/unit/Error/ProcessorTest.php | Changed setUp() and tearDown() visibility from public to protected |
| app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Tax/Model/Resource/Class/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Tax/Model/Resource/Class.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Tax/Model/Class.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php | Changed _initSelect() visibility from public to protected |
| app/code/core/Mage/Sitemap/Model/Resource/Sitemap/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Shipping/Model/Resource/Carrier/Tablerate/Collection.php | Changed _initSelect() visibility from public to protected |
| app/code/core/Mage/SalesRule/Model/Resource/Rule/Collection.php | Changed _initSelect() visibility from public to protected |
| app/code/core/Mage/SalesRule/Model/Resource/Coupon.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/Sales/Model/Order/Shipment/Track.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Sales/Model/Order/Shipment/Item.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Sales/Model/Order/Invoice/Item.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Sales/Model/Entity/Order/Item/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Rule/Model/Resource/Abstract.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/Reports/Model/Resource/Tax/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Page/Block/Html/Topmenu.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Page/Block/Html/Header.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Eav/Model/Entity/Attribute/Option/Swatch.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Eav/Model/Entity/Attribute/Option.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/Downloadable/Model/Link/Purchased.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/Customer/Model/Customer.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Customer/Model/Config/Share.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/Customer/Block/Widget/Taxvat.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Customer/Block/Widget/Name.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Customer/Block/Widget/Gender.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Customer/Block/Widget/Dob.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Cron/Model/Schedule.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Cron/Model/Resource/Schedule/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Cron/Model/Resource/Schedule.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Core/Model/Resource/Translate/String.php | Changed _afterLoad() visibility from public to protected |
| app/code/core/Mage/Core/Model/Resource/Store/Group/Collection.php | Changed _beforeLoad() visibility from public to protected |
| app/code/core/Mage/Core/Model/Resource/Email/Template/Collection.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Core/Model/Resource/Design.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/Core/Block/Template/Zend.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Core/Block/Messages.php | Changed _prepareLayout() visibility from public to protected |
| app/code/core/Mage/Checkout/Block/Multishipping/Link.php | Changed _toHtml() visibility from public to protected |
| app/code/core/Mage/CatalogSearch/Model/Resource/Query.php | Changed _beforeSave() visibility from public to protected |
| app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php | Changed _prepareLayout() visibility from public to protected |
| app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php | Changed _toHtml() visibility from public to protected |
| app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php | Changed _getDefaultSourceModel() visibility from public to protected |
| app/code/core/Mage/Bundle/Model/Resource/Selection/Collection.php | Changed _afterLoad() visibility from public to protected |
| app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Users.php | Changed _toHtml() visibility from public to protected |
| app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Grid.php | Changed _prepareLayout() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Shipping/Tablerate.php | Changed _afterSave() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Custom.php | Changed _afterSave() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php | Changed _getValue() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Tag.php | Changed _beforeToHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/System/Store/Tree.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php | Changed _prepareForm() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Sales.php | Changed _beforeToHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php | Changed _beforeToHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Roleinfo.php | Changed _beforeToHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Customer/Online.php | Changed _beforeToHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php | Changed _beforeToHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Update/Result.php | Changed _toHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Fieldset/Qty.php | Changed _construct() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Catalog/Product/Composite/Error.php | Changed _toHtml() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php | Changed _prepareLayout() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php | Changed _prepareLayout() visibility from public to protected |
| app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php | Changed _beforeToHtml() visibility from public to protected |
| .rector.php | Removed MakeInheritedMethodVisibilitySameAsParentRector from skip list to enable this rule |
|


