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

3.5. Именование методов #27

Open
peter-gribanov opened this issue Dec 20, 2019 · 1 comment
Open

3.5. Именование методов #27

peter-gribanov opened this issue Dec 20, 2019 · 1 comment
Milestone

Comments

@peter-gribanov
Copy link

3.5. Именование методов

Названия методов ДОЛЖНЫ описывать предназначение их использования внешним кодом, а не детали реализации.

// Не правильно
public function findUserById(int $id): ?User
// Правильно
public function find(int $id): ?User

Первый вариант описывает реализацию, в отличии от второго. И название метода дублирует аргумент и возвращаемое значение. Масло масленное.

@index0h
Copy link
Owner

index0h commented Dec 20, 2019

Мне самому этот пункт не очень нравится, я его подкорректирую

@index0h index0h added this to the 1.1 milestone Dec 21, 2019
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