-
Notifications
You must be signed in to change notification settings - Fork 2k
refactor: replace empty() Part 1 #8345
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
Conversation
102b20c to
c666bf7
Compare
|
👋 Hi, @kenjis! |
52a6dbc to
bd0ef26
Compare
0364948 to
687b611
Compare
|
👋 Hi, @kenjis! |
1e92f25 to
269986e
Compare
| if ($this->tempUseSoftDeletes) { | ||
| $builder->where($this->table . '.' . $this->deletedField, null); | ||
| } elseif ($this->useSoftDeletes && empty($builder->QBGroupBy) && $this->primaryKey) { | ||
| } elseif ($this->useSoftDeletes && ($builder->QBGroupBy === []) && $this->primaryKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is () around $builder->QBGroupBy === [] is forced by our tooling? Seems unnecessary.
| // Some databases, like PostgreSQL, need order | ||
| // information to consistently return correct results. | ||
| if ($builder->QBGroupBy && empty($builder->QBOrderBy) && $this->primaryKey) { | ||
| if ($builder->QBGroupBy && ($builder->QBOrderBy === []) && $this->primaryKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
|
||
| $output = \ob_get_contents(); | ||
| if (empty($response->getBody()) && ! ($output === '' || $output === false)) { | ||
| if (($response->getBody() === null) && ! ($output === '' || $output === false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably unnecessary () around $response->getBody() === null.
| $message = str_replace( | ||
| '{param}', | ||
| empty($this->rules[$param]['label']) ? $param : lang($this->rules[$param]['label']), | ||
| (! isset($this->rules[$param]['label'])) ? $param : lang($this->rules[$param]['label']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need () around ! isset($this->rules[$param]['label'])?
|
|
||
| $fileExt = pathinfo($view, PATHINFO_EXTENSION); | ||
| $view = empty($fileExt) ? $view . '.php' : $view; // allow Views as .html, .tpl, etc (from CI3) | ||
| $view = ($fileExt === '') ? $view . '.php' : $view; // allow Views as .html, .tpl, etc (from CI3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here... is it supposed to increase readability? For me, it's the opposite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, yes.
|
|
||
| // Remove the () and spaces to we have just the parameter left | ||
| $param = ! empty($param) ? trim($param[0], '() ') : null; | ||
| $param = ($param !== []) ? trim($param[0], '() ') : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With only one check, I see no added value in using ().
| $fileExt = pathinfo($view, PATHINFO_EXTENSION); | ||
| // allow Views as .html, .tpl, etc (from CI3) | ||
| $this->renderVars['view'] = empty($fileExt) ? $view . '.php' : $view; | ||
| $this->renderVars['view'] = ($fileExt === '') ? $view . '.php' : $view; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| $this->renderVars['view'], | ||
| 'Views', | ||
| empty($fileExt) ? 'php' : $fileExt | ||
| ($fileExt === '') ? 'php' : $fileExt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments, but it may be only my preference.
|
There are some unnecessary |
Needs #8344Description
Checklist: