protected function onMatchFound($start, TokenArrayIteratorInterface $tai) { if (true === $this->nestedMode) { $tai->seek($start); $tai->next(); } }
/** * Skips a chain like \My\Object or My\Object * * @return bool, whether or not a ns chain could have been found at the current tai position. * In case of a successful match, the cursor position is AFTER the last token * of the ns chain. * */ public static function skipNsChain(TokenArrayIteratorInterface $tai) { $ret = false; if (false !== ($startKey = $tai->key())) { $lastIsString = false; $cur = $tai->current(); // possibly starting with backslash if (true === TokenTool::match(T_NS_SEPARATOR, $cur)) { $tai->next(); $cur = $tai->current(); } // containing x repetitions of string backslash sequences while (true === TokenTool::match(T_STRING, $cur)) { $lastIsString = true; $tai->next(); $cur = $tai->current(); if (true === TokenTool::match(T_NS_SEPARATOR, $cur)) { $tai->next(); $cur = $tai->current(); $lastIsString = false; } } if (true === $lastIsString) { $ret = true; } else { $tai->seek($startKey); } } return $ret; }