* use spread syntax instead of array_merge()
* use type cast instead of function cast
* removed redundant returns
* removed redundant phpdoc - type is already inferred
* removed invalid phpdoc - type is already inferred
The PHPDoc return type hint was incomplete, it should have been `InvalidEmail|null`, however, it can be removed altogether as the return type is already inferred from the code.
* changed warnEscaping()'s return value from bool to void
This is not a breaking change as the method is private, and it's only used at one place, where the return value was not used anyway.
* made private class property local
`private $parser` was used in only one place, hence it can be local, there is no reason to put it into the class' scope.
* removed unnecessary type casting
Concatenation already casts `static::CODE` from `int` to `string`, no reason to do it explicitly.
* removed redundant initializers - constructor overwrites them immediately
* removed redundant else block
* simplified if-else statement
* wrapped if body in brackets to comply with PSR12
* fixed README formatting
- fixed numbering at the `Available validations` section
- fixed overall formatting
* Revert "removed redundant phpdoc - type is already inferred"
This reverts commit 68a9ae20bd.
* don't wrap long lines
* make properties typed
Also using constructor property promotion, see more info about it [here](https://php.watch/versions/8.0/constructor-property-promotion).
* README for v4
* badges update
* license year
* Adding codacy reporter action
* plain text secret for testing
* using bash
* downloading artifact
* all in one
* path to coverage
* removing extra job and adding sending coverage report only once
Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility.
* Some code improvements - tests same as beginning
* isUTF8Invalid returns a boolean
* Changes for tests passed
* Revert change + scrutinizer to flaky
* Null coalescing on token to return a null token
* Psalm pass and PHPunit too (php 7.4)
* Minor change to set lookahead to nullToken
* Patch MultipleErrors->reason method by getting always the first item - Added Tests and a custom Exception
* Return EmptyReason instead of throwing exception when MultipleErrors has no reasons (validations accomplished)
Co-authored-by: Samuel Vicent <samuel.vicent@takeachef.com>
* 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>
* #256 Bypass a PHP warning generated by @dns_get_record
The idea is to create a custom error handler for dns_get_record(), call dns_get_record and then restore the original error handler.
This way we can catch PHP warnings (e.g. "Warning: dns_get_record(): DNS Query failed" or "dns_get_record(): A temporary server error occurred." [ErrorException])
* #256 Make `UnableToGetDNSRecord` reason more testable
* #256 Suppress psalm’s false-positive error
see https://github.com/vimeo/psalm/issues/5134#issuecomment-782937791
* #256 Speed up tests: start from previously failed
* #256 Suppress psalm’s false-positive error
We don’t have a control over AbstractLexer and can’t specify array shape in this parent class