src/Formatters/Stylish.php
Method format
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function format(array $diff): string
{
$format = function ($diff, $level) use (&$format) {
return array_map(
function ($node) use ($level, $format) {
Method formatMessage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatMessage(int $indentLevel, string $mark, string $nodeName, $value): string
{
$stringifyComplexValue = fn($complexValue, $level) => implode(
END_OF_LINE,
[
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ']'
Open
Open
NESTED => fn() => formatMessage(
- Exclude checks
Avoid excessively long variable names like $stringifyComplexValue. Keep variable name length under 20. Open
Open
$stringifyComplexValue = fn($complexValue, $level) => implode(
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
There must be one USE keyword per declaration Open
Open
use const GenDiff\Diff\{ADDED, CHANGED, NESTED, REMOVED, UNCHANGED};
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn($value, $key) => formatMessage($indentLevel + 1, MARK_SPACES, $key, $value),
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn($value, $key) => formatMessage($indentLevel + 1, MARK_SPACES, $key, $value),
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn($value, $key) => formatMessage($indentLevel + 1, MARK_SPACES, $key, $value),
- Exclude checks