During porting, we have likely used empty() and isset() excessively where it is not required.
@Tgr says in a code review:
When something is an object or null, just !$handler is easiest to read. empty() is generally disliked in the PHP world (unless you are checking something that might not exist) because it suppresses errors so it's easy to e.g. make a refactoring mistake where the variable is renamed but in the empty check it remains on the old name, causing misbehavior without an explicit error. If the variable can take scalar values, an additional reason not to use empty() is that it accepts a somewhat random list of values (null, false, 0, 0.0, '', '0', []) so it's not trivial to guess what the code is checking for.
Let us git grep for empty() and isset() uses and eliminate uses that aren't required.