Skip to content

Commit e5d16b3

Browse files
authored
Merge pull request #883 from bavix/autofix
autofix ecs & rector
2 parents addf969 + e8c70cc commit e5d16b3

File tree

102 files changed

+416
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+416
-440
lines changed

.github/workflows/autofix.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: fixer
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
autofix:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.2
21+
extensions: mbstring, pgsql, mysql, sqlite, redis, memcached, bcmath
22+
coverage: pcov
23+
env:
24+
runner: self-hosted
25+
26+
- name: Validate composer.json and composer.lock
27+
run: composer validate --strict
28+
29+
- name: Cache Composer packages
30+
id: composer-cache
31+
uses: actions/cache@v4
32+
with:
33+
path: vendor
34+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-php-
37+
38+
- name: Install dependencies
39+
run: composer install --prefer-dist --no-progress
40+
41+
- name: Run rector-fix
42+
run: composer rector-fix
43+
44+
- name: Run ecs-fix
45+
run: composer ecs-fix
46+
47+
- name: Run rector
48+
run: composer rector
49+
50+
- name: Run ecs
51+
run: composer ecs
52+
53+
- name: Run parabench
54+
run: composer parabench
55+
56+
- name: "Check if build has changed"
57+
if: success()
58+
id: has-changes
59+
run: |
60+
echo "stdout<<EOF" >> $GITHUB_OUTPUT
61+
echo "$(git diff --stat)" >> $GITHUB_OUTPUT
62+
echo 'EOF' >> $GITHUB_OUTPUT
63+
64+
- name: Import GPG key
65+
if: ${{ steps.has-changes.outputs.stdout }}
66+
uses: crazy-max/ghaction-import-gpg@v6
67+
with:
68+
gpg_private_key: ${{ secrets.GPG_BOT }}
69+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
70+
fingerprint: ${{ secrets.GPG_FINGERPRINT }}
71+
git_config_global: true
72+
git_user_signingkey: true
73+
git_commit_gpgsign: true
74+
git_committer_name: Github bot
75+
git_committer_email: [email protected]
76+
77+
- name: "Commit files"
78+
if: ${{ steps.has-changes.outputs.stdout }}
79+
env:
80+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
81+
run: |
82+
gh pr checkout ${{ github.event.pull_request.number }}
83+
git commit -S -m "autofix" -a
84+
85+
- name: "Push changes"
86+
if: ${{ steps.has-changes.outputs.stdout }}
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
89+
run: git push -u origin HEAD

.github/workflows/code-style.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/rector.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

database/2018_11_06_222923_create_transactions_table.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
use Illuminate\Database\Schema\Blueprint;
88
use Illuminate\Support\Facades\Schema;
99

