... database logics ...
if(!empty($db_results)) {
return $db_results;
}
}
does not require neither return []; nor return NULL; right?
What kind of syntax is this? ?Array $results It is an error
sorry, fixed I was confusing with named parameters, return type declarations don't require a named value
This asserts that return value should be either null or array. In this case, if that condition isn't satisfied, then nothing is returned and it is an error. You should add return null; after that if statement to comply with defined return type.
Обсуждают сегодня