Skip to content

Commit

Permalink
Merge pull request #379 from jaymoulin/code-clean
Browse files Browse the repository at this point in the history
Code cleaning
  • Loading branch information
Manuel Pichler committed Jan 20, 2017
2 parents 6ece93c + 902da6c commit bb57b00
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/php/PHPMD/AbstractNode.php
Expand Up @@ -100,7 +100,7 @@ public function __call($name, array $args)
* Returns the parent of this node or <b>null</b> when no parent node
* exists.
*
* @return \PHPMD\AbstractNode
* @return ASTNode
*/
public function getParent()
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/php/PHPMD/Report.php
Expand Up @@ -54,7 +54,7 @@ class Report
/**
* List of rule violations detected in the analyzed source code.
*
* @var \PHPMD\RuleViolation[]
* @var array
*/
private $ruleViolations = array();

Expand Down Expand Up @@ -115,7 +115,7 @@ public function isEmpty()
/**
* Returns an iterator with all occurred rule violations.
*
* @return \Iterator
* @return \PHPMD\RuleViolation[]
*/
public function getRuleViolations()
{
Expand Down
5 changes: 3 additions & 2 deletions src/main/php/PHPMD/Rule/CleanCode/ElseExpression.php
Expand Up @@ -43,6 +43,7 @@

use PHPMD\AbstractNode;
use PHPMD\AbstractRule;
use PHPMD\Node\ASTNode;
use PHPMD\Rule\FunctionAware;
use PHPMD\Rule\MethodAware;

Expand Down Expand Up @@ -82,15 +83,15 @@ public function apply(AbstractNode $node)
}
}

private function isElseScope($scope, $parent)
private function isElseScope($scope, ASTNode $parent)
{
return (
count($parent->getChildren()) === 3 &&
$scope->getNode() === $parent->getChild(2)->getNode()
);
}

private function isIfOrElseIfStatement($parent)
private function isIfOrElseIfStatement(ASTNode $parent)
{
return ($parent->getName() === "if" || $parent->getName() === "elseif");
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/php/PHPMD/Rule/CleanCode/StaticAccess.php
Expand Up @@ -87,20 +87,20 @@ public function apply(AbstractNode $node)
}
}

private function isStaticMethodCall($methodCall)
private function isStaticMethodCall(AbstractNode $methodCall)
{
return $methodCall->getChild(0)->getNode() instanceof ASTClassOrInterfaceReference &&
$methodCall->getChild(1)->getNode() instanceof ASTMethodPostfix &&
!$this->isCallingParent($methodCall) &&
!$this->isCallingSelf($methodCall);
}

private function isCallingParent($methodCall)
private function isCallingParent(AbstractNode $methodCall)
{
return $methodCall->getChild(0)->getNode() instanceof ASTParentReference;
}

private function isCallingSelf($methodCall)
private function isCallingSelf(AbstractNode $methodCall)
{
return $methodCall->getChild(0)->getNode() instanceof ASTSelfReference;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/php/PHPMD/RuleSetFactory.php
Expand Up @@ -534,9 +534,9 @@ private function getPropertyValue(\SimpleXMLElement $propertyNode)
*
* http://pmd.sourceforge.net/pmd-5.0.4/howtomakearuleset.html#Excluding_files_from_a_ruleset
*
* @param $fileName The filename of a rule-set definition.
* @param string $fileName The filename of a rule-set definition.
*
* @return array
* @return array|null
* @throws \RuntimeException
*/
public function getIgnorePattern($fileName)
Expand Down Expand Up @@ -564,5 +564,6 @@ public function getIgnorePattern($fileName)

return $excludes;
}
return null;
}
}

0 comments on commit bb57b00

Please sign in to comment.