public function validateArguments()
    {
        $argumentDefinitions = $this->prepareArguments();
        if (!count($argumentDefinitions)) {
            return;
        }

        /** @var $registeredArgument ArgumentDefinition */
        foreach ($argumentDefinitions as $argumentName => $registeredArgument) {
            if ($this->hasArgument($argumentName)) {
                if ($this->arguments[$argumentName] === $registeredArgument->getDefaultValue()) {
                    continue;
                }

                $type = $registeredArgument->getType();
                if ($type === 'array') {
                    if (!is_array($this->arguments[$argumentName]) && !$this->arguments[$argumentName] instanceof \ArrayAccess && !$this->arguments[$argumentName] instanceof \Traversable) {
                        throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "array", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '"', 1237900529);
                    }
                } elseif ($type === 'boolean') {
                    if (!is_bool($this->arguments[$argumentName])) {
                        throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "boolean", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1240227732);
                    }
                } elseif (class_exists($type, false)) {
                    if (!($this->arguments[$argumentName] instanceof $type)) {
                        if (is_object($this->arguments[$argumentName])) {
                            throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . get_class($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475114);
                        } else {
                            throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475113);
                        }
                    }
                }
            }
        }
    }