File tree 4 files changed +8
-40
lines changed
4 files changed +8
-40
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public function getValidationResults(): ValidationResults
66
66
return $ this ->validationResults ;
67
67
}
68
68
69
- public function runValidation ()
69
+ public function runValidation (): void
70
70
{
71
71
foreach ($ this ->registeredValidators as $ validator ) {
72
72
$ this ->validationResults ->addResult ($ validator ->getValidatorName (), $ validator ->getResultResponse ());
Original file line number Diff line number Diff line change 16
16
class EmailValidatorFactory
17
17
{
18
18
/** @var Validator[] */
19
- private static array $ defaultValidators = [
19
+ protected static array $ defaultValidators = [
20
20
ValidFormatValidator::class,
21
21
MxRecordsValidator::class,
22
22
MisspelledEmailValidator::class,
Original file line number Diff line number Diff line change 9
9
*/
10
10
class MisspelledEmailValidator extends Validator implements ValidatorInterface
11
11
{
12
- const MINIMUM_WORD_DISTANCE_DOMAIN = 2 ;
13
- const MINIMUM_WORD_DISTANCE_TLD = 1 ;
12
+ private const MINIMUM_WORD_DISTANCE_DOMAIN = 2 ;
13
+ private const MINIMUM_WORD_DISTANCE_TLD = 1 ;
14
14
15
- /**
16
- * @return string
17
- */
18
15
public function getValidatorName (): string
19
16
{
20
17
return 'possible_email_correction ' ; // @codeCoverageIgnore
21
18
}
22
19
23
- /**
24
- * @return string
25
- */
26
20
public function getResultResponse (): string
27
21
{
28
22
if (!$ this ->getEmailAddress ()->isValidEmailAddressFormat ()) {
@@ -76,12 +70,6 @@ private function findDomainSuggestion()
76
70
return $ domain === $ possibleMatch ? null : $ possibleMatch ;
77
71
}
78
72
79
- /**
80
- * @param string $stringToCheck
81
- * @param array $wordsToCheck
82
- * @param int $minimumDistance
83
- * @return string|bool
84
- */
85
73
private function findClosestWord (string $ stringToCheck , array $ wordsToCheck , int $ minimumDistance ): string
86
74
{
87
75
if (in_array ($ stringToCheck , $ wordsToCheck )) {
Original file line number Diff line number Diff line change 10
10
11
11
abstract class Validator
12
12
{
13
- /** @var EmailAddress */
14
- private $ emailAddress ;
13
+ private ?EmailAddress $ emailAddress ;
15
14
16
- /** @var EmailDataProvider|null */
17
- private $ emailDataProvider ;
15
+ private ?EmailDataProvider $ emailDataProvider ;
18
16
19
- /**
20
- * @param EmailAddress $emailAddress
21
- * @param EmailDataProviderInterface $emailDataProvider
22
- */
23
17
public function __construct (EmailAddress $ emailAddress = null , EmailDataProviderInterface $ emailDataProvider = null )
24
18
{
25
19
$ this ->emailAddress = $ emailAddress ;
26
20
$ this ->emailDataProvider = $ emailDataProvider ;
27
21
}
28
22
29
- /**
30
- * @return EmailAddress
31
- */
32
23
public function getEmailAddress (): EmailAddress
33
24
{
34
25
return $ this ->emailAddress ;
35
26
}
36
27
37
- /**
38
- * @param EmailAddress $emailAddress
39
- * @return $this
40
- */
41
- public function setEmailAddress (EmailAddress $ emailAddress )
28
+ public function setEmailAddress (EmailAddress $ emailAddress ): Validator
42
29
{
43
30
$ this ->emailAddress = $ emailAddress ;
44
31
return $ this ;
45
32
}
46
33
47
- /**
48
- * @return EmailDataProviderInterface
49
- */
50
34
public function getEmailDataProvider (): EmailDataProviderInterface
51
35
{
52
36
return $ this ->emailDataProvider ;
53
37
}
54
38
55
- /**
56
- * @param EmailDataProviderInterface|null $emailDataProvider
57
- * @return $this
58
- */
59
- public function setEmailDataProvider (EmailDataProviderInterface $ emailDataProvider )
39
+ public function setEmailDataProvider (EmailDataProviderInterface $ emailDataProvider ): Validator
60
40
{
61
41
$ this ->emailDataProvider = $ emailDataProvider ;
62
42
return $ this ;
You can’t perform that action at this time.
0 commit comments