Avoid negative conditionals
Certainly! Writing clean and readable PHP code involves avoiding negative conditionals and using positive conditionals instead. Negative conditionals can make the code harder to understand and follow. Here's an example of how you can refactor code to avoid negative conditionals:
code with negative conditionals (Bad):
function isNotParent($node) : bool
{
}
code with positive conditionals (Good):
function isParent($node) : bool
{
}
Top comments (0)