public function search($name, $type = null, $deepSearch = true)
    {
        /** @var TokenInterface[] $array */
        $array = $this->getArrayCopy();

        foreach ($array as $token) {
            if (fnmatch($name, $token->getName())) {
                if ($type === null) {
                    return $token;
                }
                if ($token->getTokenType() === $type) {
                    return $token;
                }
            }
            if ($token instanceof Block && $token->hasChildren() && $deepSearch) {
                if ($res = $this->deepSearch($token, $name, $type)) {
                    return $res;
                }
            }
        }
        return null;
    }