/**
  * Is method has the same name as the enclosing class
  * (php4 style constructor).
  *
  * @param \PHPMD\AbstractNode $node
  * @return void
  */
 public function apply(AbstractNode $node)
 {
     if ($node->getNode()->getParent() instanceof ASTTrait) {
         return;
     }
     if (strcasecmp($node->getName(), $node->getParentName()) !== 0) {
         return;
     }
     if ($node->getParentType() instanceof InterfaceNode) {
         return;
     }
     if ($node->getNamespaceName() !== '+global') {
         return;
     }
     $this->addViolation($node);
 }
Ejemplo n.º 2
0
 /**
  * @param AbstractNode|MethodNode|ASTMethod $node
  */
 public function apply(AbstractNode $node)
 {
     if ($node->getParentType() instanceof TraitNode && true === $node->isPublic()) {
         $this->addViolation($node);
     }
 }