@@ -18,7 +18,10 @@ class ExecutionLog
1818 private array $ stepInfo = [];
1919 /** @var string[][] Collect all warnings which occurred during the workflow execution */
2020 private array $ warnings = [];
21+ private int $ warningsDuringStep = 0 ;
22+
2123 private float $ startAt ;
24+
2225 private WorkflowState $ workflowState ;
2326
2427 public function __construct (WorkflowState $ workflowState )
@@ -29,8 +32,9 @@ public function __construct(WorkflowState $workflowState)
2932 public function addStep (int $ stage , string $ step , string $ state , ?string $ reason ): void {
3033 $ stage = $ this ->mapStage ($ stage );
3134
32- $ this ->stages [$ stage ][] = new Step ($ step , $ state , $ reason , $ this ->stepInfo );
35+ $ this ->stages [$ stage ][] = new Step ($ step , $ state , $ reason , $ this ->stepInfo , $ this -> warningsDuringStep );
3336 $ this ->stepInfo = [];
37+ $ this ->warningsDuringStep = 0 ;
3438 }
3539
3640 public function __toString (): string
@@ -56,6 +60,7 @@ public function attachStepInfo(string $info): void
5660 public function addWarning (string $ message ): void
5761 {
5862 $ this ->warnings [$ this ->mapStage ($ this ->workflowState ->getStage ())][] = $ message ;
63+ $ this ->warningsDuringStep ++;
5964 }
6065
6166 public function startExecution (): void
@@ -68,11 +73,15 @@ public function stopExecution(): void
6873 $ this ->attachStepInfo ("Execution time: " . number_format (1000 * (microtime (true ) - $ this ->startAt ), 5 ) . 'ms ' );
6974
7075 if ($ this ->warnings ) {
71- $ warnings = "Got " . count ($ this ->warnings , COUNT_RECURSIVE ) . " warnings during the execution: \n" ;
76+ $ warnings = sprintf (
77+ "Got %s warning%s during the execution: \n " ,
78+ $ amount = count ($ this ->warnings , COUNT_RECURSIVE ) - count ($ this ->warnings ),
79+ $ amount > 1 ? 's ' : '' ,
80+ );
7281
7382 foreach ($ this ->warnings as $ stage => $ stageWarnings ) {
7483 $ warnings .= implode (
75- "\n " ,
84+ "\n " ,
7685 array_map (
7786 fn (string $ warning ): string => sprintf ("%s: %s " , $ stage , $ warning ),
7887 $ stageWarnings ,
0 commit comments