Open smileBeda opened 3 years ago
As far I see, most of the commonly accepted order of public, protected, private in PHP is:
public $public = 'Public'; protected $protected = 'Protected'; private $private = 'Private';
Or
public function MyPublic() { } protected function MyProtected() { } private function MyPrivate() { }
(see also https://www.php.net/manual/en/language.oop5.visibility.php)
However WPPB does this exactly the other way around. Let's look at https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/blob/master/plugin-name/includes/class-plugin-name.php for example. It first declares public constructor, then it declares private and protected methods, then the public ones.
Why this discrepancy from mainstream?
As far I see, most of the commonly accepted order of public, protected, private in PHP is:
Or
(see also https://www.php.net/manual/en/language.oop5.visibility.php)
However WPPB does this exactly the other way around. Let's look at https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/blob/master/plugin-name/includes/class-plugin-name.php for example. It first declares public constructor, then it declares private and protected methods, then the public ones.
Why this discrepancy from mainstream?