src/main/php/PHPMD/Rule/Design/EvalExpression.php 1 location
|
@@ 28-43 (lines=16) @@
|
| 25 |
|
/** |
| 26 |
|
* This rule class detects the usage of PHP's eval-expression. |
| 27 |
|
*/ |
| 28 |
|
class EvalExpression extends AbstractRule implements MethodAware, FunctionAware |
| 29 |
|
{ |
| 30 |
|
/** |
| 31 |
|
* This method checks if a given function or method contains an eval-expression |
| 32 |
|
* and emits a rule violation when it exists. |
| 33 |
|
* |
| 34 |
|
* @param \PHPMD\AbstractNode $node |
| 35 |
|
* @return void |
| 36 |
|
*/ |
| 37 |
|
public function apply(AbstractNode $node) |
| 38 |
|
{ |
| 39 |
|
foreach ($node->findChildrenOfType('EvalExpression') as $eval) { |
| 40 |
|
$this->addViolation($eval, array($node->getType(), $node->getName())); |
| 41 |
|
} |
| 42 |
|
} |
| 43 |
|
} |
| 44 |
|
|
src/main/php/PHPMD/Rule/Design/ExitExpression.php 1 location
|
@@ 28-43 (lines=16) @@
|
| 25 |
|
/** |
| 26 |
|
* This rule class detects the usage of PHP's exit statement. |
| 27 |
|
*/ |
| 28 |
|
class ExitExpression extends AbstractRule implements MethodAware, FunctionAware |
| 29 |
|
{ |
| 30 |
|
/** |
| 31 |
|
* This method checks if a given function or method contains an exit-expression |
| 32 |
|
* and emits a rule violation when it exists. |
| 33 |
|
* |
| 34 |
|
* @param \PHPMD\AbstractNode $node |
| 35 |
|
* @return void |
| 36 |
|
*/ |
| 37 |
|
public function apply(AbstractNode $node) |
| 38 |
|
{ |
| 39 |
|
foreach ($node->findChildrenOfType('ExitExpression') as $exit) { |
| 40 |
|
$this->addViolation($exit, array($node->getType(), $node->getName())); |
| 41 |
|
} |
| 42 |
|
} |
| 43 |
|
} |
| 44 |
|
|
src/main/php/PHPMD/Rule/Design/GotoStatement.php 1 location
|
@@ 30-45 (lines=16) @@
|
| 27 |
|
* |
| 28 |
|
* @since 1.1.0 |
| 29 |
|
*/ |
| 30 |
|
class GotoStatement extends AbstractRule implements MethodAware, FunctionAware |
| 31 |
|
{ |
| 32 |
|
/** |
| 33 |
|
* This method should implement the violation analysis algorithm of concrete |
| 34 |
|
* rule implementations. All extending classes must implement this method. |
| 35 |
|
* |
| 36 |
|
* @param \PHPMD\AbstractNode $node |
| 37 |
|
* @return void |
| 38 |
|
*/ |
| 39 |
|
public function apply(AbstractNode $node) |
| 40 |
|
{ |
| 41 |
|
foreach ($node->findChildrenOfType('GotoStatement') as $goto) { |
| 42 |
|
$this->addViolation($goto, array($node->getType(), $node->getName())); |
| 43 |
|
} |
| 44 |
|
} |
| 45 |
|
} |
| 46 |
|
|