Skip to content

Commit 52d9522

Browse files
committed
php 8.4
1 parent bcade51 commit 52d9522

9 files changed

+42
-80
lines changed

.github/workflows/check_imports.yml

-33
This file was deleted.

.github/workflows/tests.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
php: ['8.0', '8.1', '8.2', '8.3']
13+
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
1414
laravel: [9.*, 10.*, 11.*]
1515
stability: [prefer-lowest, prefer-stable]
1616
include:
@@ -23,6 +23,8 @@ jobs:
2323
exclude:
2424
- laravel: 9.*
2525
php: 8.3
26+
- laravel: 9.*
27+
php: 8.4
2628
- laravel: 10.*
2729
php: 8.0
2830
- laravel: 11.*
@@ -47,4 +49,4 @@ jobs:
4749
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4850
4951
- name: Execute tests
50-
run: vendor/bin/phpunit
52+
run: vendor/bin/phpunit --no-coverage

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.idea
22
/.history
3+
/.phpunit.cache
34
/.vscode
45
/build
56
/tests/databases

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"require-dev": {
2929
"phpunit/phpunit": "^9.5|^10.0|^11.0",
3030
"orchestra/testbench": "^7.4|^8.0|^9.0",
31-
"vimeo/psalm": "^4.23|^5.1"
31+
"vimeo/psalm": "^4.23|^5.1|^6.0"
3232
},
3333
"autoload": {
3434
"psr-4": {

phpunit.xml

+24-25
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnError="false"
11-
stopOnFailure="false"
12-
verbose="true"
3+
bootstrap="vendor/autoload.php"
4+
colors="true"
5+
processIsolation="false"
6+
stopOnError="false"
7+
stopOnFailure="false"
8+
cacheDirectory=".phpunit.cache"
9+
backupStaticProperties="false"
1310
>
14-
<coverage>
15-
<include>
16-
<directory suffix=".php">./src</directory>
17-
</include>
18-
<report>
19-
<html outputDirectory="build/coverage"/>
20-
<text outputFile="build/coverage.txt"/>
21-
<clover outputFile="build/logs/clover.xml"/>
22-
</report>
23-
</coverage>
24-
<testsuites>
25-
<testsuite name="Package Test Suite">
26-
<directory>tests</directory>
27-
</testsuite>
28-
</testsuites>
11+
<coverage>
12+
<report>
13+
<html outputDirectory="build/coverage"/>
14+
<text outputFile="build/coverage.txt"/>
15+
<clover outputFile="build/logs/clover.xml"/>
16+
</report>
17+
</coverage>
18+
<testsuites>
19+
<testsuite name="Package Test Suite">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
<source>
24+
<include>
25+
<directory suffix=".php">./src</directory>
26+
</include>
27+
</source>
2928
</phpunit>

src/Money.php

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Illuminate\Contracts\Support\Arrayable;
1212
use Illuminate\Contracts\Support\Jsonable;
1313
use Illuminate\Contracts\Support\Renderable;
14-
use Illuminate\Support\Arr;
1514
use Illuminate\Support\Traits\Macroable;
1615
use InvalidArgumentException;
1716
use JsonSerializable;

src/Provider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function boot(): void
3636

3737
public function registerValidationRules(): void
3838
{
39-
Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) {
39+
Validator::extend('currency_code', function (mixed $attribute, string $value, mixed $parameters, mixed $validator) {
4040
$status = false;
4141

4242
$currencies = config('money.currencies');
@@ -48,7 +48,7 @@ public function registerValidationRules(): void
4848
return $status;
4949
});
5050

51-
Validator::replacer('currency_code', function($message, $attribute, $rule, $parameters) {
51+
Validator::replacer('currency_code', function(mixed $message, mixed $attribute, mixed $rule, mixed $parameters) {
5252
return trans('validation.custom.invalid_currency', ['attribute' => $attribute]);
5353
});
5454
}

tests/MoneyTest.php

+7-12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use InvalidArgumentException;
99
use NumberFormatter;
1010
use OutOfBoundsException;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112
use PHPUnit\Framework\TestCase;
1213
use UnexpectedValueException;
1314

@@ -312,15 +313,13 @@ public function testComparators()
312313
$this->assertFalse($m6->isPositive());
313314
}
314315

315-
/**
316-
* @dataProvider providesFormat
317-
*/
316+
#[DataProvider('providesFormat')]
318317
public function testFormat($expected, $cur, $amount, $message)
319318
{
320319
$this->assertEquals($expected, (string) Money::$cur($amount), $message);
321320
}
322321

323-
public function providesFormat()
322+
public static function providesFormat()
324323
{
325324
return [
326325
['₺1.548,48', 'TRY', 154848.25895, 'Example: ' . __LINE__],
@@ -357,31 +356,27 @@ public function testFormatWithoutZeroes()
357356
$this->assertEquals('$100.50', $m2->formatWithoutZeroes());
358357
}
359358

360-
/**
361-
* @dataProvider providesFormatForHumans
362-
*/
359+
#[DataProvider('providesFormatForHumans')]
363360
public function testFormatForHumans($expected, $cur, $amount, $locale, $message)
364361
{
365362
$this->assertEquals($expected, (string) Money::$cur($amount)->formatForHumans($locale), $message);
366363
}
367364

368-
public function providesFormatForHumans()
365+
public static function providesFormatForHumans()
369366
{
370367
return [
371368
['€1,55K', 'EUR', 154848.25895, 'nl_NL', 'Example: ' . __LINE__],
372369
['$1.55K', 'USD', 154848.25895, 'en_US', 'Example: ' . __LINE__],
373370
];
374371
}
375372

376-
/**
377-
* @dataProvider providesFormatLocale
378-
*/
373+
#[DataProvider('providesFormatLocale')]
379374
public function testFormatLocale($expected, $cur, $amount, $locale, $message)
380375
{
381376
$this->assertEquals($expected, Money::$cur($amount)->formatLocale($locale), $message);
382377
}
383378

384-
public function providesFormatLocale()
379+
public static function providesFormatLocale()
385380
{
386381
return [
387382
['₺1.548,48', 'TRY', 154848.25895, 'tr_TR', 'Example: ' . __LINE__],

tests/Rules/CurrencyRuleTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
use Akaunting\Money\Currency;
66
use Akaunting\Money\Rules\CurrencyRule;
77
use Akaunting\Money\Tests\TestCase;
8+
use PHPUnit\Framework\Attributes\DataProvider;
89

910
class CurrencyRuleTest extends TestCase
1011
{
11-
/**
12-
* @dataProvider currencies
13-
*/
12+
#[DataProvider('currencies')]
1413
public function testRulePassesForAllCurrencies($currency)
1514
{
1615
$this->assertTrue(
@@ -30,7 +29,7 @@ public function testErrorMessageUsesLang()
3029
$this->assertSame('money.invalid-currency', (new CurrencyRule)->message());
3130
}
3231

33-
public function currencies(): array
32+
public static function currencies(): array
3433
{
3534
$currencies = [];
3635

0 commit comments

Comments
 (0)