src/Tomahawk/Templating/TemplateNameParser.php
public function parse($name)
    {
        if ($name instanceof TemplateReferenceInterface) {
            return $name;
        }

        // No extension? Default to php
        $ext = pathinfo($name, PATHINFO_EXTENSION);

        // This is horrible and I don't know why I did it
        // Will deprecate in a future version
        if ( ! $ext) {
            $name .= '.php';
        }

        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }

        // normalize name
        $name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')));

        if (false !== strpos($name, '..')) {
            throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
        }

        if ($this->isAbsolutePath($name) || !preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)$/', $name, $matches) || 0 === strpos($name, '@')) {
            return parent::parse($name);
        }

        $template = new TemplateReference($matches[1], $matches[2], $matches[3], $matches[4]);

        if ($template->get('bundle')) {
            try {
                $this->kernel->getBundle($template->get('bundle'));
            }
            catch (\Exception $e) {
                throw new \InvalidArgumentException(sprintf('Template name "%s" is not valid.', $name), 0, $e);
            }
        }

        return $this->cache[$name] = $template;
    }
public function parse($name)
    {
        if ($name instanceof TemplateReferenceInterface) {
            return $name;
        }

        // No extension? Default to php
        $ext = pathinfo($name, PATHINFO_EXTENSION);

        // This is horrible and I don't know why I did it
        // Will deprecate in a future version
        if ( ! $ext) {
            $name .= '.php';
        }

        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }

        // normalize name
        $name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')));

        if (false !== strpos($name, '..')) {
            throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
        }

        if ($this->isAbsolutePath($name) || !preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)$/', $name, $matches) || 0 === strpos($name, '@')) {
            return parent::parse($name);
        }

        $template = new TemplateReference($matches[1], $matches[2], $matches[3], $matches[4]);

        if ($template->get('bundle')) {
            try {
                $this->kernel->getBundle($template->get('bundle'));
            }
            catch (\Exception $e) {
                throw new \InvalidArgumentException(sprintf('Template name "%s" is not valid.', $name), 0, $e);
            }
        }

        return $this->cache[$name] = $template;
    }
{@inheritdoc}