The method __construct has a boolean flag argument $enablePropagation, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($enablePropagation = false, $numArgs = self::DEFAULT_NUM_ARGS)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid assigning values to variables in if clauses and the like (line '247', column '17'). Open
public function __construct($enablePropagation = false, $numArgs = self::DEFAULT_NUM_ARGS)
{
$this->_setNumArgs($numArgs);
try {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method _getThrowOnPropStop is not named in camelCase. Open
protected function _getThrowOnPropStop()
{
return $this->replaceWpHooks;
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _hashWpHandler is not named in camelCase. Open
protected function _hashWpHandler($name, $handler)
{
$handlerHash = $this->_hashCallable($handler);
$pair = sprintf('%1$s|%2$s', $name, $handlerHash);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _getWpHookDefaultPriority is not named in camelCase. Open
protected function _getWpHookDefaultPriority()
{
return static::DEFAULT_PRIORITY;
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _createReflectionMethod is not named in camelCase. Open
protected function _createReflectionMethod($className, $methodName)
{
return new ReflectionMethod($className, $methodName);
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _createWpHookReplacement is not named in camelCase. Open
protected function _createWpHookReplacement($wpHook)
{
return ($wpHook instanceof WpHookReplacer)
? $wpHook
: new WpHookReplacer($wpHook);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}