<?php

namespace yswery\DNS;

class StackableResolver {

    /**
     * @var array
     */
    protected $resolvers;

    public function __construct(array $resolvers = array())
    {
        $this->resolvers = $resolvers;
    }

    public function get_answer($question) 
    {
        foreach ($this->resolvers as $resolver) {
            $answer = $resolver->get_answer($question);
            if ($answer) {
                return $answer;
            }
        }
    }

}

<?php

namespace yswery\DNS;

class StackableResolver {

    /**
     * @var array
     */
    protected $resolvers;

    public function __construct(array $resolvers = array())
    {
        $this->resolvers = $resolvers;
    }

    public function get_answer($question) 
    {
        foreach ($this->resolvers as $resolver) {
            $answer = $resolver->get_answer($question);
            if ($answer) {
                return $answer;
            }
        }
        
        return array();
    }

}

Fix bug when zero records with stackable resolver
Fix bug when zero records with stackable resolver

we need to return an empty array if we dont have any records to respond with from the storage or the recursive query.