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

Update symplify/easy-coding-standard requirement from ^10.2 to ^11.0 #514

Merged
Merged
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"phpstan/phpstan": "^1.7",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.13",
"symplify/easy-coding-standard": "^10.2",
"symplify/easy-coding-standard": "^11.0",
"vimeo/psalm": "^4.23"
},
"suggest": {
Expand Down
1 change: 0 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
$containerConfigurator->import(SetList::SYMPLIFY);
$containerConfigurator->import(SetList::COMMON);
$containerConfigurator->import(SetList::PSR_12);
$containerConfigurator->import(SetList::PHP_CS_FIXER);
$containerConfigurator->import(SetList::CONTROL_STRUCTURES);
$containerConfigurator->import(SetList::NAMESPACES);
$containerConfigurator->import(SetList::STRICT);
Expand Down
1 change: 1 addition & 0 deletions src/Commands/TransferFixCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
final class TransferFixCommand extends Command
{
protected $signature = 'bx:transfer:fix';

protected $description = 'Brings transfers to the correct form/to.';

public function handle(Wallet $wallet, Transfer $transfer, CastServiceInterface $castService): void
Expand Down
1 change: 1 addition & 0 deletions src/External/Dto/Extra.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
final class Extra implements ExtraDtoInterface
{
private OptionDtoInterface $deposit;

private OptionDtoInterface $withdraw;

public function __construct(OptionDtoInterface|array|null $deposit, OptionDtoInterface|array|null $withdraw)
Expand Down
1 change: 1 addition & 0 deletions src/Internal/Dto/TransactionDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
final class TransactionDto implements TransactionDtoInterface
{
private DateTimeImmutable $createdAt;

private DateTimeImmutable $updatedAt;

public function __construct(
Expand Down
1 change: 1 addition & 0 deletions src/Internal/Dto/TransferDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
final class TransferDto implements TransferDtoInterface
{
private DateTimeImmutable $createdAt;

private DateTimeImmutable $updatedAt;

public function __construct(
Expand Down
12 changes: 12 additions & 0 deletions src/Internal/Exceptions/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,28 @@
interface ExceptionInterface extends Throwable
{
public const AMOUNT_INVALID = 1 << 0;

public const BALANCE_IS_EMPTY = 1 << 1;

public const CONFIRMED_INVALID = 1 << 2;

public const UNCONFIRMED_INVALID = 1 << 3;

public const INSUFFICIENT_FUNDS = 1 << 4;

public const PRODUCT_ENDED = 1 << 5;

public const WALLET_OWNER_INVALID = 1 << 6;

public const CART_EMPTY = 1 << 7;

public const LOCK_PROVIDER_NOT_FOUND = 1 << 8;

public const RECORD_NOT_FOUND = 1 << 9;

public const TRANSACTION_FAILED = 1 << 10;

public const MODEL_NOT_FOUND = 1 << 11;

public const TRANSACTION_START = 1 << 12;
}
2 changes: 1 addition & 1 deletion src/Internal/Service/DatabaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function transaction(callable $callback): mixed
$this->init = false;

throw new TransactionFailedException(
'Transaction failed. Message: '.$throwable->getMessage(),
'Transaction failed. Message: ' . $throwable->getMessage(),
ExceptionInterface::TRANSACTION_FAILED,
$throwable
);
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/Service/StorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function sync(string $key, float|int|string $value): bool
public function increase(string $key, float|int|string $value): string
{
return $this->lockService->block(
$key.'::increase',
$key . '::increase',
function () use ($key, $value): string {
$result = $this->mathService->add($this->get($key), $value);
$this->sync($key, $result);
Expand Down
1 change: 1 addition & 0 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
class Transaction extends Model
{
public const TYPE_DEPOSIT = 'deposit';

public const TYPE_WITHDRAW = 'withdraw';

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Models/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@
class Transfer extends Model
{
public const STATUS_EXCHANGE = 'exchange';

public const STATUS_TRANSFER = 'transfer';

public const STATUS_PAID = 'paid';

public const STATUS_REFUND = 'refund';

public const STATUS_GIFT = 'gift';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Objects/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ public function getBasketDto(): BasketDtoInterface

private function productId(ProductInterface $product): string
{
return $product::class.':'.$this->castService->getModel($product)->getKey();
return $product::class . ':' . $this->castService->getModel($product)->getKey();
}
}
2 changes: 1 addition & 1 deletion src/Services/AtomicService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ private function key(Wallet $object): string
{
$wallet = $this->castService->getWallet($object);

return self::PREFIX.'::'.$wallet::class.'::'.$wallet->uuid;
return self::PREFIX . '::' . $wallet::class . '::' . $wallet->uuid;
}
}
2 changes: 1 addition & 1 deletion src/Services/BookkeeperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ public function increase(Wallet $wallet, float|int|string $value): string

private function getKey(Wallet $wallet): string
{
return __CLASS__.'::'.$wallet->uuid;
return __CLASS__ . '::' . $wallet->uuid;
}
}
2 changes: 1 addition & 1 deletion src/Services/RegulatorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ private function persist(Wallet $wallet): void

private function getKey(string $uuid): string
{
return $this->idempotentKey.'::'.$uuid;
return $this->idempotentKey . '::' . $uuid;
}
}
2 changes: 1 addition & 1 deletion src/Traits/CartPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function payCart(CartInterface $cart, bool $force = false): array
$assistantService = app(AssistantServiceInterface::class);
foreach ($cart->getBasketDto()->items() as $item) {
foreach ($item->getItems() as $product) {
$productId = $product::class.':'.$castService->getModel($product)->getKey();
$productId = $product::class . ':' . $castService->getModel($product)->getKey();
$pricePerItem = $item->getPricePerItem();
if ($pricePerItem === null) {
$prices[$productId] ??= $product->getAmountProduct($this);
Expand Down
10 changes: 5 additions & 5 deletions src/WalletServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,24 @@ final class WalletServiceProvider extends ServiceProvider
*/
public function boot(): void
{
$this->loadTranslationsFrom(dirname(__DIR__).'/resources/lang', 'wallet');
$this->loadTranslationsFrom(dirname(__DIR__) . '/resources/lang', 'wallet');

if (!$this->app->runningInConsole()) {
return;
}

if ($this->shouldMigrate()) {
$this->loadMigrationsFrom([dirname(__DIR__).'/database']);
$this->loadMigrationsFrom([dirname(__DIR__) . '/database']);
}

if (function_exists('config_path')) {
$this->publishes([
dirname(__DIR__).'/config/config.php' => config_path('wallet.php'),
dirname(__DIR__) . '/config/config.php' => config_path('wallet.php'),
], 'laravel-wallet-config');
}

$this->publishes([
dirname(__DIR__).'/database/' => database_path('migrations'),
dirname(__DIR__) . '/database/' => database_path('migrations'),
], 'laravel-wallet-migrations');
}

Expand All @@ -135,7 +135,7 @@ public function boot(): void
*/
public function register(): void
{
$this->mergeConfigFrom(dirname(__DIR__).'/config/config.php', 'wallet');
$this->mergeConfigFrom(dirname(__DIR__) . '/config/config.php', 'wallet');
$this->commands([TransferFixCommand::class]);

$configure = config('wallet', []);
Expand Down
2 changes: 1 addition & 1 deletion tests/Infra/Listeners/WalletCreatedThrowListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function handle(WalletCreatedEventInterface $walletCreatedEvent): void
->format(DateTimeInterface::ATOM)
;

$message = hash('sha256', $holderType.$uuid.$createdAt);
$message = hash('sha256', $holderType . $uuid . $createdAt);
$code = $walletCreatedEvent->getWalletId() + $walletCreatedEvent->getHolderId();
assert($code > 1);

Expand Down
6 changes: 0 additions & 6 deletions tests/Infra/Models/ItemMaxTax.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

class ItemMaxTax extends Item implements MaximalTaxable
{
/**
* {@inheritdoc}
*/
public function getTable(): string
{
return 'items';
}

/**
* {@inheritdoc}
*/
public function getFeePercent(): float
{
return 3;
Expand Down
6 changes: 0 additions & 6 deletions tests/Infra/Models/ItemMinTax.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

class ItemMinTax extends Item implements MinimalTaxable
{
/**
* {@inheritdoc}
*/
public function getTable(): string
{
return 'items';
}

/**
* {@inheritdoc}
*/
public function getFeePercent(): float
{
return 3;
Expand Down
3 changes: 0 additions & 3 deletions tests/Infra/PackageModels/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/
class Transaction extends \Bavix\Wallet\Models\Transaction
{
/**
* {@inheritdoc}
*/
public function getFillable(): array
{
return array_merge($this->fillable, ['bank_method']);
Expand Down
2 changes: 1 addition & 1 deletion tests/Infra/TestServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ final class TestServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->loadMigrationsFrom([dirname(__DIR__).'/migrations']);
$this->loadMigrationsFrom([dirname(__DIR__) . '/migrations']);
}
}
2 changes: 1 addition & 1 deletion tests/Units/Domain/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testWalletCreatedThrowListener(): void
$uuid = $buyer->wallet->uuid;
$createdAt = app(ClockServiceInterface::class)->now()->format(DateTimeInterface::ATOM);

$message = hash('sha256', $holderType.$uuid.$createdAt);
$message = hash('sha256', $holderType . $uuid . $createdAt);

// unit
$this->expectException(UnknownEventException::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Units/Domain/MultiWalletTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public function testMultiWalletTransactionState(): void
$wallets = [];
foreach (range(1, 10) as $item) {
$wallets[] = $user->createWallet([
'name' => 'index'.$item,
'name' => 'index' . $item,
]);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Units/Domain/TransactionsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ public function testPagination2(): void
$query = Transaction::query()
->where(function ($query) use ($buyer, $walletTableName, $transactionTableName) {
$query->where('payable_id', '=', $buyer->getKey())
->join($walletTableName, $transactionTableName.'.wallet_id', '=', $walletTableName.'.id')
->select($transactionTableName.'.*', $walletTableName.'.name')
->join($walletTableName, $transactionTableName . '.wallet_id', '=', $walletTableName . '.id')
->select($transactionTableName . '.*', $walletTableName . '.name')
->get()
;
})
Expand Down
6 changes: 3 additions & 3 deletions tests/Units/Domain/WalletFloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ public function testBitcoin(): void
}
});

self::assertSame($user->balance, '256'.str_repeat('0', 32 - 8));
self::assertSame($user->balance, '256' . str_repeat('0', 32 - 8));
self::assertSame(0, $math->compare($user->balanceFloat, '0.00000256'));

$user->deposit(256 .str_repeat('0', 32));
$user->depositFloat('0.'.str_repeat('0', 31).'1');
$user->deposit(256 . str_repeat('0', 32));
$user->depositFloat('0.' . str_repeat('0', 31) . '1');

[$q, $r] = explode('.', $user->balanceFloat, 2);
self::assertSame(strlen($r), $user->wallet->decimal_places);
Expand Down