mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-30 20:18:04 +00:00
improving types
This commit is contained in:
@@ -105,7 +105,6 @@ class EmailLexer extends AbstractLexer
|
||||
'?' => self::QUESTIONMARK,
|
||||
'#' => self::NUMBER_SIGN,
|
||||
'¡' => self::INVERT_EXCLAMATION,
|
||||
null => self::S_EMPTY,
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
+1
-5
@@ -40,11 +40,7 @@ class EmailParser
|
||||
$this->lexer = $lexer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @return Result
|
||||
*/
|
||||
public function parse($str) : Result
|
||||
public function parse(string $str) : Result
|
||||
{
|
||||
$this->lexer->setInput($str);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class DNSCheckValidation implements EmailValidation
|
||||
}
|
||||
}
|
||||
|
||||
public function isValid($email, EmailLexer $emailLexer) : bool
|
||||
public function isValid(string $email, EmailLexer $emailLexer) : bool
|
||||
{
|
||||
// use the input to check DNS if we cannot extract something similar to a domain
|
||||
$host = $email;
|
||||
|
||||
@@ -16,7 +16,7 @@ interface EmailValidation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($email, EmailLexer $emailLexer) : bool;
|
||||
public function isValid(string $email, EmailLexer $emailLexer) : bool;
|
||||
|
||||
/**
|
||||
* Returns the validation error.
|
||||
|
||||
@@ -58,7 +58,7 @@ class MultipleValidationWithAnd implements EmailValidation
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isValid($email, EmailLexer $emailLexer) : bool
|
||||
public function isValid(string $email, EmailLexer $emailLexer) : bool
|
||||
{
|
||||
$result = true;
|
||||
foreach ($this->validations as $validation) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class NoRFCWarningsValidation extends RFCValidation
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isValid($email, EmailLexer $emailLexer) : bool
|
||||
public function isValid(string $email, EmailLexer $emailLexer) : bool
|
||||
{
|
||||
if (!parent::isValid($email, $emailLexer)) {
|
||||
return false;
|
||||
|
||||
@@ -24,11 +24,11 @@ class RFCValidation implements EmailValidation
|
||||
*/
|
||||
private $error;
|
||||
|
||||
public function isValid($email, EmailLexer $emailLexer) : bool
|
||||
public function isValid(string $email, EmailLexer $emailLexer) : bool
|
||||
{
|
||||
$this->parser = new EmailParser($emailLexer);
|
||||
try {
|
||||
$result = $this->parser->parse((string)$email);
|
||||
$result = $this->parser->parse($email);
|
||||
$this->warnings = $this->parser->getWarnings();
|
||||
if ($result->isInvalid()) {
|
||||
/** @psalm-suppress PropertyTypeCoercion */
|
||||
|
||||
@@ -24,7 +24,7 @@ class SpoofCheckValidation implements EmailValidation
|
||||
/**
|
||||
* @psalm-suppress InvalidArgument
|
||||
*/
|
||||
public function isValid($email, EmailLexer $emailLexer) : bool
|
||||
public function isValid(string $email, EmailLexer $emailLexer) : bool
|
||||
{
|
||||
$checker = new Spoofchecker();
|
||||
$checker->setChecks(Spoofchecker::SINGLE_SCRIPT);
|
||||
|
||||
Reference in New Issue
Block a user