I’m about to migrate some code to the PSR-2 standard. In my code i have if statements with multiple lines as expression:
if ( $field->getBlockMode() == FieldInterface::BLOCK_MODE_HIDEVAR &&
!isset($this->enabledBlocks[$field->getBlock()])
) {
}
What’s the best practice to write such expressions?
How about making it a one-liner to avoid that problem and make the statement more readable:
Alternative:
I usually do it with methods, this could looke like that:
This way, the optimization of
&&still takes place.