flagbit / Magento2-Flysystem

Magento2 Flysystem Module from Flagbit integrate Flysystem an Abstraction for local and remote filesystems into Magento2 without overriding or breaking core media storage functions.
MIT License
28 stars 2 forks source link

Change inheritance classes to Object composition pattern #6

Open robin-homberg opened 6 years ago

robin-homberg commented 6 years ago

Describe the bug There are classes inside the project that are created by class inheritance. While this was an code style mostly used in Magento1, and should'nt still be used in Magento2, the class, and other classes written like this, should be changed to the Object composition pattern. https://devdocs.magento.com/guides/v2.3/ext-best-practices/extension-coding/common-programming-bp.html#composition-over-inheritance

F.e the Flagbit\Flysystem\Block\Adminhtml\Filesystem\Content\Uploader class should be changed, regarding to this.

flagbird commented 6 years ago

I wouldn't consider this a bug, but an enhancement.

Be aware that, depending on how far this project is used by the community, that removing the inherited class may result in a BC break. Other users of Magento2-Flysystem might use these inherited classes in type hints. Please be sure to use a correct semantic version, if this gets merged.

robin-homberg commented 6 years ago

since this is the only class where "unnesessary" class inheritation is still used and there is a core class (\Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Uploader) which i used as pattern for my class which does it the same way. I'm not anymore sure if this should be changed.