Skip to content

Commit d4430ae

Browse files
L12 composer updates (#47)
* Update README file * Update composer dependencies * Fix phpunit dep * Update actions/checkout v4
1 parent 82f608a commit d4430ae

File tree

5 files changed

+16
-22
lines changed

5 files changed

+16
-22
lines changed

.github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Checkout code
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636

3737
- name: Setup PHP
3838
uses: shivammathur/setup-php@v2

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Laravel VAT EU VALIDATOR
88

99
laravel-vat-eu-validator is a package inspired from [vat.php](https://github.com/dannyvankooten/vat.php) to validate a VAT number for businesses based in Europe.
1010

11-
#### For Laravel 10,11 use tag 2.x
12-
#### For Laravel 8,9 use tag 1.20
13-
#### For Laravel 5,6,7 use tag 0.5.4
11+
#### For Laravel 10, 11, 12 use tag 2.x
12+
#### For Laravel 8, 9 use tag 1.20
13+
#### For Laravel 5, 6, 7 use tag 0.5.4
1414

1515
## Installation
1616

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
"illuminate/support": "^10.0|^11.0|^12.0"
3030
},
3131
"require-dev": {
32-
"driftingly/rector-laravel": "^1.2|^2.0",
32+
"driftingly/rector-laravel": "^2.0",
3333
"friendsofphp/php-cs-fixer": "^3.59",
3434
"orchestra/testbench": "^8.1|^9.1|^10.0",
3535
"phpstan/extension-installer": "^1.4",
36-
"phpstan/phpstan": "^1.4.7|^2.1",
37-
"phpstan/phpstan-deprecation-rules": "^1.2|^2.0",
38-
"phpstan/phpstan-phpunit": "^1.4|^2.0",
36+
"phpstan/phpstan": "^2.1",
37+
"phpstan/phpstan-deprecation-rules": "^2.0",
38+
"phpstan/phpstan-phpunit": "^2.0",
3939
"phpunit/phpunit": "^10.5|^11.0",
40-
"rector/rector": "^1.1|^2.0"
40+
"rector/rector": "^2.0"
4141
},
4242
"autoload": {
4343
"psr-4": {

src/VatValidator.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,17 @@ public static function luhnCheck(string $vat): int
144144
/**
145145
* Validates a Hungarian VAT number.
146146
*
147-
* @param string $vat
147+
* @param string $vatNumber
148148
* @return bool
149149
*/
150-
private function validateHuVat(string $vat): bool
150+
private function validateHuVat(string $vatNumber): bool
151151
{
152-
$checksum = (int) $vat[7];
152+
$checksum = (int) $vatNumber[7];
153153
$weights = [9, 7, 3, 1, 9, 7, 3];
154154
$sum = 0;
155155

156156
foreach ($weights as $i => $weight) {
157-
$sum += (int) $vat[$i] * $weight;
157+
$sum += (int) $vatNumber[$i] * $weight;
158158
}
159159

160160
$calculatedChecksum = (10 - ($sum % 10)) % 10;

src/VatValidatorServiceProvider.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ static function (?string $message = null) use (&$passed): void {
3737
}
3838
);
3939

40-
Validator::replacer('vat_number', function ($message, $attribute, $rule, $parameters) {
41-
return __('laravelVatEuValidator::validation.vat_number', ['attribute' => $attribute]);
42-
});
40+
Validator::replacer('vat_number', fn ($message, $attribute, $rule, $parameters) => __('laravelVatEuValidator::validation.vat_number', ['attribute' => $attribute]));
4341

4442
/**
4543
* Register the "vat_number_exist" validation rule.
@@ -62,9 +60,7 @@ static function (?string $message = null) use (&$passed): void {
6260
}
6361
);
6462

65-
Validator::replacer('vat_number_exist', function ($message, $attribute, $rule, $parameters) {
66-
return __('laravelVatEuValidator::validation.vat_number_exist', ['attribute' => $attribute]);
67-
});
63+
Validator::replacer('vat_number_exist', fn ($message, $attribute, $rule, $parameters) => __('laravelVatEuValidator::validation.vat_number_exist', ['attribute' => $attribute]));
6864

6965
/**
7066
* Register the "vat_number_format" validation rule.
@@ -87,9 +83,7 @@ static function (?string $message = null) use (&$passed): void {
8783
}
8884
);
8985

90-
Validator::replacer('vat_number_format', function ($message, $attribute, $rule, $parameters) {
91-
return __('laravelVatEuValidator::validation.vat_number_format', ['attribute' => $attribute]);
92-
});
86+
Validator::replacer('vat_number_format', fn ($message, $attribute, $rule, $parameters) => __('laravelVatEuValidator::validation.vat_number_format', ['attribute' => $attribute]));
9387

9488
$this->loadTranslationsFrom(
9589
__DIR__.'/../resources/lang',

0 commit comments

Comments
 (0)