File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/main/php/PHP/PMD/Rule/Naming Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -67,17 +67,18 @@ class PHP_PMD_Rule_Naming_ConstructorWithNameAsEnclosingClass
67
67
implements PHP_PMD_Rule_IMethodAware
68
68
{
69
69
/**
70
- * Extracts all variable and variable declarator nodes from the given node
71
- * and checks the variable name length against the configured minimum
72
- * length.
70
+ * Is method has the same name as the enclosing class
71
+ * (php4 style constructor).
73
72
*
74
73
* @param PHP_PMD_AbstractNode $node The context source code node.
75
74
*
76
75
* @return void
77
76
*/
78
77
public function apply (PHP_PMD_AbstractNode $ node )
79
78
{
80
- if (strcasecmp ($ node ->getName (), $ node ->getParentName ()) !== 0 ) {
79
+ if (strcasecmp ($ node ->getName (), $ node ->getParentName ()) !== 0
80
+ || $ node ->getNode ()->getParent () instanceof PHP_Depend_Code_Trait
81
+ ) {
81
82
return ;
82
83
}
83
84
$ this ->addViolation ($ node );
You can’t perform that action at this time.
0 commit comments