mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-24 19:08:27 +00:00
Fixing Psalm erros
This commit is contained in:
@@ -110,7 +110,14 @@ class EmailLexer extends AbstractLexer
|
||||
'position' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accumulator = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasToRecord = false;
|
||||
|
||||
public function __construct()
|
||||
|
||||
+6
-16
@@ -35,16 +35,6 @@ class EmailParser
|
||||
*/
|
||||
protected $lexer;
|
||||
|
||||
/**
|
||||
* @var LocalPart
|
||||
*/
|
||||
protected $localPartParser;
|
||||
|
||||
/**
|
||||
* @var DomainPart
|
||||
*/
|
||||
protected $domainPartParser;
|
||||
|
||||
public function __construct(EmailLexer $lexer)
|
||||
{
|
||||
$this->lexer = $lexer;
|
||||
@@ -86,11 +76,11 @@ class EmailParser
|
||||
private function processLocalPart() : Result
|
||||
{
|
||||
$this->lexer->startRecording();
|
||||
$this->localPartParser = new LocalPart($this->lexer);
|
||||
$localPartResult = $this->localPartParser->parse();
|
||||
$localPartParser = new LocalPart($this->lexer);
|
||||
$localPartResult = $localPartParser->parse();
|
||||
$this->lexer->stopRecording();
|
||||
$this->localPart = rtrim($this->lexer->getAccumulatedValues(), '@');
|
||||
$this->warnings = array_merge($this->localPartParser->getWarnings(), $this->warnings);
|
||||
$this->warnings = array_merge($localPartParser->getWarnings(), $this->warnings);
|
||||
|
||||
return $localPartResult;
|
||||
}
|
||||
@@ -99,11 +89,11 @@ class EmailParser
|
||||
{
|
||||
$this->lexer->clearRecorded();
|
||||
$this->lexer->startRecording();
|
||||
$this->domainPartParser = new DomainPart($this->lexer);
|
||||
$domainPartResult = $this->domainPartParser->parse();
|
||||
$domainPartParser = new DomainPart($this->lexer);
|
||||
$domainPartResult = $domainPartParser->parse();
|
||||
$this->lexer->stopRecording();
|
||||
$this->domainPart = $this->lexer->getAccumulatedValues();
|
||||
$this->warnings = array_merge($this->domainPartParser->getWarnings(), $this->warnings);
|
||||
$this->warnings = array_merge($domainPartParser->getWarnings(), $this->warnings);
|
||||
|
||||
return $domainPartResult;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class DomainPart extends Parser
|
||||
$domain .= $this->lexer->token['value'];
|
||||
$this->lexer->moveNext();
|
||||
if ($this->lexer->token['type'] === EmailLexer::S_SP) {
|
||||
return new InvalidEmail(new CharNotAllowed(), $this->lexer->token['type']);
|
||||
return new InvalidEmail(new CharNotAllowed(), $this->lexer->token['value']);
|
||||
}
|
||||
|
||||
} while (null !== $this->lexer->token['type']);
|
||||
|
||||
Reference in New Issue
Block a user