{"action":"closed","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/1019","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/1019/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/1019/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/1019/events","html_url":"https://github.com/magento/magento2/issues/1019","id":56409026,"node_id":"MDU6SXNzdWU1NjQwOTAyNg==","number":1019,"title":"Use private instead of protected visibility","user":{"login":"joshdifabio","id":5609851,"node_id":"MDQ6VXNlcjU2MDk4NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/5609851?v=4","gravatar_id":"","url":"https://api.github.com/users/joshdifabio","html_url":"https://github.com/joshdifabio","followers_url":"https://api.github.com/users/joshdifabio/followers","following_url":"https://api.github.com/users/joshdifabio/following{/other_user}","gists_url":"https://api.github.com/users/joshdifabio/gists{/gist_id}","starred_url":"https://api.github.com/users/joshdifabio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshdifabio/subscriptions","organizations_url":"https://api.github.com/users/joshdifabio/orgs","repos_url":"https://api.github.com/users/joshdifabio/repos","events_url":"https://api.github.com/users/joshdifabio/events{/privacy}","received_events_url":"https://api.github.com/users/joshdifabio/received_events","type":"User","site_admin":false},"labels":[{"id":689434599,"node_id":"MDU6TGFiZWw2ODk0MzQ1OTk=","url":"https://api.github.com/repos/magento/magento2/labels/G1%20Failed","name":"G1 Failed","color":"d93f0b","default":false},{"id":153474389,"node_id":"MDU6TGFiZWwxNTM0NzQzODk=","url":"https://api.github.com/repos/magento/magento2/labels/TECH","name":"TECH","color":"d4c5f9","default":false},{"id":147132994,"node_id":"MDU6TGFiZWwxNDcxMzI5OTQ=","url":"https://api.github.com/repos/magento/magento2/labels/question","name":"question","color":"5319e7","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2015-02-03T17:26:01Z","updated_at":"2018-07-05T07:41:20Z","closed_at":"2018-07-05T07:41:20Z","author_association":"CONTRIBUTOR","body":"In Magento 1, class properties and methods are all defined with _public_ or _protected_ visibility. In PHP, changing the API of a protected property or method usually constitutes a backwards compatibility break. Have Magento considered using _private_ instead of _protected_ visibility as the default alternative to _public_ in Magento 2?\n\nConsider the following examples:\n\n``` php\nnamespace Magento;\n\n// version 1.0\nclass Product\n{\n    protected function somethingInternal() {}\n}\n```\n\n``` php\nnamespace SomeThirdParty;\n\nclass MyProduct extends \\Magento\\Product\n{\n    public function somethingPublic()\n    {\n        // ...\n        parent::somethingInternal();\n        // ...\n    }\n}\n```\n\n``` php\nnamespace SomeOtherThirdParty;\n\nclass MyProduct extends \\Magento\\Product\n{\n    public function someCoolNewMethod() {}\n}\n```\n\n``` php\nnamespace Magento;\n\n// version 1.1\nclass Product\n{\n    // this breaks SomeThirdParty\\MyProduct\n    protected function somethingInternal($newParam) {}\n\n    // this breaks SomeOtherThirdParty\\MyProduct\n    protected function someCoolNewMethod($requiredParam) {}\n}\n```\n\nThe above examples demonstrate how adding or modifying protected methods can break downstream packages. If those methods had been declared private, re-factoring would have been fine without any BC issues.\n\nWhy use _protected_ by default? Presumably it's 'just in case' someone downstream wants to replace or re-use a piece of functionality. The thing to understand is that _protected_ comes with a cost; it essentially means you can't do any re-factoring. If a piece of functionality is really worth exposing then why isn't it public?\n"}}
{"actor":{"display_login":"magento-engcom-team"}}