Skip to content

Commit 8391f06

Browse files
committed
Add return phpstan doc to getFeedback
1 parent 0aa7dfa commit 8391f06

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/Feedback.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ class Feedback
1717
/**
1818
* @param int $score
1919
* @param MatchInterface[] $sequence
20-
* @return array
20+
* @return array{
21+
* warning: string,
22+
* suggestions: string[]
23+
* }
2124
*/
2225
public function getFeedback(int $score, array $sequence): array
2326
{

src/Matchers/BaseMatch.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ public function __construct(string $password, int $begin, int $end, string $toke
4848
*
4949
* @param bool $isSoleMatch
5050
* Whether this is the only match in the password
51-
* @return array
52-
* Associative array with warning (string) and suggestions (array of strings)
51+
* @return array{
52+
* warning: string,
53+
* suggestions: string[]
54+
* } Associative array with warning (string) and suggestions (array of strings)
5355
*/
5456
#[ArrayShape(['warning' => 'string', 'suggestions' => 'string[]'])]
5557
abstract public function getFeedback(bool $isSoleMatch): array;

src/Matchers/DictionaryMatch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getFeedbackWarning(bool $isSoleMatch): string
115115
{
116116
switch ($this->dictionaryName) {
117117
case 'user_inputs':
118-
return 'This is easy to guess based on the other inputs';
118+
return 'This is similar to, or incorporates parts of, other input';
119119
case 'passwords':
120120
if ($isSoleMatch && !$this->l33t && !$this->reversed) {
121121
if ($this->rank <= 10) {

test/FeedbackTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function testFeedbackFromUserInput()
115115
]);
116116
$feedback = $this->feedback->getFeedback(0, [$match]);
117117

118-
$this->assertEquals('This is easy to guess based on the other inputs', $feedback['warning'], 'no warning for user input');
119-
$this->assertNotEmpty($feedback['suggestions'], 'no suggestions for user intpu');
118+
$this->assertEquals('This is similar to, or incorporates parts of, other input', $feedback['warning'], 'no warning for user input');
119+
$this->assertNotEmpty($feedback['suggestions'], 'no suggestions for user input');
120120
}
121121
}

0 commit comments

Comments
 (0)