Skip to content

Commit 9b6d446

Browse files
authored
Merge pull request #8 from worksome/feature/coding-style-3.x
chore(deps-dev): JIRA-14428 update Coding Style to 3.x
2 parents c0625c0 + f3ab6a8 commit 9b6d446

File tree

12 files changed

+33
-30
lines changed

12 files changed

+33
-30
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [ ubuntu-latest ]
13-
php: [ 8.2, 8.3 ]
14-
laravel: [ 10.*, 11.* ]
13+
php: [ 8.2, 8.3, 8.4 ]
14+
laravel: [ 11.* ]
1515
stability: [ prefer-lowest, prefer-stable ]
1616
include:
17-
- laravel: 10.*
18-
testbench: 8.*
1917
- laravel: 11.*
2018
testbench: 9.*
2119

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
],
1212
"require": {
1313
"php": "^8.2",
14-
"thecodingmachine/safe": "^2.5",
15-
"illuminate/contracts": "^10.0 || ^11.0",
16-
"illuminate/pipeline": "^10.0 || ^11.0"
14+
"thecodingmachine/safe": "^2.5 || ^3.0",
15+
"illuminate/contracts": "^11.0",
16+
"illuminate/pipeline": "^11.0"
1717
},
1818
"require-dev": {
19-
"pestphp/pest": "^2.33",
20-
"worksome/coding-style": "^2.8"
19+
"pestphp/pest": "^3.7",
20+
"worksome/coding-style": "^3.1"
2121
},
2222
"autoload": {
2323
"psr-4": {

phpstan-baseline.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '''
5+
#^Class Worksome\\UkTaxCodeValidator\\UkTaxCode implements deprecated interface Illuminate\\Contracts\\Validation\\Rule\:
6+
see ValidationRule$#
7+
'''
8+
identifier: class.implementsDeprecatedInterface
9+
count: 1
10+
path: src/UkTaxCode.php

phpstan.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
includes:
2+
- ./vendor/worksome/coding-style/phpstan.neon
3+
- phpstan-baseline.neon
4+
15
parameters:
26
paths:
37
- src
48

59
# The level 8 is the highest level
610
level: 5
11+
12+
worksome:
13+
declareStrictTypes: false

src/Engine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function validate(string|TaxCode $taxCode): Response
1717

1818
return $this->validationPipeline($taxCode)
1919
->then(
20-
fn(TaxCode $taxCode) => $taxCode->getTaxCode() !== ''
20+
fn (TaxCode $taxCode) => $taxCode->getTaxCode() !== ''
2121
? Response::error('Invalid tax code.')
2222
: Response::success('Tax code is valid.')
2323
);
@@ -30,7 +30,7 @@ public function getModifiers(string $taxCode): array
3030
{
3131
return $this->validationPipeline(
3232
new TaxCode($taxCode)
33-
)->then(fn(TaxCode $taxCode) => $taxCode->getModifiers());
33+
)->then(fn (TaxCode $taxCode) => $taxCode->getModifiers());
3434
}
3535

3636
private function validationPipeline(TaxCode $taxCode): Pipeline

src/Middlewares/EmergencyCodeModifier.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Worksome\UkTaxCodeValidator\Middlewares;
44

55
use Closure;
6-
use JetBrains\PhpStorm\Pure;
76
use Worksome\UkTaxCodeValidator\Response;
87
use Worksome\UkTaxCodeValidator\Rules\MonthOneEmergencyRule;
98
use Worksome\UkTaxCodeValidator\Rules\RuleInterface;
@@ -16,7 +15,6 @@ class EmergencyCodeModifier implements ModifierInterface
1615
/** @var RuleInterface[] */
1716
private array $emergencyCodeRules;
1817

19-
#[Pure]
2018
public function __construct()
2119
{
2220
$this->emergencyCodeRules = [
@@ -29,7 +27,7 @@ public function __construct()
2927
public function handle(TaxCode $taxCode, Closure $next)
3028
{
3129
$validEmergencyCodeRules = collect($this->emergencyCodeRules)
32-
->filter(fn(RuleInterface $rule) => $rule->validate($taxCode));
30+
->filter(fn (RuleInterface $rule) => $rule->validate($taxCode));
3331

3432
if ($validEmergencyCodeRules->count() > 1) {
3533
return Response::error('Only one emergency tax code is allowed.');

src/Middlewares/RegimeModifier.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Worksome\UkTaxCodeValidator\Middlewares;
44

55
use Closure;
6-
use JetBrains\PhpStorm\Pure;
76
use Worksome\UkTaxCodeValidator\Response;
87
use Worksome\UkTaxCodeValidator\Rules\RuleInterface;
98
use Worksome\UkTaxCodeValidator\Rules\ScottishIncomeRule;
@@ -15,7 +14,6 @@ class RegimeModifier implements ModifierInterface
1514
/** @var RuleInterface[] */
1615
private array $countryModifierRules;
1716

18-
#[Pure]
1917
public function __construct()
2018
{
2119
$this->countryModifierRules = [
@@ -27,14 +25,15 @@ public function __construct()
2725
public function handle(TaxCode $taxCode, Closure $next)
2826
{
2927
$validCountryRules = collect($this->countryModifierRules)
30-
->filter(fn(RuleInterface $rule) => $rule->validate($taxCode));
28+
->filter(fn (RuleInterface $rule) => $rule->validate($taxCode));
3129

3230
if ($validCountryRules->count() > 1) {
3331
return Response::error('Only one regime modifier is allowed.');
3432
}
3533

3634
// Consume the country modifier.
3735
$taxCode = $validCountryRules->first()?->consume($taxCode) ?? $taxCode;
36+
3837
return $next($taxCode);
3938
}
4039
}

src/Middlewares/RemoveSpaces.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function handle(TaxCode $taxCode, Closure $next)
1515
$cleaned,
1616
$taxCode->getOriginalTaxCode()
1717
);
18+
1819
return $next($newTaxCode);
1920
}
2021
}

src/Middlewares/TaxCodeModifier.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace Worksome\UkTaxCodeValidator\Middlewares;
44

55
use Closure;
6-
use JetBrains\PhpStorm\Pure;
76
use Worksome\UkTaxCodeValidator\Response;
87
use Worksome\UkTaxCodeValidator\Rules\AdditionalRateRule;
8+
use Worksome\UkTaxCodeValidator\Rules\AdvancedScottishRateRule;
99
use Worksome\UkTaxCodeValidator\Rules\BasicPersonalAllowanceRule;
1010
use Worksome\UkTaxCodeValidator\Rules\BasicRateRule;
1111
use Worksome\UkTaxCodeValidator\Rules\HigherRateRule;
@@ -15,7 +15,6 @@
1515
use Worksome\UkTaxCodeValidator\Rules\NoTaxesRule;
1616
use Worksome\UkTaxCodeValidator\Rules\RuleInterface;
1717
use Worksome\UkTaxCodeValidator\Rules\TemporaryTaxCodeRule;
18-
use Worksome\UkTaxCodeValidator\Rules\AdvancedScottishRateRule;
1918
use Worksome\UkTaxCodeValidator\Rules\TopScottishRateRule;
2019
use Worksome\UkTaxCodeValidator\TaxCode;
2120

@@ -24,7 +23,6 @@ class TaxCodeModifier implements ModifierInterface
2423
/** @var RuleInterface[] */
2524
private array $taxCodeRules;
2625

27-
#[Pure]
2826
public function __construct()
2927
{
3028
$this->taxCodeRules = [
@@ -45,7 +43,7 @@ public function __construct()
4543
public function handle(TaxCode $taxCode, Closure $next)
4644
{
4745
$validTaxCodeRules = collect($this->taxCodeRules)
48-
->filter(fn(RuleInterface $rule) => $rule->validate($taxCode));
46+
->filter(fn (RuleInterface $rule) => $rule->validate($taxCode));
4947

5048
if ($validTaxCodeRules->count() !== 1) {
5149
return Response::error("There should only be one tax code, found {$validTaxCodeRules->count()}.");

src/Response.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Worksome\UkTaxCodeValidator;
44

5-
use JetBrains\PhpStorm\Pure;
6-
75
/**
86
* @internal
97
*/
@@ -15,13 +13,11 @@ public function __construct(
1513
) {
1614
}
1715

18-
#[Pure]
1916
public static function error(string ... $errors): self
2017
{
2118
return new self(errors: $errors);
2219
}
2320

24-
#[Pure]
2521
public static function success(string ... $successes): self
2622
{
2723
return new self(successes: $successes);

0 commit comments

Comments
 (0)