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

У private и protected методов и свойств класса используюется префикс "_" #10

Open
dankocherga opened this issue Sep 10, 2013 · 1 comment

Comments

@dankocherga
Copy link
Contributor

Правильно:

class Foo
{
   private $_foo = 42;

   protected function _log()
   {
   }

   public function test()
   {
   }
}

Неправильно:

class Foo
{
   private $foo = 42;

   protected function log()
   {
   }

   public function _test()
   {
   }
}
@vsushkov
Copy link
Contributor

Кстати говоря, в PSR2 не разрешается использовать символ подчеркивания для того, чтобы сообщать о области видимости метода. Ну и Кент Бек об этом же говорил (не стоит кодировать в имени переменной больше информации, чем «метафора»).

rut4 added a commit to rut4/Oggetto-Coding-Standard that referenced this issue Jun 10, 2014
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

2 participants