mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-30 12:07:59 +00:00
[1.2] PHP 7.4 Support (#222)
* Fixes * Backport PHP 7.4 support from 2.x Co-Authored-By: mlocati <michele@locati.it> * Added php-coveralls Co-authored-by: Michele Locati <michele@locati.it>
This commit is contained in:
committed by
Eduardo Gulias Davis
parent
e7dacfc97f
commit
0d6268fde5
+25
-126
@@ -1,138 +1,37 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache/files
|
||||
|
||||
matrix:
|
||||
|
||||
fast_finish: true
|
||||
|
||||
allow_failures:
|
||||
- name: Test with PHP 7.4
|
||||
- name: Test with PHP Nightly
|
||||
|
||||
include:
|
||||
|
||||
- name: Test with PHP 7.2 (with code coverage)
|
||||
php: '7.2'
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- mkdir -p build/logs
|
||||
- composer test -- --coverage-clover build/logs/clover.xml
|
||||
|
||||
- name: Test with PHP 5.3
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
php: '5.3'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP 5.3 (current dependencies)
|
||||
env: deps=low
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
php: '5.3'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer install
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP 5.3 (lowest dependencies)
|
||||
dist: precise
|
||||
php: '5.3'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update --prefer-lowest
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP 5.4
|
||||
- php: 5.4
|
||||
dist: trusty
|
||||
php: '5.4'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP 5.5
|
||||
- php: 5.5
|
||||
dist: trusty
|
||||
php: '5.5'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
- php: 5.6
|
||||
dist: xenial
|
||||
- php: 7.0
|
||||
dist: xenial
|
||||
- php: 7.1
|
||||
dist: bionic
|
||||
- php: 7.2
|
||||
dist: bionic
|
||||
- php: 7.3
|
||||
dist: bionic
|
||||
- php: 7.4
|
||||
dist: bionic
|
||||
|
||||
- name: Test with PHP 5.6
|
||||
php: '5.6'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
install:
|
||||
- if [ "$deps" = "low" ]; then composer update --prefer-lowest; else composer install; fi
|
||||
|
||||
- name: Test with PHP 5.6 (current dependencies)
|
||||
php: '5.6'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer install
|
||||
script:
|
||||
- composer test
|
||||
before_script:
|
||||
- mkdir -p build/logs
|
||||
|
||||
- name: Test with PHP 7.0
|
||||
php: '7.0'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
script:
|
||||
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
|
||||
|
||||
- name: Test with PHP 7.1
|
||||
php: '7.1'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP 7.3
|
||||
php: '7.3'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP 7.4
|
||||
php: '7.4snapshot'
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update
|
||||
script:
|
||||
- composer test
|
||||
|
||||
- name: Test with PHP Nightly
|
||||
php: nightly
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
install:
|
||||
- composer update --ignore-platform-reqs
|
||||
script:
|
||||
- composer test
|
||||
after_script:
|
||||
- php vendor/bin/coveralls
|
||||
|
||||
+5
-10
@@ -2,23 +2,18 @@
|
||||
"name": "egulias/email-validator",
|
||||
"description": "A library for validating emails",
|
||||
"homepage": "https://github.com/egulias/EmailValidator",
|
||||
"type": "Library",
|
||||
"keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{"name": "Eduardo Gulias Davis"}
|
||||
],
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">= 5.3.3",
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"doctrine/lexer": "^1.0.1"
|
||||
},
|
||||
"require-dev" : {
|
||||
"phpunit/phpunit": "^4.8.24"
|
||||
"require-dev": {
|
||||
"satooshi/php-coveralls": "^1.0.1",
|
||||
"phpunit/phpunit": "^4.8.36|^7.5.15"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
|
||||
Generated
-1078
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
>
|
||||
<testsuites>
|
||||
|
||||
@@ -77,10 +77,22 @@ class EmailLexer extends AbstractLexer
|
||||
|
||||
protected $previous;
|
||||
|
||||
private static $nullToken = array(
|
||||
'value' => '',
|
||||
'type' => null,
|
||||
'position' => 0,
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->previous = $this->token = self::$nullToken;
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->hasInvalidTokens = false;
|
||||
parent::reset();
|
||||
$this->previous = $this->token = self::$nullToken;
|
||||
}
|
||||
|
||||
public function hasInvalidTokens()
|
||||
@@ -122,8 +134,10 @@ class EmailLexer extends AbstractLexer
|
||||
public function moveNext()
|
||||
{
|
||||
$this->previous = $this->token;
|
||||
$hasNext = parent::moveNext();
|
||||
$this->token = $this->token ?: self::$nullToken;
|
||||
|
||||
return parent::moveNext();
|
||||
return $hasNext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -141,7 +141,7 @@ class DomainPart extends Parser
|
||||
|
||||
$domain .= $this->lexer->token['value'];
|
||||
$this->lexer->moveNext();
|
||||
} while ($this->lexer->token);
|
||||
} while (null !== $this->lexer->token['type']);
|
||||
|
||||
return $domain;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,12 @@ class LocalPart extends Parser
|
||||
$closingQuote = false;
|
||||
$openedParenthesis = 0;
|
||||
|
||||
while ($this->lexer->token['type'] !== EmailLexer::S_AT && $this->lexer->token) {
|
||||
if ($this->lexer->token['type'] === EmailLexer::S_DOT && !$this->lexer->getPrevious()) {
|
||||
throw new \InvalidArgumentException('ERR_DOT_START');
|
||||
while ($this->lexer->token['type'] !== EmailLexer::S_AT && null !== $this->lexer->token['type']) {
|
||||
if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
|
||||
$previous = $this->lexer->getPrevious();
|
||||
if (null === $previous['type']) {
|
||||
throw new \InvalidArgumentException('ERR_DOT_START');
|
||||
}
|
||||
}
|
||||
|
||||
$closingQuote = $this->checkDQUOTE($closingQuote);
|
||||
@@ -78,7 +81,7 @@ class LocalPart extends Parser
|
||||
|
||||
$this->lexer->moveNext();
|
||||
|
||||
while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && $this->lexer->token) {
|
||||
while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && null !== $this->lexer->token['type']) {
|
||||
$parseAgain = false;
|
||||
if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) {
|
||||
$this->warnings[] = EmailValidator::CFWS_FWS;
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
namespace Egulias\EmailValidator\Tests;
|
||||
|
||||
use Egulias\EmailValidator\EmailLexer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EmailLexerTests extends \PHPUnit_Framework_TestCase
|
||||
class EmailLexerTests extends TestCase
|
||||
{
|
||||
|
||||
public function testLexerExtendsLib()
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
namespace Egulias\Tests\EmailValidator;
|
||||
|
||||
use Egulias\EmailValidator\EmailValidator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
class EmailValidatorTest extends TestCase
|
||||
{
|
||||
protected $validator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user