Open danilyer228 opened 3 years ago
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
.
@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.
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".