/**
  * {@inheritdoc}
  */
 protected function checkNodeImage(PHP_PMD_AbstractNode $node)
 {
     $excludedVariables = explode('|', $this->getStringProperty('excludeVariables'));
     if (!in_array($node->getImage(), $excludedVariables)) {
         parent::checkNodeImage($node);
     }
 }
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $staticReferences = $node->findChildrenOfType('ClassOrInterfaceReference');
     foreach ($staticReferences as $reference) {
         if ($this->isReferenceInParameter($reference)) {
             continue;
         }
         $this->addViolation($reference, array($reference->getImage(), $node->getImage()));
     }
 }
 public function apply(PHP_PMD_AbstractNode $node)
 {
     foreach ($node->findChildrenOfType('FormalParameter') as $param) {
         $declarator = $param->getFirstChildOfType('VariableDeclarator');
         $value = $declarator->getValue();
         if (!$this->isBooleanValue($value)) {
             continue;
         }
         $this->addViolation($param, array($node->getImage(), $declarator->getImage()));
     }
 }
 public function apply(PHP_PMD_AbstractNode $node)
 {
     return;
     // not good enough, if, elseif,... nest each other and get detected by this rule :(
     foreach ($node->findChildrenOfType('ScopeStatement') as $scope) {
         if (!$this->isNestedScope($scope)) {
             continue;
         }
         $this->addViolation($scope, array($node->getImage()));
     }
 }
 public function apply(PHP_PMD_AbstractNode $node)
 {
     foreach ($node->findChildrenOfType('ScopeStatement') as $scope) {
         $parent = $scope->getParent();
         if (!$this->isIfOrElseIfStatement($parent)) {
             continue;
         }
         if (!$this->isElseScope($scope, $parent)) {
             continue;
         }
         $this->addViolation($scope, array($node->getImage()));
     }
 }
Exemplo n.º 6
0
 /**
  * Tests if the given variable represents one of the PHP super globals
  * that are available in scopes.
  *
  * @param PHP_PMD_AbstractNode $variable The currently analyzed variable node.
  *
  * @return boolean
  */
 protected function isNotSuperGlobal(PHP_PMD_AbstractNode $variable)
 {
     return !isset(self::$_superGlobals[$variable->getImage()]);
 }
 /**
  * Checks if the given node was already processed.
  *
  * @param PHP_PMD_AbstractNode $node The node to check.
  *
  * @return boolean
  */
 protected function isNotProcessed(PHP_PMD_AbstractNode $node)
 {
     return !isset($this->processedVariables[$node->getImage()]);
 }