Skip to content

Commit 2909adc

Browse files
committed
MsgCollector: documentation updates after review
1 parent 4b123cb commit 2909adc

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/Util/MsgCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private function prefixAll($messages)
194194
* Add a message type prefix to a message.
195195
*
196196
* @param string $message The message text.
197-
* @param int $type The type of error.
197+
* @param int $type The type of message.
198198
*
199199
* @return string
200200
*/

tests/Core/Util/MsgCollector/MsgCollectorTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testAddingNonStringMessageResultsInException($message)
4444
}
4545

4646
$msgCollector = new MsgCollector();
47-
$msgCollector->add($message, MsgCollector::NOTICE);
47+
$msgCollector->add($message);
4848

4949
}//end testAddingNonStringMessageResultsInException()
5050

@@ -69,7 +69,7 @@ public function dataAddingNonStringMessageResultsInException()
6969

7070

7171
/**
72-
* Verify that non-string "messages" are rejected with an exception.
72+
* Verify that passing a message type which is not one of the predefined types is rejected with an exception.
7373
*
7474
* @param mixed $type The invalid "type" to pass.
7575
*
@@ -126,6 +126,7 @@ public function dataAddingMessageWithUnsupportedMessageTypeResultsInException()
126126
* deprecations) messages.
127127
*
128128
* @param array<string, int> $messages The messages to display.
129+
* Key is the message, value is the error level.
129130
* @param bool $expected The expected function output.
130131
*
131132
* @dataProvider dataContainsBlockingErrors
@@ -194,6 +195,7 @@ public function dataContainsBlockingErrors()
194195
* - The messages use the appropriate OS-specific EOL character.
195196
*
196197
* @param array<string, int> $messages The messages to display.
198+
* Key is the message, value is the error level.
197199
* @param string $expected The expected exception message.
198200
*
199201
* @dataProvider dataDisplayingNonBlockingMessages
@@ -298,6 +300,7 @@ public function dataDisplayingNonBlockingMessages()
298300
* - The messages use the appropriate OS-specific EOL character.
299301
*
300302
* @param array<string, int> $messages The messages to display.
303+
* Key is the message, value is the error level.
301304
* @param string $expected The expected exception message.
302305
*
303306
* @dataProvider dataDisplayingBlockingErrors
@@ -373,7 +376,7 @@ public function dataDisplayingBlockingErrors()
373376

374377

375378
/**
376-
* Verify and safeguard that adding the same message twice is accepted.
379+
* Verify and safeguard that adding the same message twice is accepted when messages have different error levels.
377380
*
378381
* Note: have multiple messages with the exact same text is not great for conveying information
379382
* to the end-user, but that's not the concern of the MsgCollector class.
@@ -397,7 +400,7 @@ public function testNonUniqueMessagesWithDifferentErrorLevelAreAccepted()
397400

398401

399402
/**
400-
* Verify and safeguard that adding the same message twice is accepted.
403+
* Verify and safeguard that adding the same message twice is accepted when messages have the same error level.
401404
*
402405
* Note: have multiple messages with the exact same text is not great for conveying information
403406
* to the end-user, but that's not the concern of the MsgCollector class.
@@ -520,6 +523,7 @@ public function dataDisplayOrderHandling()
520523
*
521524
* @param \PHP_CodeSniffer\Util\MsgCollector $collector The error cache object.
522525
* @param array<string, int> $messages The error messages to add to the cache.
526+
* Key is the message, value is the error level.
523527
*
524528
* @return void
525529
*/

0 commit comments

Comments
 (0)