Skip to content
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

Public, protected, private sequence #563

Open
smileBeda opened this issue Jul 2, 2021 · 0 comments
Open

Public, protected, private sequence #563

smileBeda opened this issue Jul 2, 2021 · 0 comments

Comments

@smileBeda
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant