I did not found this discussion, so I will ask: why model methods like find
and findFirst
return false
instead null
when no objects are found?
At least for me, this doesn't make any sense, because you have to prepare the application to handle objects and booleans. IMHO, null
is the right way to represent the lack of something, or you could write a method like this:
public function someMethod(SomeClass $someObject = false)
Extra shot: rewrite them to return null
will bring PHP7's null coalesce operator compatibility.