is there a way to merge/autofix things like
if($someValue === true) {
if($otherValue === false) {
if($yetAnotherValue === true) {
...
}
}
}
to
if($someValue === true && $otherValue === false && $yetAnotherValue === true) {
...
}
or if the line is bigger then 120 symbols then
if($someValue === true &&
$otherValue === false &&
$yetAnotherValue === true) {
...
}
I think that it should be line-breaked if it have three or more expressions.
When we QFing some expressions (like the merged conditions) PS applies code formatting automatically, so this up to code formatting settings =)
The QF will be in the next release.
@kalessil Also it might be good thing to suggest to move conditional to a variable (if it's too big), what I mean is
From
if (!Request::get('asid') ||
!Request::get('campaign_id') ||
!Request::get('ad_id') ||
!Request::get('impressed_user') ||
!Request::get('action')) {
return response()->json(['error' => 400, 'message' => 'Bad Request; Missing parameters.'], 400);
}
To
$isMissingParameters = !Request::get('asid') ||
!Request::get('campaign_id') ||
!Request::get('ad_id') ||
!Request::get('impressed_user') ||
!Request::get('action');
if ($isMissingParameters) {
return response()->json(['error' => 400, 'message' => 'Bad Request; Missing parameters.'], 400);
}
This would be like shooting own feet because non-optimal conditions checks cannot be applied.
Implemented
Most helpful comment
I think that it should be line-breaked if it have three or more expressions.