ZF2-252: class exist check in BuilderDefinition

Description

In Zend\Di\DefinitionList :


public function getClassSupertypes($class)
{
    $supertypes = array();
    /** @var $definition Definition\Definition */
    foreach ($this as $definition) {
        $supertypes = array_merge($supertypes, $definition->getClassSupertypes($class));
    }
    // @todo remove duplicates?
    return $supertypes;
}

no check with hasClass(), so when i use the builderDefinition in top of the list :


$this->getLocator()->definitions()->addDefinition($compiler,false);

i have an exception for definition unknow, perhaps add 'if ($definition->hasClass($class))' for verification :


public function getClassSupertypes($class)
{
    $supertypes = array();
    /** @var $definition Definition\Definition */
    foreach ($this as $definition) {
        if ($definition->hasClass($class))
        {
            $supertypes = array_merge($supertypes, $definition->getClassSupertypes($class));
        }
    }
    // @todo remove duplicates?
    return $supertypes;
}

because with access to getClassSupertypes on BuilderDefinition, an exception is throwed, and if i have runtime in the list, it's stopped with the exception.

Comments

Added code tags