Exemplo n.º 1
0
 /**
  * Tests if the given variable node os part of an index expression.
  *
  * @param \PHPMD\Node\ASTNode $node
  * @return boolean
  */
 protected function isWrappedByIndexExpression(ASTNode $node)
 {
     return $node->getParent()->isInstanceOf('ArrayIndexExpression') || $node->getParent()->isInstanceOf('StringIndexExpression');
 }
Exemplo n.º 2
0
 /**
  * This method checks that the given property postfix is accessed on an
  * instance or static reference to the given class.
  *
  * @param \PHPMD\Node\ClassNode $class
  * @param \PHPMD\Node\ASTNode $postfix
  * @return boolean
  */
 protected function isInScopeOfClass(ClassNode $class, ASTNode $postfix)
 {
     $owner = $postfix->getParent()->getChild(0);
     if ($owner->isInstanceOf('PropertyPostfix')) {
         $owner = $owner->getParent()->getParent()->getChild(0);
     }
     return $owner->isInstanceOf('SelfReference') || $owner->isInstanceOf('StaticReference') || strcasecmp($owner->getImage(), '$this') === 0 || strcasecmp($owner->getImage(), $class->getImage()) === 0;
 }
Exemplo n.º 3
0
 /**
  * This method checks that the given method postfix is accessed on an
  * instance or static reference to the given class.
  *
  * @param \PHPMD\Node\ClassNode $class
  * @param \PHPMD\Node\ASTNode $postfix
  * @return boolean
  */
 private function isClassScope(ClassNode $class, ASTNode $postfix)
 {
     $owner = $postfix->getParent()->getChild(0);
     return $owner->isInstanceOf('MethodPostfix') || $owner->isInstanceOf('SelfReference') || $owner->isInstanceOf('StaticReference') || strcasecmp($owner->getImage(), '$this') === 0 || strcasecmp($owner->getImage(), $class->getImage()) === 0;
 }