mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-30 03:59:20 +00:00
Psalm erros fixed
This commit is contained in:
@@ -10,7 +10,7 @@ class InvalidEmail implements Result
|
||||
/**
|
||||
* @var Reason
|
||||
*/
|
||||
private $reason;
|
||||
protected $reason;
|
||||
|
||||
public function __construct(Reason $reason, string $token)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,9 @@ namespace Egulias\EmailValidator\Result;
|
||||
use Egulias\EmailValidator\Result\InvalidEmail;
|
||||
use Egulias\EmailValidator\Result\Reason\Reason;
|
||||
|
||||
/**
|
||||
* @psalm-suppress PropertyNotSetInConstructor
|
||||
*/
|
||||
class MultipleErrors extends InvalidEmail
|
||||
{
|
||||
/**
|
||||
@@ -33,4 +36,19 @@ class MultipleErrors extends InvalidEmail
|
||||
{
|
||||
return $this->reasons[0];
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
$description = '';
|
||||
foreach($this->reasons as $reason) {
|
||||
$description .= $reason->description() . PHP_EOL;
|
||||
}
|
||||
|
||||
return $description;
|
||||
}
|
||||
|
||||
public function code() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ class MultipleValidationWithAnd implements EmailValidation
|
||||
{
|
||||
if (null !== $validation->getError()) {
|
||||
$this->initErrorStorage();
|
||||
/** @psalm-suppress PossiblyNullReference */
|
||||
$this->error->addReason($validation->getError()->reason());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class RFCValidation implements EmailValidation
|
||||
private $warnings = [];
|
||||
|
||||
/**
|
||||
* @var InvalidEmail
|
||||
* @var ?InvalidEmail
|
||||
*/
|
||||
private $error;
|
||||
|
||||
@@ -31,6 +31,7 @@ class RFCValidation implements EmailValidation
|
||||
$result = $this->parser->parse((string)$email);
|
||||
$this->warnings = $this->parser->getWarnings();
|
||||
if ($result->isInvalid()) {
|
||||
/** @psalm-suppress PropertyTypeCoercion */
|
||||
$this->error = $result;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user