10-
return new class() extends Migration {
10+
return new class() extends Migration
11+
{
1112
public function up(): void
1213
{
1314
Schema::create($this->table(), static function (Blueprint $table) {
@@ -18,11 +19,9 @@ public function up(): void
1819
$table->decimal('amount', 64, 0);
1920
$table->boolean('confirmed');
2021
$table->json('meta')
21-
->nullable()
22-
;
22+
->nullable();
2323
$table->uuid('uuid')
24-
->unique()
25-
;
24+
->unique();
2625
$table->timestamps();
2726

2827
$table->index(['payable_type', 'payable_id'], 'payable_type_payable_id_ind');

database/2018_11_07_192923_create_transfers_table.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
use Illuminate\Database\Schema\Blueprint;
99
use Illuminate\Support\Facades\Schema;
1010

11-
return new class() extends Migration {
11+
return new class() extends Migration
12+
{
1213
public function up(): void
1314
{
1415
Schema::create($this->table(), function (Blueprint $table) {
@@ -17,41 +18,34 @@ public function up(): void
1718
$table->morphs('to');
1819
$table
1920
->enum('status', ['exchange', 'transfer', 'paid', 'refund', 'gift'])
20-
->default('transfer')
21-
;
21+
->default('transfer');
2222

2323
$table
2424
->enum('status_last', ['exchange', 'transfer', 'paid', 'refund', 'gift'])
25-
->nullable()
26-
;
25+
->nullable();
2726

2827
$table->unsignedBigInteger('deposit_id');
2928
$table->unsignedBigInteger('withdraw_id');
3029

3130
$table->decimal('discount', 64, 0)
32-
->default(0)
33-
;
31+
->default(0);
3432

3533
$table->decimal('fee', 64, 0)
36-
->default(0)
37-
;
34+
->default(0);
3835

3936
$table->uuid('uuid')
40-
->unique()
41-
;
37+
->unique();
4238
$table->timestamps();
4339

4440
$table->foreign('deposit_id')
4541
->references('id')
4642
->on($this->transactionTable())
47-
->onDelete('cascade')
48-
;
43+
->onDelete('cascade');
4944

5045
$table->foreign('withdraw_id')
5146
->references('id')
5247
->on($this->transactionTable())
53-
->onDelete('cascade')
54-
;
48+
->onDelete('cascade');
5549
});
5650
}
5751

database/2018_11_15_124230_create_wallets_table.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,26 @@
88
use Illuminate\Database\Schema\Blueprint;
99
use Illuminate\Support\Facades\Schema;
1010

11-
return new class() extends Migration {
11+
return new class() extends Migration
12+
{
1213
public function up(): void
1314
{
1415
Schema::create($this->table(), static function (Blueprint $table) {
1516
$table->bigIncrements('id');
1617
$table->morphs('holder');
1718
$table->string('name');
1819
$table->string('slug')
19-
->index()
20-
;
20+
->index();
2121
$table->uuid('uuid')
22-
->unique()
23-
;
22+
->unique();
2423
$table->string('description')
25-
->nullable()
26-
;
24+
->nullable();
2725
$table->json('meta')
28-
->nullable()
29-
;
26+
->nullable();
3027
$table->decimal('balance', 64, 0)
31-
->default(0)
32-
;
28+
->default(0);
3329
$table->unsignedSmallInteger('decimal_places')
34-
->default(2)
35-
;
30+
->default(2);
3631
$table->timestamps();
3732

3833
$table->unique(['holder_type', 'holder_id', 'slug']);
@@ -42,8 +37,7 @@ public function up(): void
4237
$table->foreign('wallet_id')
4338
->references('id')
4439
->on($this->table())
45-
->onDelete('cascade')
46-
;
40+
->onDelete('cascade');
4741
});
4842
}
4943

database/2021_11_02_202021_update_wallets_uuid_table.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
use Illuminate\Support\Collection;
1010
use Illuminate\Support\Facades\Schema;
1111

12-
return new class() extends Migration {
12+
return new class() extends Migration
13+
{
1314
public function up(): void
1415
{
1516
if (Schema::hasColumn($this->table(), 'uuid')) {
@@ -21,8 +22,7 @@ public function up(): void
2122
$table->uuid('uuid')
2223
->after('slug')
2324
->nullable()
24-
->unique()
25-
;
25+
->unique();
2626
});
2727

2828
Wallet::query()->chunk(10000, static function (Collection $wallets) {
@@ -34,8 +34,7 @@ public function up(): void
3434

3535
Schema::table($this->table(), static function (Blueprint $table) {
3636
$table->uuid('uuid')
37-
->change()
38-
;
37+
->change();
3938
});
4039
}
4140

database/2023_12_30_113122_extra_columns_removed.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
use Illuminate\Database\Schema\Blueprint;
88
use Illuminate\Support\Facades\Schema;
99

10-
return new class() extends Migration {
10+
return new class() extends Migration
11+
{
1112
public function up(): void
1213
{
1314
Schema::table($this->table(), function (Blueprint $table) {
@@ -25,11 +26,9 @@ public function down(): void
2526
{
2627
Schema::table($this->table(), static function (Blueprint $table) {
2728
$table->string('from_type')
28-
->after('from_id')
29-
;
29+
->after('from_id');
3030
$table->string('to_type')
31-
->after('to_id')
32-
;
31+
->after('to_id');
3332
});
3433
}
3534

database/2023_12_30_204610_soft_delete.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
use Illuminate\Database\Schema\Blueprint;
1010
use Illuminate\Support\Facades\Schema;
1111

12-
return new class() extends Migration {
12+
return new class() extends Migration
13+
{
1314
public function up(): void
1415
{
1516
Schema::table((new Wallet())->getTable(), static function (Blueprint $table) {

database/2024_01_24_185401_add_extra_column_in_transfer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
use Illuminate\Database\Schema\Blueprint;
88
use Illuminate\Support\Facades\Schema;
99

10-
return new class() extends Migration {
10+
return new class() extends Migration
11+
{
1112
public function up(): void
1213
{
1314
Schema::table($this->table(), static function (Blueprint $table) {
1415
$table->json('extra')
1516
->nullable()
16-
->after('fee')
17-
;
17+
->after('fee');
1818
});
1919
}
2020

0 commit comments

Comments
 (0)