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

"Use default arguments instead of short circuiting or conditionals" #189

Open
danilyer228 opened this issue Apr 28, 2021 · 2 comments
Open

Comments

@danilyer228
Copy link

https://github.com/jupeter/clean-code-php#use-default-arguments-instead-of-short-circuiting-or-conditionals

I think, it's must be in "Functions" section and renamed with something like "Don't pass NULL arguments".

@peter-gribanov
Copy link
Contributor

I agree that this section should be moved to the Functions section. But over the name of this section, i would have thought more. This section is about how to properly use default values for arguments, not how not to pass NULL.

@danon
Copy link

danon commented Jun 15, 2022

@peter-gribanov Not sure this is actually a useful tip.

First of all, I'm not actually sure that default arguments (or optional arguments) are a good design, by that's my opinion.

Regarding "clean code php", notice that when using polymorphism, you'd have to declare the default value multiple times (in the interface, and then in the implementations).

I really think this tip isn't helpful.

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

3 participants