Skip to content

Commit

Permalink
PHP 7.4 minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
giggsey committed Oct 4, 2024
1 parent b75c463 commit 1234059
Show file tree
Hide file tree
Showing 37 changed files with 71 additions and 105 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,14 @@ jobs:
strategy:
matrix:
php-version:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
include:
- php-version: 8.1
- php-version: 8.3
coverage: coverage
steps:
- name: Checkout
Expand Down Expand Up @@ -72,10 +65,10 @@ jobs:
- name: Test with phpunit (with coverage)
id: phpunit-coverage
if: "matrix.coverage == 'coverage'"
run: ./phpunit --verbose ${{ env.COVERAGE_FLAGS }}
run: vendor/bin/phpunit --verbose ${{ env.COVERAGE_FLAGS }}
- name: Test with phpunit (without coverage)
if: "matrix.coverage != 'coverage'"
run: ./phpunit --verbose
run: vendor/bin/phpunit --verbose
- name: Submit Coveralls
if: steps.phpunit-coverage.outcome == 'success'
uses: nick-invision/retry@v1
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ A PHP library for parsing, formatting, storing and validating international phon

## Installation

PHP versions 5.3 to PHP 8.3 are currently supported.
PHP versions 7.4 to PHP 8.4 are currently supported.

The PECL [mbstring](http://php.net/mbstring) extension is required.

It is recommended to use [composer](https://getcomposer.org) to install the library.

```bash
$ composer require giggsey/libphonenumber-for-php
composer require giggsey/libphonenumber-for-php
```

You can also use any other [PSR-4](http://www.php-fig.org/psr/psr-4/) compliant autoloader.
Expand Down Expand Up @@ -241,7 +241,7 @@ Generating the data is not normally needed, as this repository will generally al
If you do need to generate the data, the commands are provided by [Phing](https://www.phing.info). Ensure you have all the dev composer dependencies installed, then run

```bash
$ vendor/bin/phing compile
vendor/bin/phing compile
```

This compile process clones the [libphonenumber](https://github.com/google/libphonenumber) project at the version specified in [METADATA-VERSION.txt](METADATA-VERSION.txt).
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@
]
},
"require": {
"php": ">=5.3.2",
"giggsey/locale": "^1.7|^2.0",
"php": "^7.4|^8.0",
"giggsey/locale": "^2.0",
"symfony/polyfill-mbstring": "^1.17"
},
"require-dev": {
"phing/phing": "^2.7",
"pear/versioncontrol_git": "^0.5",
"pear/pear-core-minimal": "^1.9",
"phing/phing": "^3.0",
"pear/versioncontrol_git": "^0.7",
"pear/pear-core-minimal": "^1.10",
"pear/pear_exception": "^1.0",
"symfony/phpunit-bridge": "^4.2 || ^5",
"symfony/console": "^2.8|^3.0|^v4.4|^v5.2",
"php-coveralls/php-coveralls": "^1.0|^2.0"
"phpunit/phpunit": "^9.0",
"symfony/console": "^v5.2",
"php-coveralls/php-coveralls": "^2.0"
},
"replace": {
"giggsey/libphonenumber-for-php-lite": "self.version"
Expand All @@ -82,7 +82,7 @@
}
},
"scripts": {
"test": "./phpunit",
"test": "vendor/bin/phpunit",
"metadata": "vendor/bin/phing compile"
}
}
20 changes: 0 additions & 20 deletions phpunit

This file was deleted.

43 changes: 18 additions & 25 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/bootstrap.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./tests/bootstrap.php"
beStrictAboutTestsThatDoNotTestAnything="false"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
convertErrorsToExceptions="true"
convertDeprecationsToExceptions="true"
colors="true">

colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/data/</directory>
<directory suffix=".php">./src/carrier/data/</directory>
<directory suffix=".php">./src/geocoding/data/</directory>
<directory suffix=".php">./src/timezone/data/</directory>
<file>./src/AlternateFormatsCountryCodeSet.php</file>
<file>./src/CountryCodeToRegionCodeMap.php</file>
<file>./src/CountryCodeToRegionCodeMapForTesting.php</file>
<file>./src/RegionCode.php</file>
</exclude>
</coverage>
<testsuites>
<testsuite name="Unit Tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
<exclude>
<!-- Exclude data directories, and files -->
<directory suffix=".php">./src/data/</directory>
<directory suffix=".php">./src/carrier/data/</directory>
<directory suffix=".php">./src/geocoding/data/</directory>
<directory suffix=".php">./src/timezone/data/</directory>
<file>./src/AlternateFormatsCountryCodeSet.php</file>
<file>./src/CountryCodeToRegionCodeMap.php</file>
<file>./src/CountryCodeToRegionCodeMapForTesting.php</file>
<file>./src/RegionCode.php</file>
</exclude>
</whitelist>
</filter>

</phpunit>
2 changes: 1 addition & 1 deletion tests/Issues/CodeCoverageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CodeCoverageTest extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
4 changes: 2 additions & 2 deletions tests/Issues/Issue106Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class Issue106Test extends TestCase
*/
protected $geocoder;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
self::$TW_Number1 = new PhoneNumber();
self::$TW_Number1->setCountryCode(886)->setNationalNumber(223113731);
}

