Skip to content

Commit d54eb87

Browse files
committed
Remove support for old PHP and Laravel
1 parent db9649f commit d54eb87

File tree

7 files changed

+34
-64
lines changed

7 files changed

+34
-64
lines changed

.github/workflows/phpunit.yml

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
laravel: [ 5.5.*, 5.6.*, 5.7.*, 5.8.*, 6.*, 7.* ]
13-
php: [ 7.2 ]
12+
laravel: [ 10.* ]
13+
php: [ 8.1 ]
1414
include:
15-
- laravel: 6.*
16-
php: 7.3
17-
- laravel: 6.*
18-
php: 7.4
19-
- laravel: 6.*
20-
php: 8.0
21-
- laravel: 7.*
22-
php: 7.3
23-
- laravel: 7.*
24-
php: 7.4
25-
- laravel: 7.*
26-
php: 8.0
27-
- laravel: 8.*
28-
php: 7.3
29-
- laravel: 8.*
30-
php: 7.4
31-
- laravel: 8.*
32-
php: 8.0
33-
- laravel: 8.*
34-
php: 8.1
35-
- laravel: 9.*
36-
php: 8.0
37-
- laravel: 9.*
38-
php: 8.1
39-
- laravel: 9.*
40-
php: 8.2
41-
- laravel: 10.*
42-
php: 8.1
4315
- laravel: 10.*
4416
php: 8.2
4517
- laravel: 10.*
@@ -48,10 +20,14 @@ jobs:
4820
php: 8.2
4921
- laravel: 11.*
5022
php: 8.3
23+
- laravel: 11.*
24+
php: 8.4
5125
- laravel: 12.*
5226
php: 8.2
5327
- laravel: 12.*
5428
php: 8.3
29+
- laravel: 12.*
30+
php: 8.4
5531
name: PHPUnit on Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }}
5632
steps:
5733
- name: Checkout code

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
## 4.0.0
66

7+
### Changed
8+
9+
- Minimum Laravel version is now 10.0
10+
- Minimum PHP version is now 8.1
11+
712
### Removed
813

914
- Lumen is no longer supported

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ Worldwide postal code validation for Laravel, based on Google's Address Data Ser
3232

3333
## Requirements
3434

35-
This package has the following requirements:
36-
37-
- PHP 7.2 or greater
38-
- Laravel 5.5 or greater
35+
This package supports Laravel 10 or greater, for older versions of Laravel please check out older versions of this
36+
package.
3937

4038
## Installation
4139

composer.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^7.2 || ^8.0",
21-
"illuminate/contracts": "^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
22-
"illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
23-
"illuminate/validation": "^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"
20+
"php": ">=8.1",
21+
"illuminate/support": "^10.0 || ^11.0 || ^12.0",
22+
"illuminate/validation": "^10.0 || ^11.0 || ^12.0"
2423
},
2524
"require-dev": {
2625
"guzzlehttp/guzzle": "^7.8",
27-
"orchestra/testbench": "^3.5 || ^4.18 || ^5.20 || ^6.47 || ^7.53 || ^8.34 || ^9.12 || ^10.1",
28-
"phpunit/phpunit": "^6.5 || ^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5",
29-
"symfony/var-exporter": "^4.0 || ^5.0 || ^6.0 || ^7.0"
26+
"orchestra/testbench": "^8.34 || ^9.12 || ^10.1",
27+
"phpunit/phpunit": "^10.5 || ^11.5",
28+
"symfony/var-exporter": "^6.4 || ^7.0"
3029
},
3130
"autoload": {
3231
"psr-4": {
@@ -39,10 +38,7 @@
3938
}
4039
},
4140
"config": {
42-
"sort-packages": true,
43-
"allow-plugins": {
44-
"kylekatarnls/update-helper": false
45-
}
41+
"sort-packages": true
4642
},
4743
"extra": {
4844
"laravel": {

phpunit.xml.dist

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55
colors="true"
66
processIsolation="false"
77
stopOnFailure="false"
8-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
9-
cacheDirectory=".phpunit.cache"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache"
109
backupStaticProperties="false">
11-
<coverage>
12-
<include>
13-
<directory suffix=".php">./src</directory>
14-
</include>
15-
</coverage>
10+
<coverage/>
1611
<testsuites>
1712
<testsuite name="Integration">
1813
<directory suffix="Test.php">./tests/Integration</directory>
@@ -21,4 +16,9 @@
2116
<directory suffix="Test.php">./tests/Unit</directory>
2217
</testsuite>
2318
</testsuites>
19+
<source>
20+
<include>
21+
<directory suffix=".php">./src</directory>
22+
</include>
23+
</source>
2424
</phpunit>

src/ValidationServiceProvider.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Axlon\PostalCodeValidation;
44

5-
use Illuminate\Contracts\Validation\Factory;
65
use Illuminate\Support\ServiceProvider;
6+
use Illuminate\Validation\Factory;
77

8-
class ValidationServiceProvider extends ServiceProvider
8+
final class ValidationServiceProvider extends ServiceProvider
99
{
1010
/**
1111
* Register postal code validation services.
@@ -14,13 +14,7 @@ class ValidationServiceProvider extends ServiceProvider
1414
*/
1515
public function register(): void
1616
{
17-
if ($this->app->resolved('validator')) {
18-
$this->registerRules($this->app['validator']);
19-
} else {
20-
$this->app->resolving('validator', function (Factory $validator) {
21-
$this->registerRules($validator);
22-
});
23-
}
17+
$this->callAfterResolving('validator', self::registerRules(...));
2418

2519
$this->app->singleton('postal_codes', function () {
2620
return new PostalCodeValidator(require __DIR__ . '/../resources/patterns.php');
@@ -32,10 +26,10 @@ public function register(): void
3226
/**
3327
* Register the postal code validation rules with the validator.
3428
*
35-
* @param \Illuminate\Contracts\Validation\Factory $validator
29+
* @param \Illuminate\Validation\Factory $validator
3630
* @return void
3731
*/
38-
public function registerRules(Factory $validator): void
32+
private static function registerRules(Factory $validator): void
3933
{
4034
$validator->extend('postal_code', 'Axlon\PostalCodeValidation\Extensions\PostalCode@validate');
4135
$validator->replacer('postal_code', 'Axlon\PostalCodeValidation\Extensions\PostalCode@replace');

tests/Unit/PostalCodeValidatorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Axlon\PostalCodeValidation\PostalCodeValidator;
66
use Illuminate\Support\Collection;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89

910
class PostalCodeValidatorTest extends TestCase
@@ -53,8 +54,8 @@ public function testCanaryIslands(): void
5354
* @param string $country
5455
* @param string $example
5556
* @return void
56-
* @dataProvider provideExamples
5757
*/
58+
#[DataProvider('provideExamples')]
5859
public function testExamplesAreValidPatterns(string $country, string $example): void
5960
{
6061
$this->assertTrue($this->validator->passes($country, $example));

0 commit comments

Comments
 (0)