/** * {@inheritdoc} */ public function leaveNode(Node $node) { if ($this->filter->matchesFilterPattern($node) && $this->filter->hasTypedParameters($node)) { /* @var ClassMethod $node */ $this->modifyDocBlock($node); $this->removeTypeHints($node); } }
public function it_modifies_class_method_nodes(ClassMethod $node, NodeFilter $filter, Doc $doc, Generator $generator, Param $param) { $filter->matchesFilterPattern($node)->willReturn(true); $filter->hasTypedParameters($node)->willReturn(true); $node->getDocComment()->willReturn($doc); $node->getAttributes()->willReturn(['comments' => []]); $node->setAttribute('comments', [$doc])->shouldBeCalled(); $node->getParams()->willReturn([$param]); $param->type = new Node\Name([]); $doc->getText()->shouldBeCalled(); $doc->setText(Argument::any())->shouldBeCalled(); $generator->removeParamTags('/** */')->willReturn('/** foo */'); $generator->addParams($node, '/** foo */')->willReturn('/** */'); $reflection = new \ReflectionProperty(ToDocBlockVisitor::class, 'docBlock'); $reflection->setAccessible(true); $reflection->setValue($this->getWrappedObject(), $generator); $this->leaveNode($node); if (null !== $param->type) { throw new FailedPredictionException('param type wasnt set to null'); } }