Showing 9 of 29 total issues
Function write
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function write(): string
{
$result = $this->line("<?php");
$result .= $this->line("declare(strict_types = 1);");
$result .= $this->line("");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method write
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function write(): string
{
$result = $this->line("<?php");
$result .= $this->line("declare(strict_types = 1);");
$result .= $this->line("");
Function toValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function toValue(PHPType $type, $value): string
{
if ($type instanceof PrimitivePHPType) {
if ($value === null) return 'null';
if ($type->isInt()) return (string)$value;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
if ($value === null) return 'null';
Avoid too many return
statements within this method. Open
return 0;
Avoid too many return
statements within this method. Open
return $this;
Function create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function create(): string
{
$result = ' ' . $this->visibility->value();
if ($this->static) $result .= ' static';
$result .= ' function ' . $this->name . '(';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function toPHP
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function toPHP(PHPType $type, ClassWriter $classWriter): string
{
$result = '';
if ($type->isOptional()) $result .= "?";
if ($type instanceof PrimitivePHPType) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function toPHPDoc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function toPHPDoc(PHPType $type, ClassWriter $classWriter): string
{
$result = "";
if ($type instanceof PrimitivePHPType) {
$result .= $type->getToken();//TODO array of Object
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"