mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-01 04:59:18 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 451b438902 | |||
| 04cad1a5ec | |||
| de0fb24141 | |||
| c4d50e9cb4 | |||
| a7b66b5d5a | |||
| bcfcb883df | |||
| 17e0e0f683 | |||
| 3a80c1b2c4 | |||
| 6d5bca49cd | |||
| 4254b5c77a |
+1
-1
@@ -7,7 +7,7 @@ build:
|
||||
tests:
|
||||
override:
|
||||
-
|
||||
command: 'vendor/bin/phpunit --coverage-clover=clover.xml'
|
||||
command: 'vendor/bin/phpunit --coverage-clover=clover.xml --exclude-group slow'
|
||||
coverage:
|
||||
file: 'clover.xml'
|
||||
format: 'clover'
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ before_script:
|
||||
- mkdir -p build/logs
|
||||
|
||||
script:
|
||||
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
|
||||
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml --exclude-group slow
|
||||
- if [ "$psalm" = "yes" ]; then vendor/bin/psalm; fi
|
||||
|
||||
after_script:
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
* PHP version upgraded to match Symfony's (as of 12/2020).
|
||||
* DNSCheckValidation now fails for missing MX records. While the RFC argues that the existence of only A records to be valid, starting in v3 they will be considered invalid.
|
||||
* Emails domain part are now intenteded to be RFC 1030 compliant, rendering previous valid emails (e.g example@examp&) invalid.
|
||||
* Emails domain part are now intenteded to be RFC 1035 compliant, rendering previous valid emails (e.g example@examp&) invalid.
|
||||
|
||||
## PHP versions upgrade policy
|
||||
PHP version upgrade requirement will happen via MINOR (3.x) version upgrades of the library, following the adoption level by major frameworks.
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@ When doing a PR to v2 remember that you also have to do the PR port to v3, or te
|
||||
2. Use the title as a brief description of the changes
|
||||
3. Describe the changes you are proposing
|
||||
1. If adding an extra validation state the benefits of adding it and the problem is solving
|
||||
2. Document in the readme, by adding it to the list
|
||||
4. Provide appropiate tests for the code you are submitting: aim to keep the existing coverage percentage.
|
||||
5. Add your Twitter handle (if you have) so we can thank you there.
|
||||
|
||||
@@ -149,4 +150,4 @@ at [https://www.contributor-covenant.org/translations][translations].
|
||||
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# EmailValidator
|
||||
|
||||
[](https://travis-ci.org/egulias/EmailValidator)
|
||||
[](https://coveralls.io/r/egulias/EmailValidator?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master)
|
||||
[](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)
|
||||
[](https://travis-ci.org/egulias/EmailValidator)
|
||||
[](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=3.x)
|
||||
[](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=3.x)
|
||||
[](https://insight.symfony.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)
|
||||
|
||||
A library for validatin emails against several RFC.
|
||||
A library for validating emails against several RFC.
|
||||
|
||||
## Supported RFCs ##
|
||||
|
||||
@@ -15,17 +15,18 @@ This library aims to support RFCs:
|
||||
* [5322](https://tools.ietf.org/html/rfc5322),
|
||||
* [6530](https://tools.ietf.org/html/rfc6530),
|
||||
* [6531](https://tools.ietf.org/html/rfc6531),
|
||||
* [6532](https://tools.ietf.org/html/rfc6532)
|
||||
* [6532](https://tools.ietf.org/html/rfc6532),
|
||||
* [1035](https://tools.ietf.org/html/rfc1035)
|
||||
|
||||
## Supported versions
|
||||
|
||||
**Curent major version with full support is v3**
|
||||
|
||||
| Version | EOL | Only critical bug fixes | Full |
|
||||
| ---- | :----: | :----: | :----: |
|
||||
| v3.x | - | X | X |
|
||||
| v2.1.x | 01/2022 | X | |
|
||||
| v1.2 | YES | | |
|
||||
| Version | Released | EOL | Only critical bug fixes | Full |
|
||||
| ---- | :----: | :----: | :----: | :----: |
|
||||
| v3.x | 2020/12/29 | - | X | X |
|
||||
| v2.1.x | 2016/05/16 | 01/2022 | X | |
|
||||
| v1.2 | 2013/19/05 | YES | | |
|
||||
|
||||
|
||||
## Requirements ##
|
||||
@@ -113,4 +114,4 @@ As this is a port from another library and work, here are other people related t
|
||||
|
||||
## License ##
|
||||
|
||||
Released under the MIT License attached with this code.
|
||||
Released under the MIT License attached with this code.
|
||||
|
||||
Generated
+86
-87
@@ -88,16 +88,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117"
|
||||
"reference": "0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3b75acd829741c768bc8b1f84eb33265e7cc5117",
|
||||
"reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44",
|
||||
"reference": "0eb8293dbbcd6ef6bf81404c9ce7d95bcdf34f44",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -155,7 +155,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -171,20 +171,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||
"reference": "727d1096295d807c309fb01a851577302394c897"
|
||||
"reference": "6e971c891537eb617a00bb07a43d182a6915faba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897",
|
||||
"reference": "727d1096295d807c309fb01a851577302394c897",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba",
|
||||
"reference": "6e971c891537eb617a00bb07a43d182a6915faba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -196,7 +196,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -239,7 +239,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -255,20 +255,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T17:09:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php72",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php72.git",
|
||||
"reference": "cede45fcdfabdd6043b3592e83678e42ec69e930"
|
||||
"reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cede45fcdfabdd6043b3592e83678e42ec69e930",
|
||||
"reference": "cede45fcdfabdd6043b3592e83678e42ec69e930",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
|
||||
"reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -277,7 +277,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -315,7 +315,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php72/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-php72/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -331,22 +331,22 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
"version": "v2.5.1",
|
||||
"version": "v2.5.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/amphp/amp.git",
|
||||
"reference": "ecdc3c476b3ccff02f8e5d5bcc04f7ccfd18751c"
|
||||
"reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/amphp/amp/zipball/ecdc3c476b3ccff02f8e5d5bcc04f7ccfd18751c",
|
||||
"reference": "ecdc3c476b3ccff02f8e5d5bcc04f7ccfd18751c",
|
||||
"url": "https://api.github.com/repos/amphp/amp/zipball/efca2b32a7580087adb8aabbff6be1dc1bb924a9",
|
||||
"reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -414,7 +414,7 @@
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/amphp",
|
||||
"issues": "https://github.com/amphp/amp/issues",
|
||||
"source": "https://github.com/amphp/amp/tree/v2.5.1"
|
||||
"source": "https://github.com/amphp/amp/tree/v2.5.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -422,7 +422,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-03T16:23:45+00:00"
|
||||
"time": "2021-01-10T17:06:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "amphp/byte-stream",
|
||||
@@ -820,25 +820,25 @@
|
||||
},
|
||||
{
|
||||
"name": "felixfbecker/advanced-json-rpc",
|
||||
"version": "v3.1.1",
|
||||
"version": "v3.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/felixfbecker/php-advanced-json-rpc.git",
|
||||
"reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40"
|
||||
"reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/0ed363f8de17d284d479ec813c9ad3f6834b5c40",
|
||||
"reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40",
|
||||
"url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/06f0b06043c7438959dbdeed8bb3f699a19be22e",
|
||||
"reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"netresearch/jsonmapper": "^1.0 || ^2.0",
|
||||
"php": ">=7.0",
|
||||
"phpdocumentor/reflection-docblock": "^4.0.0 || ^5.0.0"
|
||||
"php": "^7.1 || ^8.0",
|
||||
"phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0.0"
|
||||
"phpunit/phpunit": "^7.0 || ^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -859,9 +859,9 @@
|
||||
"description": "A more advanced JSONRPC implementation",
|
||||
"support": {
|
||||
"issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues",
|
||||
"source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/master"
|
||||
"source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.0"
|
||||
},
|
||||
"time": "2020-03-11T15:21:41+00:00"
|
||||
"time": "2021-01-10T17:48:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "felixfbecker/language-server-protocol",
|
||||
@@ -2087,16 +2087,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "8.5.13",
|
||||
"version": "8.5.14",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "8e86be391a58104ef86037ba8a846524528d784e"
|
||||
"reference": "c25f79895d27b6ecd5abfa63de1606b786a461a3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e86be391a58104ef86037ba8a846524528d784e",
|
||||
"reference": "8e86be391a58104ef86037ba8a846524528d784e",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c25f79895d27b6ecd5abfa63de1606b786a461a3",
|
||||
"reference": "c25f79895d27b6ecd5abfa63de1606b786a461a3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2168,7 +2168,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.13"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.14"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2180,7 +2180,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-12-01T04:53:52+00:00"
|
||||
"time": "2021-01-17T07:37:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -3469,16 +3469,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41"
|
||||
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41",
|
||||
"reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
|
||||
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3490,7 +3490,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -3528,7 +3528,7 @@
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3544,20 +3544,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
|
||||
"reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c"
|
||||
"reference": "267a9adeb8ecb8071040a740930e077cdfb987af"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c",
|
||||
"reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af",
|
||||
"reference": "267a9adeb8ecb8071040a740930e077cdfb987af",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3569,7 +3569,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -3609,7 +3609,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3625,20 +3625,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "39d483bdf39be819deabf04ec872eb0b2410b531"
|
||||
"reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531",
|
||||
"reference": "39d483bdf39be819deabf04ec872eb0b2410b531",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
|
||||
"reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3650,7 +3650,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -3689,7 +3689,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3705,20 +3705,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php73.git",
|
||||
"reference": "8ff431c517be11c78c48a39a66d37431e26a6bed"
|
||||
"reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8ff431c517be11c78c48a39a66d37431e26a6bed",
|
||||
"reference": "8ff431c517be11c78c48a39a66d37431e26a6bed",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2",
|
||||
"reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3727,7 +3727,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -3768,7 +3768,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php73/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3784,20 +3784,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.20.0",
|
||||
"version": "v1.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de"
|
||||
"reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de",
|
||||
"reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91",
|
||||
"reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3806,7 +3806,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.20-dev"
|
||||
"dev-main": "1.22-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -3851,7 +3851,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0"
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3867,7 +3867,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-23T14:02:19+00:00"
|
||||
"time": "2021-01-07T16:49:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
@@ -4220,16 +4220,16 @@
|
||||
},
|
||||
{
|
||||
"name": "vimeo/psalm",
|
||||
"version": "4.3.1",
|
||||
"version": "4.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vimeo/psalm.git",
|
||||
"reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476"
|
||||
"reference": "9fd7a7d885b3a216cff8dec9d8c21a132f275224"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/2feba22a005a18bf31d4c7b9bdb9252c73897476",
|
||||
"reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476",
|
||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/9fd7a7d885b3a216cff8dec9d8c21a132f275224",
|
||||
"reference": "9fd7a7d885b3a216cff8dec9d8c21a132f275224",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4261,15 +4261,14 @@
|
||||
"require-dev": {
|
||||
"amphp/amp": "^2.4.2",
|
||||
"bamarni/composer-bin-plugin": "^1.2",
|
||||
"brianium/paratest": "^4.0.0",
|
||||
"brianium/paratest": "^4.0||^6.0",
|
||||
"ext-curl": "*",
|
||||
"php": "^7.3|^8",
|
||||
"phpdocumentor/reflection-docblock": "^5",
|
||||
"phpmyadmin/sql-parser": "5.1.0",
|
||||
"phpmyadmin/sql-parser": "5.1.0||dev-master",
|
||||
"phpspec/prophecy": ">=1.9.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"psalm/plugin-phpunit": "^0.13",
|
||||
"slevomat/coding-standard": "^5.0",
|
||||
"slevomat/coding-standard": "^6.3.11",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"symfony/process": "^4.3",
|
||||
"weirdan/prophecy-shim": "^1.0 || ^2.0"
|
||||
@@ -4319,9 +4318,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vimeo/psalm/issues",
|
||||
"source": "https://github.com/vimeo/psalm/tree/4.3.1"
|
||||
"source": "https://github.com/vimeo/psalm/tree/4.4.1"
|
||||
},
|
||||
"time": "2020-12-03T16:44:10+00:00"
|
||||
"time": "2021-01-14T21:44:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
||||
+9
-3
@@ -1,14 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
executionOrder="defects"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="EmailValidator Test Suite">
|
||||
@@ -20,6 +23,9 @@
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./src/</directory>
|
||||
<exclude>
|
||||
<directory suffix=".php">./src/Result/Reason</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
</phpunit>
|
||||
@@ -125,6 +125,7 @@ class EmailLexer extends AbstractLexer
|
||||
* @var array
|
||||
*
|
||||
* @psalm-var array{value:string, type:null|int, position:int}
|
||||
* @psalm-suppress NonInvariantDocblockPropertyType
|
||||
*/
|
||||
public $token;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class EmailValidator
|
||||
* @param EmailValidation $emailValidation
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($email, EmailValidation $emailValidation)
|
||||
public function isValid(string $email, EmailValidation $emailValidation)
|
||||
{
|
||||
$isValid = $emailValidation->isValid($email, $this->lexer);
|
||||
$this->warnings = $emailValidation->getWarnings();
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
/**
|
||||
* Used on SERVFAIL, TIMEOUT or other runtime and network errors
|
||||
*/
|
||||
class UnableToGetDNSRecord extends NoDNSRecord
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Unable to get DNS records for the host';
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,18 @@ namespace Egulias\EmailValidator\Validation;
|
||||
use Egulias\EmailValidator\EmailLexer;
|
||||
use Egulias\EmailValidator\Result\InvalidEmail;
|
||||
use Egulias\EmailValidator\Result\Reason\DomainAcceptsNoMail;
|
||||
use Egulias\EmailValidator\Warning\NoDNSMXRecord;
|
||||
use Egulias\EmailValidator\Result\Reason\LocalOrReservedDomain;
|
||||
use Egulias\EmailValidator\Result\Reason\NoDNSRecord as ReasonNoDNSRecord;
|
||||
use Egulias\EmailValidator\Result\Reason\UnableToGetDNSRecord;
|
||||
use Egulias\EmailValidator\Warning\NoDNSMXRecord;
|
||||
|
||||
class DNSCheckValidation implements EmailValidation
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected const DNS_RECORD_TYPES_TO_CHECK = DNS_MX + DNS_A + DNS_AAAA;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@@ -114,12 +120,27 @@ class DNSCheckValidation implements EmailValidation
|
||||
*/
|
||||
private function validateDnsRecords($host) : bool
|
||||
{
|
||||
// Get all MX, A and AAAA DNS records for host
|
||||
$dnsRecords = @dns_get_record($host, DNS_MX + DNS_A + DNS_AAAA);
|
||||
// A workaround to fix https://bugs.php.net/bug.php?id=73149
|
||||
/** @psalm-suppress InvalidArgument */
|
||||
set_error_handler(
|
||||
static function (int $errorLevel, string $errorMessage): ?bool {
|
||||
throw new \RuntimeException("Unable to get DNS record for the host: $errorMessage");
|
||||
}
|
||||
);
|
||||
|
||||
try {
|
||||
// Get all MX, A and AAAA DNS records for host
|
||||
$dnsRecords = dns_get_record($host, static::DNS_RECORD_TYPES_TO_CHECK);
|
||||
} catch (\RuntimeException $exception) {
|
||||
$this->error = new InvalidEmail(new UnableToGetDNSRecord(), '');
|
||||
|
||||
return false;
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
// No MX, A or AAAA DNS records
|
||||
if (empty($dnsRecords)) {
|
||||
if ($dnsRecords === [] || $dnsRecords === false) {
|
||||
$this->error = new InvalidEmail(new ReasonNoDNSRecord(), '');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Egulias\EmailValidator\Tests\EmailValidator;
|
||||
use Egulias\EmailValidator\EmailLexer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EmailLexerTests extends TestCase
|
||||
class EmailLexerTest extends TestCase
|
||||
{
|
||||
|
||||
public function testLexerExtendsLib()
|
||||
|
||||
@@ -6,7 +6,7 @@ use Egulias\EmailValidator\EmailLexer;
|
||||
use Egulias\EmailValidator\EmailParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EmailParserTests extends TestCase
|
||||
class EmailParserTest extends TestCase
|
||||
{
|
||||
public function emailPartsProvider()
|
||||
{
|
||||
@@ -28,4 +28,4 @@ class EmailParserTests extends TestCase
|
||||
$this->assertEquals($local, $parser->getLocalPart());
|
||||
$this->assertEquals($domain, $parser->getDomainPart());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,5 +47,8 @@ class EmailValidatorTest extends TestCase
|
||||
$validation->expects($this->once())->method("getError")->willReturn($invalidEmail);
|
||||
|
||||
$this->assertFalse($validator->isValid("example@example.com", $validation));
|
||||
$this->assertEquals(false, $validator->hasWarnings());
|
||||
$this->assertEquals([], $validator->getWarnings());
|
||||
$this->assertEquals($invalidEmail, $validator->getError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Tests\EmailValidator;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LexerTokensTest extends TestCase
|
||||
{
|
||||
public function testToken()
|
||||
{
|
||||
$this->markTestIncomplete("implement beter lexer tokens");
|
||||
$this->markTestIncomplete("implement better lexer tokens");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use Egulias\EmailValidator\Result\MultipleErrors;
|
||||
use Egulias\EmailValidator\Tests\EmailValidator\Dummy\AnotherDummyReason;
|
||||
use Egulias\EmailValidator\Tests\EmailValidator\Dummy\DummyReason;
|
||||
|
||||
class MultipleErrorsTests extends TestCase
|
||||
class MultipleErrorsTest extends TestCase
|
||||
{
|
||||
public function testRegisterSameReason()
|
||||
{
|
||||
@@ -25,11 +25,14 @@ class MultipleErrorsTests extends TestCase
|
||||
{
|
||||
$error1 = new DummyReason();
|
||||
$error2 = new AnotherDummyReason();
|
||||
$expectedReason = $error1->description() . PHP_EOL . $error2->description() . PHP_EOL;
|
||||
|
||||
$multiError = new MultipleErrors();
|
||||
$multiError->addReason($error1);
|
||||
$multiError->addReason($error2);
|
||||
|
||||
$this->assertCount(2, $multiError->getReasons());
|
||||
$this->assertEquals($expectedReason, $multiError->description());
|
||||
$this->assertEquals($error1, $multiError->reason());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\Tests\EmailValidator\Validation;
|
||||
namespace Egulias\EmailValidator\Tests\EmailValidator\Result;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Egulias\EmailValidator\Result\ValidEmail;
|
||||
@@ -32,4 +32,4 @@ class ResultTest extends TestCase
|
||||
$this->assertEquals($expectedCode, $result->code());
|
||||
$this->assertEquals($expectedDescription, $result->description());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace Egulias\EmailValidator\Tests\EmailValidator\Validation;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Egulias\EmailValidator\EmailLexer;
|
||||
use Egulias\EmailValidator\Result\InvalidEmail;
|
||||
use Egulias\EmailValidator\Warning\NoDNSMXRecord;
|
||||
use Egulias\EmailValidator\Validation\DNSCheckValidation;
|
||||
use Egulias\EmailValidator\Result\Reason\DomainAcceptsNoMail;
|
||||
use Egulias\EmailValidator\Result\Reason\LocalOrReservedDomain;
|
||||
use Egulias\EmailValidator\Result\Reason\NoDNSRecord;
|
||||
use Egulias\EmailValidator\Result\Reason\UnableToGetDNSRecord;
|
||||
use Egulias\EmailValidator\Validation\DNSCheckValidation;
|
||||
use Egulias\EmailValidator\Warning\NoDNSMXRecord;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DNSCheckValidationTest extends TestCase
|
||||
{
|
||||
@@ -92,7 +93,7 @@ class DNSCheckValidationTest extends TestCase
|
||||
|
||||
public function testDNSWarnings()
|
||||
{
|
||||
$this->markTestSkipped('Need to found a domain with AAAA redords and no MX that fails later in the validations');
|
||||
$this->markTestSkipped('Need to found a domain with AAAA records and no MX that fails later in the validations');
|
||||
$validation = new DNSCheckValidation();
|
||||
$expectedWarnings = [NoDNSMXRecord::CODE => new NoDNSMXRecord()];
|
||||
$validation->isValid("example@invalid.example.com", new EmailLexer());
|
||||
@@ -106,4 +107,22 @@ class DNSCheckValidationTest extends TestCase
|
||||
$validation->isValid("example@invalid.example.com", new EmailLexer());
|
||||
$this->assertEquals($expectedError, $validation->getError());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
*/
|
||||
public function testUnableToGetDNSRecord()
|
||||
{
|
||||
error_reporting(\E_ALL);
|
||||
|
||||
// UnableToGetDNSRecord raises on network errors (e.g. timeout) that we can‘t emulate in tests (for sure),
|
||||
// but we can try to get timeout error by trying to fetch all DNS records
|
||||
$validation = new class extends DNSCheckValidation {
|
||||
protected const DNS_RECORD_TYPES_TO_CHECK = \DNS_ALL;
|
||||
};
|
||||
$expectedError = new InvalidEmail(new UnableToGetDNSRecord(), '');
|
||||
|
||||
$validation->isValid('example@invalid.example.com', new EmailLexer());
|
||||
$this->assertEquals($expectedError, $validation->getError());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user