Compare commits

..

4 Commits

Author SHA1 Message Date
John Congdon c81f18a3ef Reset the label when a S_DOT is encountered. (#297)
This will allow multi label domain's to still validate correctly.

Reset the label when a S_DOT is encountered.
2021-04-01 20:37:14 +02:00
Dries Vints 95979e2ad6 Add null return type to getError DocBlock (#293) 2021-03-11 14:36:15 +01:00
Eduardo Gulias Davis 62c3b73c58 Update README.md 2021-03-07 15:33:28 +01:00
Eduardo Gulias Davis 8e526a57c1 Message-id validator (#290)
* scafolding for MessageID validation

* Improve domain valid tokens

* Improved EmailParser to remove leaked logic. User of lexer recorder within parsers.

* MessageIDParser passing tests.

* change left for right, which is the right one

* psaml errors

* Better naming

* comments are not allowed in IDLeft for message-id

* Suppress psalm inheritance over tokens and dependencies

* Update src/Parser.php

Co-authored-by: Alexander M. Turek <me@derrabus.de>

* Update src/Parser.php

Co-authored-by: Alexander M. Turek <me@derrabus.de>

* improve parser from comments

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2021-03-06 18:29:10 +01:00
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -280,9 +280,9 @@ class DomainPart extends PartParser
{
if ($this->lexer->token['type'] === EmailLexer::S_DOT || $isEndOfDomain) {
if ($this->isLabelTooLong($this->label)) {
$this->label = '';
return new InvalidEmail(new LabelTooLong(), $this->lexer->token['value']);
}
$this->label = '';
}
$this->label .= $this->lexer->token['value'];
return new ValidEmail();
+1 -1
View File
@@ -21,7 +21,7 @@ interface EmailValidation
/**
* Returns the validation error.
*
* @return InvalidEmail
* @return InvalidEmail|null
*/
public function getError() : ?InvalidEmail;
@@ -76,6 +76,7 @@ class RFCValidationDomainPartTest extends TestCase
['validipv4@[127.0.0.0]'],
['validipv4@127.0.0.0'],
['withhyphen@domain-exam.com'],
['valid_long_domain@71846jnrsoj91yfhc18rkbrf90ue3onl8y46js38kae8inz0t1.5a-xdycuau.na49.le.example.com']
);
}