diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8eaee31..2e9c0c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: php-version: ${{matrix.php}} tools: phpunit, composer - run: composer install --no-interaction - - run: ./vendor/bin/phpunit --migrate-configuration + - run: ./vendor/bin/phpunit ruby: strategy: matrix: diff --git a/src/Validator.php b/src/Validator.php index 969b060..18538a1 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -43,13 +43,13 @@ class Validator { preg_match_all($regex, $address, $matches); $results = array_reduce($matches, function($res, $match) { - if ($match[0] and in_array($match[0], $res, true) === false){ + if (isset($match[0]) and in_array($match[0], $res, true) === false){ $res[] = $match[0]; } return $res; }, $results); } - return $results; + return array_values($results); } }