function it_checks_an_invalid_node_with_only_rule(RuleInterface $rule, NodeInterface $node, ViolationInterface $violation)
 {
     $rule->getSubject()->willReturn('foo\\bar');
     $rule->getRequirements()->willReturn(array('blu', 'bla', 'bli'));
     $rule->getType()->willReturn(RuleInterface::TYPE_ONLY);
     $node->getSubject()->willReturn('foo\\bar\\baz');
     $node->getTokens()->willReturn(array('blu', 'bla', 'blo', 'bly'));
     $violation->getNode()->willReturn($node);
     $violation->getRule()->willReturn($rule);
     $violation->getType()->willReturn(ViolationInterface::TYPE_ERROR);
     $violation->getTokenViolations()->willReturn(array('blo', 'bly'));
     $this->check($rule, $node)->shouldBeLikeExpectedViolation($violation);
 }
 /**
  * Checks if a token fits a "only" rule or not.
  *
  * @param RuleInterface $rule
  * @param string        $token
  *
  * @return bool
  */
 private function checkTokenForOnlyRule(RuleInterface $rule, $token)
 {
     $fitRuleRequirements = false;
     foreach ($rule->getRequirements() as $req) {
         if (false !== strpos($token, $req)) {
             $fitRuleRequirements = true;
         }
     }
     return $fitRuleRequirements;
 }