We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
You broke your code. https://github.com/jupeter/clean-code-php#use-default-arguments-instead-of-short-circuiting-or-conditionals
Original is good
function createMicrobrewery($name = null) { $breweryName = $name ?: 'Hipster Brew Co.'; var_dump($breweryName); } createMicrobrewery(); createMicrobrewery(''); createMicrobrewery(null); createMicrobrewery('foo');
Result
string(16) "Hipster Brew Co." string(16) "Hipster Brew Co." string(16) "Hipster Brew Co." string(3) "foo"
Your "good"
function createMicrobrewery($breweryName = 'Hipster Brew Co.') { var_dump($breweryName); } createMicrobrewery(); createMicrobrewery(''); createMicrobrewery(null); createMicrobrewery('foo');
string(16) "Hipster Brew Co." string(0) "" NULL string(3) "foo"
Result is different. You broke your code.
The text was updated successfully, but these errors were encountered:
Good point. Do you have propose of better example?
Sorry, something went wrong.
Problem is fixed in #26
No branches or pull requests
You broke your code.
https://github.com/jupeter/clean-code-php#use-default-arguments-instead-of-short-circuiting-or-conditionals
Original is good
Result
Your "good"
Result
Result is different. You broke your code.
The text was updated successfully, but these errors were encountered: