Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add php 8.4 support #110

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
php: ['8.0', '8.1', '8.2', '8.3']
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
laravel: [9.*, 10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
Expand All @@ -23,8 +23,12 @@ jobs:
exclude:
- laravel: 9.*
php: 8.3
- laravel: 9.*
php: 8.4
- laravel: 10.*
php: 8.0
- laravel: 10.*
php: 8.4
- laravel: 11.*
php: 8.0
- laravel: 11.*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5|^10.0|^11.0",
"orchestra/testbench": "^7.4|^8.0|^9.0",
"vimeo/psalm": "^4.23|^5.1"
"vimeo/psalm": "^4.23|^5.1|^6"
},
"autoload": {
"psr-4": {
Expand Down
20 changes: 10 additions & 10 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
stopOnFailure="false"
verbose="true"
>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<!-- <coverage>-->
<!-- <include>-->
<!-- <directory suffix=".php">src</directory>-->
<!-- </include>-->
<!-- <report>-->
<!-- <html outputDirectory="build/coverage"/>-->
<!-- <text outputFile="build/coverage.txt"/>-->
<!-- <clover outputFile="build/logs/clover.xml"/>-->
<!-- </report>-->
<!-- </coverage>-->
Comment on lines +14 to +23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What's the thought behind this coverage comment? Is this necessary for adding PHP 8.4 support? Why would this work on the other PHP versions 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the project is not using coverage in the workflows and throws some weird errors so I decided to disable these.
If we want to fix this, it will require extra work and maybe changing the minimum requirements for the project dependencies.

<testsuites>
<testsuite name="Package Test Suite">
<directory>tests</directory>
Expand Down
1 change: 0 additions & 1 deletion src/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Support\Arr;
use Illuminate\Support\Traits\Macroable;
use InvalidArgumentException;
use JsonSerializable;
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Akaunting\Money\Money;

if (! function_exists('money')) {
function money(mixed $amount, string $currency = null, bool $convert = null): Money
function money(mixed $amount, ?string $currency = null, ?bool $convert = null): Money
{
if (is_null($currency)) {
/** @var string $currency */
Expand All @@ -21,7 +21,7 @@ function money(mixed $amount, string $currency = null, bool $convert = null): Mo
}

if (! function_exists('currency')) {
function currency(string $currency = null): Currency
function currency(?string $currency = null): Currency
{
if (is_null($currency)) {
/** @var string $currency */
Expand Down
6 changes: 3 additions & 3 deletions tests/MoneyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function testFormat($expected, $cur, $amount, $message)
$this->assertEquals($expected, (string) Money::$cur($amount), $message);
}

public function providesFormat()
public static function providesFormat()
{
return [
['₺1.548,48', 'TRY', 154848.25895, 'Example: ' . __LINE__],
Expand Down Expand Up @@ -365,7 +365,7 @@ public function testFormatForHumans($expected, $cur, $amount, $locale, $message)
$this->assertEquals($expected, (string) Money::$cur($amount)->formatForHumans($locale), $message);
}

public function providesFormatForHumans()
public static function providesFormatForHumans()
{
return [
['€1,55K', 'EUR', 154848.25895, 'nl_NL', 'Example: ' . __LINE__],
Expand All @@ -381,7 +381,7 @@ public function testFormatLocale($expected, $cur, $amount, $locale, $message)
$this->assertEquals($expected, Money::$cur($amount)->formatLocale($locale), $message);
}

public function providesFormatLocale()
public static function providesFormatLocale()
{
return [
['₺1.548,48', 'TRY', 154848.25895, 'tr_TR', 'Example: ' . __LINE__],
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/CurrencyRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testErrorMessageUsesLang()
$this->assertSame('money.invalid-currency', (new CurrencyRule)->message());
}

public function currencies(): array
public static function currencies(): array
{
$currencies = [];

Expand Down
Loading