Skip to content

Commit

Permalink
Add lint & remove cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Mar 14, 2024
1 parent 63fe772 commit 75c1940
Show file tree
Hide file tree
Showing 134 changed files with 320 additions and 657 deletions.
164 changes: 0 additions & 164 deletions .php-cs-fixer.php

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
},
"require-dev": {
"dms/phpunit-arraysubset-asserts": "dev-master",
"friendsofphp/php-cs-fixer": "^3.0",
"laravel/pint": "^1.14",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
Expand Down
2 changes: 2 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
"no_useless_return": true,
"no_whitespace_before_comma_in_array": true,
"no_whitespace_in_blank_line": true,
"not_operator_with_space": false,
"not_operator_with_successor_space": false,
"non_printable_character": true,
"normalize_index_brace": true,
"object_operator_without_whitespace": true,
Expand Down
2 changes: 1 addition & 1 deletion resources/IDEHelp/IDEAutocomplete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace {
namespace {
exit('This file should not be included, only analyzed by your IDE');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Clients/Implementations/AsyncWebsocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Enjin\Platform\Clients\Implementations;

use function Amp\Websocket\Client\connect;

use Amp\Websocket\Client\WebsocketConnection;
use Amp\Websocket\Client\WebsocketHandshake;
use Enjin\Platform\Support\JSON;
use Enjin\Platform\Support\Util;

use function Amp\Websocket\Client\connect;

class AsyncWebsocket
{
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Ingest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle(Backoff $backoff, BlockProcessor $processor): int
try {
$backoff->setStrategy(new PolynomialStrategy(300))
->setMaxAttempts(10)
->setErrorHandler(function (Throwable|null $e, int $attempt) {
->setErrorHandler(function (?Throwable $e, int $attempt) {
Log::error('We got an exception in the ingest process...');
if ($e) {
Log::error("On run {$attempt} error in {$e->getFile()}:{$e->getLine()}: {$e->getMessage()}");
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Enjin\Platform\Commands;

use function Amp\async;

use Amp\Future;
use Amp\Parallel\Context\ProcessContextFactory;
use Carbon\Carbon;
Expand All @@ -27,6 +25,8 @@
use Symfony\Component\Console\Helper\ProgressBar;
use Throwable;

use function Amp\async;

class Sync extends Command
{
/**
Expand Down Expand Up @@ -79,7 +79,7 @@ public function handle(Backoff $backoff, SubstrateWebsocket $rpc): int

$backoff->setStrategy(new PolynomialStrategy(250, 2))
->setWaitCap(600000)
->setErrorHandler(function (Throwable|null $e) {
->setErrorHandler(function (?Throwable $e) {
$this->error(__('enjin-platform::error.exception_in_sync'));
$this->error($e->getMessage());
$this->error($message = __('enjin-platform::error.line_and_file', ['line' => $e->getLine(), 'file' => $e->getFile()]));
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Enjin\Platform\Commands;

use function Amp\async;

use Amp\Future;
use Amp\Parallel\Context\ProcessContextFactory;
use Carbon\Carbon;
Expand All @@ -19,6 +17,8 @@
use Symfony\Component\Console\Command\Command as CommandAlias;
use Symfony\Component\Console\Helper\ProgressBar;

use function Amp\async;

class Transactions extends Command
{
public const CONCURRENT_REQUESTS = 20;
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/contexts/get_storage.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

use function Amp\async;

use Amp\Future;
use Amp\Sync\Channel;
use Enjin\Platform\Clients\Implementations\AsyncWebsocket;
use Illuminate\Support\Arr;

use function Amp\async;

return function (Channel $channel): array {
$receivedMessage = $channel->receive();
$storageKey = $receivedMessage[0];
Expand Down
6 changes: 0 additions & 6 deletions src/Events/PlatformBroadcastEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public function broadcastAs(): string

/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn(): \Illuminate\Broadcasting\Channel|array
{
Expand All @@ -77,8 +75,6 @@ public function broadcastOn(): \Illuminate\Broadcasting\Channel|array

/**
* Get the data that should be sent with the broadcast event.
*
* @return array
*/
public function broadcastWith(): array
{
Expand Down Expand Up @@ -106,8 +102,6 @@ public static function safeBroadcast(): void

/**
* Broadcast the event with the given arguments.
*
* @return PendingBroadcast
*/
public static function broadcast(): PendingBroadcast
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function (Builder $query) {
}
)->cursorPaginateWithTotal('id', $args['first'], false);

if (true === $args['markAsProcessing'] || null === $args['markAsProcessing']) {
if ($args['markAsProcessing'] === true || $args['markAsProcessing'] === null) {
$transactions['items']->getCollection()->each(
fn ($transaction) => $transactionService->update(
clone $transaction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public function resolve(
return [
'account' => [
'publicKey' => $publicKey = $verification?->public_key,
'address' => null !== $publicKey ? SS58Address::encode($publicKey) : null,
'address' => $publicKey !== null ? SS58Address::encode($publicKey) : null,
],
'verified' => null !== $publicKey,
'verified' => $publicKey !== null,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function resolve($root, array $args, $context, ResolveInfo $resolveInfo,
$events = PendingEvent::loadSelectFields($resolveInfo, $this->name)
->cursorPaginateWithTotal('id', $args['first']);

if (true === $args['acknowledgeEvents']) {
if ($args['acknowledgeEvents'] === true) {
$eventsToClean = $events['items']->getCollection()->pluck('id')->toArray();
PendingEvent::query()
->whereIn('id', $eventsToClean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

class ApproveCollectionMutation extends Mutation implements PlatformBlockchainTransaction, PlatformGraphQlMutation
{
use InPrimarySubstrateSchema;
use HasIdempotencyField;
use HasSkippableRules;
use HasSigningAccountField;
use HasSimulateField;
use HasSkippableRules;
use HasTransactionDeposit;
use HasSigningAccountField;
use InPrimarySubstrateSchema;
use StoresTransactions;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@

class ApproveTokenMutation extends Mutation implements PlatformBlockchainTransaction, PlatformGraphQlMutation
{
use InPrimarySubstrateSchema;
use HasIdempotencyField;
use HasTokenIdFields;
use HasTokenIdFieldRules;
use HasEncodableTokenId;
use HasSkippableRules;
use HasIdempotencyField;
use HasSigningAccountField;
use HasSimulateField;
use HasSkippableRules;
use HasTokenIdFieldRules;
use HasTokenIdFields;
use HasTransactionDeposit;
use HasSigningAccountField;
use InPrimarySubstrateSchema;
use StoresTransactions;

/**
Expand Down
Loading

0 comments on commit 75c1940

Please sign in to comment.