Skip to content

Commit

Permalink
more precise error message when no additional text given
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 17, 2023
1 parent ac5b2bc commit d0ff939
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/TodoByRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public function processNode(Node $node, Scope $scope): array
continue;
}

// Have always present date at the start of the message.
$errorMessage = "Expired on {$date}";

// Have always present date at the start of the message.
// If there is further text, append it.
if ($todoText !== '') {

$errorMessage .= ": {$todoText}";
$errorMessage = "Expired on {$date}: {$todoText}";
} else {
$errorMessage = "Comment expired on {$date}";
}

$wholeMatchStartOffset = $match[0][1];
Expand Down
2 changes: 1 addition & 1 deletion tests/TodoByRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testRule(): void
19,
],
[
'Expired on 2023-12-14',
'Comment expired on 2023-12-14',
21,
],
[
Expand Down

0 comments on commit d0ff939

Please sign in to comment.