Property
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Property extends AbstractProperty
{
/** @var PropertyType|null */
protected $outputType;
/** @var bool */
Method getTypeHint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTypeHint(bool $outputType = false, array $skipDecorators = []): string
{
if (isset($this->renderedTypeHints[$outputType])) {
return $this->renderedTypeHints[$outputType];
}
The method getTypeHint() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function getTypeHint(bool $outputType = false, array $skipDecorators = []): string
{
if (isset($this->renderedTypeHints[$outputType])) {
return $this->renderedTypeHints[$outputType];
}
- 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
The method getType has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation. Open
public function getType(bool $outputType = false): ?PropertyType
- 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
The method setDefaultValue has a boolean flag argument $raw, which is a certain sign of a Single Responsibility Principle violation. Open
public function setDefaultValue($defaultValue, bool $raw = false): PropertyInterface
- 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
The method setType has a boolean flag argument $reset, which is a certain sign of a Single Responsibility Principle violation. Open
bool $reset = false,
- 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
The method getTypeHint has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation. Open
public function getTypeHint(bool $outputType = false, array $skipDecorators = []): string
- 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
syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)
Open
private array $renderedTypeHints = [];
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
static fn(TypeHintDecoratorInterface $decorator): bool => !in_array($decorator::class, $skipDec),
- Exclude checks
Arguments with default values must be at the end of the argument list Open
protected string $description = '',
- Exclude checks
Arguments with default values must be at the end of the argument list Open
bool $reset = false,
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
$validator->getPriority() <=> $comparedValidator->getPriority(),
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
protected ?PropertyType $type,
- Exclude checks
Line indented incorrectly; expected 16 spaces, found 20 Open
static fn(TypeHintDecoratorInterface $decorator): bool => !in_array($decorator::class, $skipDec),
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
static fn(Validator $validator): PropertyValidatorInterface => $validator->getValidator(),
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
static fn(Validator $validator, Validator $comparedValidator): int =>
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
protected string $description = '',
- Exclude checks