Skip to content

Commit f875c0a

Browse files
committed
libphonenumber-for-php v9 changes
- PHP 8.1 min - PHPStan level 7 - Strong types throughout
1 parent 6b92a95 commit f875c0a

File tree

1,212 files changed

+71533
-69568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,212 files changed

+71533
-69568
lines changed

.gitattributes

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ tests/ export-ignore
44
.editorconfig export-ignore
55
.gitattributes export-ignore
66
.gitignore export-ignore
7-
.styleci.yml export-ignore
8-
.travis.yml export-ignore
7+
.php-cs-fixer.dist.php export-ignore
98
build.xml export-ignore
10-
libphonenumber-for-php.spec export-ignore
119
phpunit.xml.dist export-ignore
12-
phpunit export-ignore
1310
.github/ export-ignore
1411
src/CountryCodeToRegionCodeMapForTesting.php export-ignore
15-
12+
phpstan.neon.dist export-ignore
1613

1714
* text=auto

.github/workflows/sast.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "SAST"
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
paths-ignore:
8+
- 'docs/**'
9+
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
12+
13+
jobs:
14+
phpstan:
15+
name: "PHPStan"
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup PHP, with composer and extensions
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: 8.3
25+
26+
- uses: "ramsey/composer-install@v3"
27+
with:
28+
dependency-versions: highest
29+
30+
- name: Run PHPStan
31+
run: "composer run-script phpstan"

.php-cs-fixer.dist.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
return $config->setRules(
1010
[
1111
'@PER-CS2.0' => true,
12-
'@PHP74Migration' => true,
12+
'@PHP81Migration' => true,
1313
'single_quote' => true,
1414
'no_unused_imports' => true,
1515
'no_superfluous_phpdoc_tags' => [
@@ -18,7 +18,19 @@
1818
'remove_inheritdoc' => true,
1919
],
2020
'phpdoc_trim' => true,
21+
'declare_strict_types' => true,
22+
'php_unit_attributes' => true,
23+
'@PHPUnit100Migration:risky' => true,
24+
'global_namespace_import' => [
25+
'import_classes' => true,
26+
'import_constants' => true,
27+
'import_functions' => true,
28+
],
29+
'no_empty_phpdoc' => true,
30+
'phpdoc_align' => ['align' => 'left'],
31+
'phpdoc_types' => true,
2132
]
2233
)
23-
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
24-
->setFinder($finder);
34+
->setRiskyAllowed(true)
35+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
36+
->setFinder($finder);

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A PHP library for parsing, formatting, storing and validating international phon
2626

2727
## Installation
2828

29-
PHP versions 7.4 to PHP 8.4 are currently supported.
29+
PHP versions 8.1 to 8.4 are currently supported.
3030

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

@@ -44,6 +44,10 @@ If you do not use composer, ensure that you also load any dependencies that this
4444

4545
If you only want to make use of the core PhoneNumber Util functionality, you can use [giggsey/libphonenumber-for-php-lite](https://github.com/giggsey/libphonenumber-for-php-lite), which offers a much smaller package size.
4646

47+
### PHP Version Policy
48+
49+
This library will be updated to use [supported versions of PHP](https://www.php.net/supported-versions.php) without major version bumps.
50+
4751
## Documentation
4852

4953
- [PhoneNumber Util](docs/PhoneNumberUtil.md)

build/BuildApplication.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace libphonenumber\buildtools;
46

57
use libphonenumber\buildtools\Commands\BuildMetadataPHPFromXMLCommand;
68
use libphonenumber\buildtools\Commands\GeneratePhonePrefixDataCommand;
79
use libphonenumber\buildtools\Commands\GenerateTimeZonesMapDataCommand;
810
use Symfony\Component\Console\Application;
911

12+
/**
13+
* @internal
14+
*/
1015
class BuildApplication extends Application
1116
{
1217
public const VERSION = '5';

0 commit comments

Comments
 (0)