/** * Checks if this node has a suppressed annotation for the given rule * instance. * * @param PHP_PMD_Rule $rule The context rule instance. * * @return boolean */ public function hasSuppressWarningsAnnotationFor(PHP_PMD_Rule $rule) { if ($this->annotations === null) { $this->annotations = new PHP_PMD_Node_Annotations($this); } return $this->annotations->suppresses($rule); }
/** * testCollectionReturnsTrueWhenOneMatchingAnnotationExists * * @return void */ public function testCollectionReturnsTrueWhenOneMatchingAnnotationExists() { $class = $this->getClassMock(); $class->expects($this->once())->method('__call')->with($this->equalTo('getDocComment'))->will($this->returnValue('/** * @SuppressWarnings("FooBar") * @SuppressWarnings("PMD") */')); $annotations = new PHP_PMD_Node_Annotations($class); $this->assertTrue($annotations->suppresses($this->getRuleMock())); }