wol-soft/php-workflow

View on GitHub
src/State/ExecutionLog/ExecutionLog.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
95%

Avoid too many return statements within this method.
Open

            case WorkflowState::STAGE_AFTER: return 'After';
Severity: Major
Found in src/State/ExecutionLog/ExecutionLog.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                case WorkflowState::STAGE_ON_SUCCESS: return 'On Success';
    Severity: Major
    Found in src/State/ExecutionLog/ExecutionLog.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  case WorkflowState::STAGE_ON_ERROR: return 'On Error';
      Severity: Major
      Found in src/State/ExecutionLog/ExecutionLog.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    case WorkflowState::STAGE_SUMMARY: return 'Summary';
        Severity: Major
        Found in src/State/ExecutionLog/ExecutionLog.php - About 30 mins to fix

          The method addWarning has a boolean flag argument $workflowReportWarning, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function addWarning(string $message, bool $workflowReportWarning = false): void

          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 $stages = [];
          Severity: Critical
          Found in src/State/ExecutionLog/ExecutionLog.php by phan

          Avoid excessively long variable names like $workflowReportWarning. Keep variable name length under 20.
          Open

              public function addWarning(string $message, bool $workflowReportWarning = false): void

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_SUMMARY: return 'Summary';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_AFTER: return 'After';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_ON_SUCCESS: return 'On Success';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_PROCESS: return 'Process';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_PREPARE: return 'Prepare';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_ON_SUCCESS: return 'On Success';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_SUMMARY: return 'Summary';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_VALIDATE: return 'Validate';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_VALIDATE: return 'Validate';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_BEFORE: return 'Before';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_AFTER: return 'After';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_ON_ERROR: return 'On Error';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_PREPARE: return 'Prepare';

          Terminating statement must be on a line by itself
          Open

                      case WorkflowState::STAGE_BEFORE: return 'Before';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_PROCESS: return 'Process';

          The CASE body must start on the line following the statement
          Open

                      case WorkflowState::STAGE_ON_ERROR: return 'On Error';

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_ON_SUCCESS: return 'On Success';

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_ON_ERROR: return 'On Error';

          Space before opening parenthesis of function call prohibited
          Open

                                  fn (string $warning): string =>

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_PROCESS: return 'Process';

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_SUMMARY: return 'Summary';

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_BEFORE: return 'Before';

          Multi-line function call not indented correctly; expected 24 spaces but found 28
          Open

                                      sprintf(PHP_EOL . '        %s: %s', self::mapStage($stage), $warning),

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_PREPARE: return 'Prepare';

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_VALIDATE: return 'Validate';

          Opening brace should be on a new line
          Open

              public function addStep(int $stage, Describable $step, string $state, ?string $reason): void {

          Closing brace must be on a line by itself
          Open

                      case WorkflowState::STAGE_AFTER: return 'After';

          There are no issues that match your filters.

          Category
          Status