public function setUp()
public function setUp(): void
{
PhoneNumberOfflineGeocoder::resetInstance();
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue135Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Issue135Test extends TestCase
{
public function setUp()
public function setUp(): void
{
// Reset instance each time
PhoneNumberUtil::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue14Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Issue14Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue152Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Issue152Test extends TestCase
{
public function setUp()
public function setUp(): void
{
// Reset instance each time
PhoneNumberUtil::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue159Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Issue159Test extends TestCase
{
const LOS_ANGELES_TZ = 'America/Los_Angeles';

public function setUp()
public function setUp(): void
{
// Reset instance each time
PhoneNumberUtil::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue175Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Issue175Test extends TestCase
{
public function setUp()
public function setUp(): void
{
// Reset instance each time
PhoneNumberUtil::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue17Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Issue17Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
PhoneNumberOfflineGeocoder::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue21Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Issue21Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue23Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Issue23Test extends TestCase
*/
private $geocoder;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue34Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Issue34Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue35Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Issue35Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue36Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Issue36Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
PhoneNumberOfflineGeocoder::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Issue3Test extends TestCase
*/
public $phoneNumberUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue44Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Issue44Test extends TestCase
*/
private $geocoder;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Issue4Test extends TestCase
*/
public $phoneNumberUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/LocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LocaleTest extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
PhoneNumberOfflineGeocoder::resetInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/PHP7Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PHP7Test extends TestCase
*/
private $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/RegionCodeCaseInsensitiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RegionCodeCaseInsensitiveTest extends TestCase
*/
private $shortInfo;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/UKNumbersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UKNumbersTest extends TestCase
*/
protected $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion tests/buildtools/GeneratePhonePrefixDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class GeneratePhonePrefixDataTest extends TestCase
{
private static $available_data_files;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
$temporaryMap = array();

Expand Down
4 changes: 2 additions & 2 deletions tests/carrier/PhoneNumberToCarrierMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PhoneNumberToCarrierMapperTest extends TestCase
*/
protected $carrierMapper;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
PhoneNumberUtil::resetInstance();

Expand Down Expand Up @@ -75,7 +75,7 @@ public static function setUpBeforeClass()
self::$INTERNATIONAL_TOLL_FREE->setCountryCode(800)->setNationalNumber(12345678);
}

public function setUp()
public function setUp(): void
{
$this->carrierMapper = PhoneNumberToCarrierMapper::getInstance(__DIR__ . '/../carrier/data/');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/core/AsYouTypeFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AsYouTypeFormatterTest extends TestCase
*/
protected $phoneUtil;

public function setUp()
public function setUp(): void
{
PhoneNumberUtil::resetInstance();
$this->phoneUtil = PhoneNumberUtil::getInstance(
Expand Down
Loading

0 comments on commit 1234059

Please sign in to comment.