Showing results for 
Search instead for 
Did you mean: 

Change class members from 'private' to 'protected'

0 Kudos

Change class members from 'private' to 'protected'

Feature request from hiephm, posted on GitHub Aug 19, 2016

@alankent Right now there are many classes that usually be inherited but all of their members are private (for example \Magento\Payment\Model\Method\Adapter). For child classes to use their parent members, we must re-declare constructor and all members again, which is not very convenience.

I know that OOP good practice is keeping member as much private as possible. But given the extensible nature of Magento, I think most of the private member can be safely changed to protected.

1 Comment
New Member

Comment from maderlock, posted on GitHub Aug 19, 2016

I've come across this too, though more often it's just one or two things that are private making them hard to extend.

In addition, there are too many methods protected which means that plugins cannot be used with them, making the plugin mechanism rather less useful than maybe the creators expected.