Showing 18 of 35 total issues
File grammar.php
has 569 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Railt\SDL\Node;
use Railt\SDL\Node\Expression as Expr;
use Railt\SDL\Node\Statement as Stmt;
Function getDirectives
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function getDirectives(string $name = null): iterable
{
if ($this->schema !== null) {
foreach ($this->schema->getDirectives($name) as $directive) {
yield $this->schema => $directive;
- 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
ExpressionException
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class ExpressionException extends CompilationException
{
public const CODE_UNPROCESSABLE = 0x01;
public const CODE_UNDEFINED_VARIABLE = 0x02;
public const CODE_ENUM_INVALID_TYPE = 0x03;
Method getDirectives
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDirectives(string $name = null): iterable
{
if ($this->schema !== null) {
foreach ($this->schema->getDirectives($name) as $directive) {
yield $this->schema => $directive;
Method execute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute(InputInterface $input, OutputInterface $output): int
{
if (!class_exists(Compiler::class)) {
throw new \LogicException('The "railt/compiler" dependency required');
}
Method exec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exec(): void
{
$this->assertInputFieldNotDefined();
/** @var InputTypeInterface $type */
Method exec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exec(): void
{
$this->assertFieldNotDefined();
/** @var OutputTypeInterface $type */
Method exec
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exec(): void
{
$this->assertArgumentNotDefined();
/** @var InputTypeInterface $type */
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
#[Visitable]
public NameNode $name,
#[Visitable]
public DescriptionNode $description,
#[Visitable]
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
#[Visitable]
public IdentifierNode $name,
#[Visitable]
public DescriptionNode $description,
#[Visitable]
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
#[Visitable]
public IdentifierNode $name,
#[Visitable]
public DescriptionNode $description,
#[Visitable]
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
#[Visitable]
public IdentifierNode $name,
#[Visitable]
public DescriptionNode $description,
#[Visitable]
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
NameNode $name,
DescriptionNode $description,
#[Visitable]
public array $interfaces = [],
#[Visitable]
Function getMinIndentation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function getMinIndentation(string $text): int
{
$indentation = \PHP_INT_MAX;
foreach (\explode("\n", $text) as $i => $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
Function parseMultilineString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function parseMultilineString(string $value): self
{
$value = \substr($value, 3, -3);
$indentation = self::getMinIndentation($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
return \get_debug_type($value);
Function exec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function exec(): void
{
foreach ($this->node->fields as $node) {
$type = $this->buildFieldType($node);
- 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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function execute(InputInterface $input, OutputInterface $output): int
{
if (!class_exists(Compiler::class)) {
throw new \LogicException('The "railt/compiler" dependency required');
}
- 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"