ZF-11062: Unnecessary code


At the beginning of "__construct" method, the $options parameter type is checked:

    if (null !== $options) {
        if (is_string($options)) {
        } elseif (is_array($options)) {
        } elseif ($options instanceof Zend_Config) {
        } else {
            require_once 'Zend/Layout/Exception.php';
            throw new Zend_Layout_Exception('Invalid option provided to constructor');

Then, setOptions and setConfig do it again:

    public function setOptions($options)
        if ($options instanceof Zend_Config) {
            $options = $options->toArray();

    public function setConfig(Zend_Config $config)


A typical use case:

$layout = new Zend_Layout();

$layout->setOptions($options); // A check is needed
$layout->setConfig($config); // A check is needed

The issue can be closed.

But not in the __construct method...

if (is_array($options) || ($options instanceof Zend_Config)) { $this->setOptions($options); }