Showing 283 of 290 total issues
Expected 1 space after FUNCTION keyword; 0 found Open
return function($a = null, $b = null, $c = null) use ($fn) {
- Exclude checks
Each PHP statement must be on a line by itself Open
return function(...$args) use ($fn) { return _curry3($fn)(...$args); };
- Exclude checks
Each PHP statement must be on a line by itself Open
return _curry1(function ($_c) use($fn, $a, $b) { return $fn($a, $b, $_c); });
- Exclude checks
Terminating statement must be indented to the same level as the CASE body Open
return _curry3_2_args($fn, $a, $b);
- Exclude checks
PHP keywords must be lowercase; expected "callable" but found "Callable" Open
function _map(Callable $fn, iterable $array) {
- Exclude checks
Terminating statement must be indented to the same level as the CASE body Open
return _curry3_3_args($fn, $a, $b, $c);
- Exclude checks
Terminating statement must be indented to the same level as the CASE body Open
return function(...$args) use ($fn) { return _curry3($fn)(...$args); };
- Exclude checks
Missing class import via use statement (line '9', column '32'). Open
$reflectionClass = new ReflectionClass($class);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '13', column '27'). Open
$reflection = new ReflectionFunction($fn);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method _curry3_2_args uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return _curry1(function ($_c) use ($fn, $a, $b) { return $fn($a, $b, $_c); });
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _curry3_3_args uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return $fn($a, $b, $c);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method splitAt uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$snd[] = $list[$i];
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _partition uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ko[] = $value;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _arity uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$reflection = new ReflectionFunction($fn);
$arguments = $reflection->getParameters();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _curry1 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return call_user_func_array($fn, $args);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The function _curry3_3_args() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
function _curry3_3_args($fn, $a, $b, $c) {
$a__ = _isPlaceholder($a);
$b__ = _isPlaceholder($b);
$c__ = _isPlaceholder($c);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Line exceeds 120 characters; contains 145 characters Open
* Takes a value and returns the it's `!` (NOT Logical operator). Returns true when passed a falsy value, and false when passed a truthy one.
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
* Performs right-to-left function composition. Like the unix pipe (|), but reversed ! All the function must be unary.
- Exclude checks
Inline control structures are not allowed Open
} else
- Exclude checks
Closing brace must be on a line by itself Open
return _curry2(function ($_a, $_c) use ($fn, $b) { return $fn($_a, $b, $_c); });
- Exclude checks