php – append to the matrix if it is not empty

I want to call a series of functions to build a matrix, like this:

$ array['conditions'][]    = $ this-> function1 ($ input1);
$ array['conditions'][]    = $ this-> function2 ($ input2);
$ array['conditions'][]    = $ this-> function3 ($ input3);

However, each function can return a matrix with values ​​or an empty matrix (depending on the input). In the case of an empty matrix returned, $ array['conditions'] It is contaminated with a lot of empty entries, which is a problem when it comes to the maintenance of the unit test. If I add additional functions, I have to go back and update the expected value for all my tests.

I could do something like:

$ function1_return = $ this-> function1 ($ input1);
if (! empty ($ function1_return) {
$ array['conditions'][]    = $ function1_return;
}

But I hope there is a cleaner way? I also tried to eliminate any empty value after the fact, but it was in vain (array_filter, for example, keep any matrix key).