libs/lexer/src/Printer/PrettyPrinter.php
Avoid unused parameters such as '$token'. Open
Open
private function printEoiToken(TokenInterface $token): string
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid variables with short names like $to. Configured minimum length is 3. Open
Open
[$from, $to] = [
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Arguments with default values must be at the end of the argument list Open
Open
private readonly string $eoi = self::DEFAULT_END_OF_INPUT,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private readonly int $length = self::DEFAULT_LENGTH,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private readonly string $wrapAtStart = self::DEFAULT_WRAP,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private readonly string $wrapAtEnd = self::DEFAULT_WRAP,
- Exclude checks
Space before opening parenthesis of function call prohibited Open
Open
return match ($token->getChannel()) {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
Open
default => $this->printNonDefaultToken($token),
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private readonly string $suffix = self::DEFAULT_OVERFLOW_SUFFIX,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private readonly array $replacements = self::DEFAULT_REPLACEMENTS,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private readonly string $eoi = self::DEFAULT_END_OF_INPUT,
- Exclude checks