forward()) { $tokenCode = $stream->getCurrentCode(); if ($tokenCode == T_NAMESPACE) { $namespace = $this->extractNamespace($stream); if ($namespace === null) { return null; } $result['namespace'] = $namespace; } if ($tokenCode == T_CLASS) { $className = $this->extractClassName($stream); if ($className === null) { return null; } $result['class'] = $className; } } if (!$result) { return null; } return $result; } protected function extractClassName($stream) { if ($stream->getNextExpected(T_WHITESPACE) === null) { return null; } return $stream->getNextExpectedTerminated([T_STRING], [T_WHITESPACE, ';']); } protected function extractNamespace($stream) { if ($stream->getNextExpected(T_WHITESPACE) === null) { return null; } return $stream->getNextExpectedTerminated([T_STRING, T_NS_SEPARATOR], [T_WHITESPACE, ';']); } }