Skip to content

Commit

Permalink
Fix [Naming]: Trait can have method same as trait's name
Browse files Browse the repository at this point in the history
  • Loading branch information
Gasillo committed Nov 12, 2013
1 parent f2255e0 commit f93be40
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -67,17 +67,18 @@ class PHP_PMD_Rule_Naming_ConstructorWithNameAsEnclosingClass
implements PHP_PMD_Rule_IMethodAware
{
/**
* Extracts all variable and variable declarator nodes from the given node
* and checks the variable name length against the configured minimum
* length.
* Is method has the same name as the enclosing class
* (php4 style constructor).
*
* @param PHP_PMD_AbstractNode $node The context source code node.
*
* @return void
*/
public function apply(PHP_PMD_AbstractNode $node)
{
if (strcasecmp($node->getName(), $node->getParentName()) !== 0) {
if (strcasecmp($node->getName(), $node->getParentName()) !== 0
|| $node->getNode()->getParent() instanceof PHP_Depend_Code_Trait
) {
return;
}
$this->addViolation($node);
Expand Down

0 comments on commit f93be40

Please sign in to comment.