/**
  * {@inheritdoc}
  */
 public function check(PhpFileInfo $phpFileInfo)
 {
     $violations = array();
     foreach ($phpFileInfo->methodDefinitions() as $methodDefinition) {
         $ancestors = $this->ancestorResolver->getClassAncestors($phpFileInfo, $methodDefinition->parentName());
         foreach ($ancestors as $ancestor) {
             if ($this->ruleSet->hasMethod($methodDefinition->name(), $ancestor)) {
                 $violations[] = new Violation($methodDefinition, $phpFileInfo, $this->ruleSet->getMethod($methodDefinition->name(), $ancestor)->comment());
             }
         }
     }
     return $violations;
 }
 /**
  * {@inheritdoc}
  */
 public function check(PhpFileInfo $phpFileInfo, RuleSet $ruleSet)
 {
     $violations = array();
     foreach ($phpFileInfo->methodUsages() as $methodUsage) {
         $className = $methodUsage->className();
         if ($ruleSet->hasMethod($methodUsage->name(), $className)) {
             $violations[] = new Violation($methodUsage, $phpFileInfo, $ruleSet->getMethod($methodUsage->name(), $className)->comment());
         }
         $ancestors = $this->ancestorResolver->getClassAncestors($phpFileInfo, $methodUsage->className());
         foreach ($ancestors as $ancestor) {
             if ($ruleSet->hasMethod($methodUsage->name(), $ancestor)) {
                 $violations[] = new Violation(new MethodUsage($methodUsage->name(), $ancestor, $methodUsage->getLineNumber(), $methodUsage->isStatic()), $phpFileInfo, $ruleSet->getMethod($methodUsage->name(), $ancestor)->comment());
             }
         }
     }
     return $violations;
 }