diff --git a/.gitignore b/.gitignore index 66e4360..97d2c37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ +# General Ignores /vendor composer.lock /phpunit/ +# IDEs .idea/ +/nbproject/ diff --git a/.travis.yml b/.travis.yml index 5cec0b1..baff00d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,27 @@ language: php php: + - '5.4' + - '5.5' - '5.6' - '7.0' + - '7.1' + - '7.2' - hhvm - nightly +matrix: + include: + - php: "5.3" + dist: precise +git: +#there should rarely be a need to clone 50 deep, so this is just reducing build-time + depth: 5 before_script: +# no need to provide coverage more than once and no need for the speedbump otherwise + - if [[ ${TRAVIS_PHP_VERSION:0:3} != "7.1" ]]; then phpenv config-rm xdebug.ini || true ; fi +# no need to test formatting more than once and php_codesniffer does not work with older php + - if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.6" ]]; then composer remove --dev squizlabs/php_codesniffer ; fi - composer install script: - - composer check-style - - composer test +# since it's disabled otherwise... + - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then composer check-style ; fi + - composer test \ No newline at end of file diff --git a/composer.json b/composer.json index 0c42047..deb4187 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "description": "PHP Regular expressions made easy", "require": { - "php": ">=5.6" + "php": ">=5.3" }, "require-dev": { "phpunit/phpunit": "* >=4", diff --git a/src/VerbalExpressions.php b/src/VerbalExpressions.php index 38832ac..6407aa6 100644 --- a/src/VerbalExpressions.php +++ b/src/VerbalExpressions.php @@ -297,8 +297,9 @@ public function any($value) * @return VerbalExpressions * @throws \InvalidArgumentException */ - public function range(... $args) + public function range() { + $args = func_get_args(); $arg_num = count($args); if ($arg_num%2 != 0) { @@ -483,8 +484,8 @@ public function test($value) // php doesn't have g modifier so we remove it if it's there and call preg_match_all() if (strpos($this->modifiers, 'g') !== false) { $this->modifiers = str_replace('g', '', $this->modifiers); - - return preg_match_all($this->getRegex(), $value); + $matches = array();//because it's not optional in <5.4 + return preg_match_all($this->getRegex(), $value, $matches); } return (bool) preg_match($this->getRegex(), $value);