@@ -30,8 +30,7 @@ protected function setUp(): void
3030 {
3131 parent ::setUp ();
3232
33- $ config = new Auth ();
34- $ this ->validator = new NothingPersonalValidator ($ config );
33+ $ this ->validator = new NothingPersonalValidator (new Auth ());
3534 }
3635
3736 public function testFalseOnPasswordIsEmail (): void
@@ -86,11 +85,8 @@ public function testTrueWhenPasswordHasNothingPersonal(): void
8685 {
8786 $ config = new Auth ();
8887 $ config ->maxSimilarity = 50 ;
89- $ config ->personalFields = [
90- 'firstname ' ,
91- 'lastname ' ,
92- ];
93- $ this ->validator = new NothingPersonalValidator ($ config );
88+ $ config ->personalFields = ['firstname ' , 'lastname ' ];
89+ $ this ->validator = new NothingPersonalValidator ($ config );
9490
9591 $ user = new User ([
9692 'email ' => 'jsmith@example.com ' ,
@@ -110,11 +106,8 @@ public function testTrueWhenNoUsername(): void
110106 {
111107 $ config = new Auth ();
112108 $ config ->maxSimilarity = 50 ;
113- $ config ->personalFields = [
114- 'firstname ' ,
115- 'lastname ' ,
116- ];
117- $ this ->validator = new NothingPersonalValidator ($ config );
109+ $ config ->personalFields = ['firstname ' , 'lastname ' ];
110+ $ this ->validator = new NothingPersonalValidator ($ config );
118111
119112 $ user = new User ([
120113 'email ' => 'jsmith@example.com ' ,
@@ -202,15 +195,12 @@ public static function provideIsNotPersonalFalsePositivesCaughtByIsNotSimilar():
202195 }
203196
204197 #[DataProvider('provideConfigPersonalFieldsValues ' )]
205- public function testConfigPersonalFieldsValues (mixed $ firstName , mixed $ lastName , mixed $ expected ): void
198+ public function testConfigPersonalFieldsValues (string $ firstName , string $ lastName , bool $ expected ): void
206199 {
207200 $ config = new Auth ();
208201 $ config ->maxSimilarity = 66 ;
209- $ config ->personalFields = [
210- 'firstname ' ,
211- 'lastname ' ,
212- ];
213- $ this ->validator = new NothingPersonalValidator ($ config );
202+ $ config ->personalFields = ['firstname ' , 'lastname ' ];
203+ $ this ->validator = new NothingPersonalValidator ($ config );
214204
215205 $ user = new User ([
216206 'username ' => 'Vlad the Impaler ' ,
@@ -226,9 +216,12 @@ public function testConfigPersonalFieldsValues(mixed $firstName, mixed $lastName
226216 $ this ->assertSame ($ expected , $ result ->isOK ());
227217 }
228218
219+ /**
220+ * @return iterable<int, array{0: string, 1: string, 2: bool}>
221+ */
229222 public static function provideConfigPersonalFieldsValues (): iterable
230223 {
231- return [
224+ yield from [
232225 [
233226 'Count ' ,
234227 '' ,
@@ -248,7 +241,7 @@ public static function provideConfigPersonalFieldsValues(): iterable
248241 }
249242
250243 #[DataProvider('provideMaxSimilarityZeroTurnsOffSimilarityCalculation ' )]
251- public function testMaxSimilarityZeroTurnsOffSimilarityCalculation (mixed $ maxSimilarity , mixed $ expected ): void
244+ public function testMaxSimilarityZeroTurnsOffSimilarityCalculation (int $ maxSimilarity , bool $ expected ): void
252245 {
253246 $ config = new Auth ();
254247 $ config ->maxSimilarity = $ maxSimilarity ;
@@ -266,6 +259,9 @@ public function testMaxSimilarityZeroTurnsOffSimilarityCalculation(mixed $maxSim
266259 $ this ->assertSame ($ expected , $ result ->isOK ());
267260 }
268261
262+ /**
263+ * @return iterable<int, array{0: int, 1: bool}>
264+ */
269265 public static function provideMaxSimilarityZeroTurnsOffSimilarityCalculation (): iterable
270266 {
271267 return [
@@ -298,6 +294,9 @@ public function testCheckPasswordWithBadEmail(string $email, bool $expected): vo
298294 $ this ->assertSame ($ expected , $ result ->isOK ());
299295 }
300296
297+ /**
298+ * @return iterable<int, array{0: string, 1: bool}>
299+ */
301300 public static function provideCheckPasswordWithBadEmail (): iterable
302301 {
303302 return [
0 commit comments