Skip to content

Commit

Permalink
Merge pull request #28 from bavix/10.x
Browse files Browse the repository at this point in the history
add support laravel-wallet:^10.0
  • Loading branch information
rez1dent3 authored Jul 9, 2023
2 parents 7fe7139 + 7109f1a commit c071ba2
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
php-versions: [8.0, 8.1]
php-versions: [8.1, 8.2]

steps:
- name: Checkout
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/psalm.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
31 changes: 15 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
}
],
"require": {
"php": "^8.0",
"bavix/laravel-wallet": "^9.0",
"florianv/laravel-swap": "^2.2",
"nyholm/psr7": "^1.3",
"php-http/curl-client": "^2.1",
"php-http/message": "^1.9"
"php": "^8.1",
"bavix/laravel-wallet": "^10.0",
"florianv/laravel-swap": "^2.3",
"nyholm/psr7": "^1.8",
"php-http/curl-client": "^2.3",
"php-http/message": "^1.16"
},
"require-dev": {
"driftingly/rector-laravel": "^0.21.0",
"ergebnis/phpstan-rules": "^1.0",
"infection/infection": "^0.26",
"orchestra/testbench": "^7.0",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.14",
"symplify/easy-coding-standard": "^11.1",
"vimeo/psalm": "^4.13"
"infection/infection": "^0.27",
"orchestra/testbench": "^8.5",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.2",
"rector/rector": "^0.17",
"symplify/easy-coding-standard": "^11.5"
},
"autoload": {
"psr-4": {
Expand All @@ -64,15 +64,14 @@
"ecs": "@php vendor/bin/ecs check",
"ecs-fix": "@php vendor/bin/ecs check --fix",
"ecs-cc": "@php vendor/bin/ecs --clear-cache",
"psalm": "@php vendor/bin/psalm",
"psalm-cc": "@php vendor/bin/psalm --clear-cache",
"rector": "@php vendor/bin/rector process --dry-run",
"rector-fix": "@php vendor/bin/rector process"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"infection/extension-installer": true
"infection/extension-installer": true,
"php-http/discovery": true
}
}
}
10 changes: 6 additions & 4 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="./build/logs/clover.xml"/>
<html outputDirectory="./build/html/"/>
Expand All @@ -18,4 +15,9 @@
<php>
<env name="DB_CONNECTION" value="testing"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
12 changes: 0 additions & 12 deletions psalm.xml

This file was deleted.

13 changes: 3 additions & 10 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Laravel\Set\LaravelSetList;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use RectorLaravel\Set\LaravelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $config): void {
Expand All @@ -14,13 +13,7 @@
]);

// Define what rule sets will be applied
$config->import(LaravelSetList::LARAVEL_80);
$config->import(LaravelSetList::LARAVEL_90);
$config->import(SetList::DEAD_CODE);
$config->import(SetList::PHP_80);

// get services (needed for register a single rule)
$services = $config->services();

// register a single rule
$services->set(TypedPropertyRector::class);
$config->import(SetList::PHP_81);
};
2 changes: 1 addition & 1 deletion src/CurrencyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

final class CurrencyService implements CurrencyServiceInterface
{
public function __construct(private Swap $swapService)
public function __construct(private readonly Swap $swapService)
{
}

Expand Down
6 changes: 4 additions & 2 deletions src/SwapExchangeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

final class SwapExchangeService implements ExchangeServiceInterface
{
public function __construct(private CurrencyServiceInterface $currencyService, private MathServiceInterface $mathService)
{
public function __construct(
private readonly CurrencyServiceInterface $currencyService,
private readonly MathServiceInterface $mathService,
) {
}

/**
Expand Down
11 changes: 10 additions & 1 deletion src/WalletSwapServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
namespace Bavix\WalletSwap;

use Bavix\Wallet\Services\ExchangeServiceInterface;
use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Support\ServiceProvider;

final class WalletSwapServiceProvider extends ServiceProvider
final class WalletSwapServiceProvider extends ServiceProvider implements DeferrableProvider
{
public function register(): void
{
$this->app->singleton(CurrencyServiceInterface::class, CurrencyService::class);
$this->app->singleton(ExchangeServiceInterface::class, SwapExchangeService::class);
}

/**
* @return class-string[]
*/
public function provides(): array
{
return [CurrencyServiceInterface::class];
}
}
2 changes: 1 addition & 1 deletion tests/CurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testExceptions(string $expect, Throwable $throwable): void
$currencyService->rate('USD', 'RUB');
}

public function exceptionDataProvider(): iterable
public static function exceptionDataProvider(): iterable
{
$currencyPair = new CurrencyPair('USD', 'EUR');
$service = new PhpArray([]);
Expand Down
8 changes: 0 additions & 8 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ protected function getEnvironmentSetUp($app): void
{
// swap
$app['config']->set('swap.services', [
'european_central_bank' => true,
'national_bank_of_romania' => true,
'central_bank_of_republic_turkey' => true,
'central_bank_of_czech_republic' => true,
'russian_central_bank' => true,
'bulgarian_national_bank' => true,

// fallback
'array' => [
[
'EUR/USD' => round(114.19 / 100, 3),
Expand Down

0 comments on commit c071ba2

Please sign in to comment.