internal/reflection_completeness_check.php

Summary

Maintainability
B
4 hrs
Test Coverage

Function checkForUndeclaredTypeFunctions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private static function checkForUndeclaredTypeFunctions(): void
    {
        foreach (get_defined_functions() as $unused_ext => $group) {
            foreach ($group as $function_name) {
                $reflection_function = new ReflectionFunction($function_name);
Severity: Minor
Found in internal/reflection_completeness_check.php - About 2 hrs to fix

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 checkForUndeclaredTypeMethods has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function checkForUndeclaredTypeMethods(): void
    {
        foreach (self::getInternalClasses() as $class_name => $reflection_class) {
            foreach ($reflection_class->getMethods() as $reflection_method) {
                if ($reflection_method->class !== $class_name) {
Severity: Minor
Found in internal/reflection_completeness_check.php - About 1 hr to fix

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 getInternalClasses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getInternalClasses(): Generator
    {
        $classes = array_merge(
            get_declared_classes(),
            get_declared_interfaces(),
Severity: Minor
Found in internal/reflection_completeness_check.php - About 35 mins to fix

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 createStubSignature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createStubSignature(ReflectionFunctionAbstract $reflection_method): array
    {
        $signature = [];
        $signature[] = (string)UnionType::fromReflectionType($reflection_method->getReturnType());
        foreach ($reflection_method->getParameters() as $parameter) {
Severity: Minor
Found in internal/reflection_completeness_check.php - About 25 mins to fix

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 checkForUndeclaredTypeProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function checkForUndeclaredTypeProperties(): void
    {
        foreach (self::getInternalClasses() as $class_name => $reflection_class) {
            $map_for_class = UnionType::internalPropertyMapForClassName($class_name);
            foreach ($reflection_class->getProperties(ReflectionProperty::IS_PUBLIC) as $reflection_property) {
Severity: Minor
Found in internal/reflection_completeness_check.php - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status