Checks if one of the annotations suppresses the given rule.
public suppresses ( PHPMD\Rule $rule ) : boolean | ||
$rule | PHPMD\Rule | |
Результат | boolean |
/** * Checks if this node has a suppressed annotation for the given rule * instance. * * @param \PHPMD\Rule $rule * @return boolean */ public function hasSuppressWarningsAnnotationFor(Rule $rule) { if ($this->annotations === null) { $this->annotations = new 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 Annotations($class); $this->assertTrue($annotations->suppresses($this->getRuleMock())); }