From 86e276b81c43042f8d2c2f56f8895564a0703276 Mon Sep 17 00:00:00 2001 From: Nemo Date: Sun, 2 Jul 2023 14:50:58 +0530 Subject: [PATCH] [php] Fix 7.2 tests --- .github/workflows/tests.yml | 2 +- src/Validator.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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); } }