Adapt use of `empty` to old versions of PHP

`empty` used to take as argument only variables instead of expressions.