protected function analyzeStream() { $this->newContent = ''; $getNameType = $this->registry->createUnionType(array($this->registry->getClassOrCreate('ReflectionZendExtension'), $this->registry->getClassOrCreate('ReflectionExtension'), $this->registry->getClassOrCreate('ReflectionFunction'), $this->registry->getClassOrCreate('ReflectionParameter'), $this->registry->getClassOrCreate('ReflectionClass'), $reflectionMethodType = $this->registry->getClassOrCreate('ReflectionMethod'))); $reflectionPropertyType = $this->registry->getClassOrCreate('ReflectionProperty'); $lastNode = null; while ($this->stream->moveNext()) { switch (true) { case $this->stream->node instanceof \PHPParser_Node_Expr_MethodCall && $lastNode !== $this->stream->node: if (NodeUtil::isCallToMethod($this->stream->node, 'getName') && null !== ($type = $this->stream->node->var->getAttribute('type')) && $this->isSubtype($type, $getNameType)) { $this->newContent .= '->name'; $this->stream->skipUntil('END_OF_CALL'); break; } if (NodeUtil::isCallToMethod($this->stream->node, 'getDeclaringClass') && null !== ($type = $this->stream->node->var->getAttribute('type')) && ($this->isSubtype($type, $reflectionMethodType) || $this->isSubtype($type, $reflectionPropertyType)) && ($parent = $this->stream->node->getAttribute('parent')) && NodeUtil::isCallToMethod($parent, 'getName')) { $this->newContent .= '->class'; $this->stream->skipUntil('END_OF_CALL'); $this->stream->skipUntil('END_OF_CALL'); break; } $this->newContent .= $this->stream->token->getContent(); break; default: $this->newContent .= $this->stream->token->getContent(); } $lastNode = $this->stream->node; } }