squirrelphp/debug

View on GitHub

Showing 8 of 8 total issues

Function findOrigin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static function findOrigin(
        string|array $ignoreClasses = [],
        string|array $ignoreNamespaces = [],
    ): Origin {
        $ignoreClassesArray = self::convertToArray($ignoreClasses);
Severity: Minor
Found in src/Debug.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

Method findOrigin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function findOrigin(
        string|array $ignoreClasses = [],
        string|array $ignoreNamespaces = [],
    ): Origin {
        $ignoreClassesArray = self::convertToArray($ignoreClasses);
Severity: Minor
Found in src/Debug.php - About 1 hr to fix

    Method createException has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function createException(
            string $exceptionClass,
            string $message,
            string|array $ignoreClasses = [],
            string|array $ignoreNamespaces = [],
    Severity: Minor
    Found in src/Debug.php - About 1 hr to fix

      Function sanitizeData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function sanitizeData(mixed $data): string
          {
              // Convert object to class name
              if (\is_object($data)) {
                  return 'object(' . (new \ReflectionClass($data))->getName() . ')';
      Severity: Minor
      Found in src/Debug.php - About 45 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

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              private string $originCall,
              /** @var string File in which the problem originated */
              private string $originFile,
              /** @var int Line on which the problem originated */
              private int $originLine,
      Severity: Minor
      Found in src/OriginException.php - About 45 mins to fix

        Method createException has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                string $exceptionClass,
                string $message,
                string|array $ignoreClasses = [],
                string|array $ignoreNamespaces = [],
                ?\Throwable $previousException = null,
        Severity: Minor
        Found in src/Debug.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

                  return '[' . \implode(', ', $result) . ']';
          Severity: Major
          Found in src/Debug.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return \str_replace("\n", '', \var_export($data, true));
            Severity: Major
            Found in src/Debug.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language