Issues

ZF2-252: class exist check in BuilderDefinition

Issue Type: Bug Created: 2012-04-03T11:51:54.000+0000 Last Updated: 2012-05-26T15:54:15.000+0000 Status: Resolved Fix version(s): Reporter: BLANCHON Vincent (blanchon_vincent) Assignee: BLANCHON Vincent (blanchon_vincent) Tags: - Zend\Di

Related issues: Attachments:

Description

In Zend\Di\DefinitionList :

<pre class="highlight">
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 :

<pre class="highlight">
$this->getLocator()->definitions()->addDefinition($compiler,false);

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

<pre class="highlight">
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

Posted by Adam Lundrigan (adamlundrigan) on 2012-04-04T15:02:10.000+0000

Added code tags

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts