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

[11.x] New Version #826

Merged
merged 32 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1a29e92
working on a new version
rez1dent3 Dec 30, 2023
18eb7dc
phpstan fix
rez1dent3 Dec 30, 2023
83e3de5
ecs fix
rez1dent3 Dec 30, 2023
e7d64c9
add native soft delete
rez1dent3 Dec 30, 2023
bf9148b
Merge pull request #827 from bavix/11.x-soft-delete
rez1dent3 Dec 30, 2023
93437ad
fix default wallet
rez1dent3 Dec 30, 2023
e22269e
Merge pull request #828 from bavix/11.x-soft-delete
rez1dent3 Dec 30, 2023
6f06d2f
update baseline
rez1dent3 Dec 30, 2023
ce948f2
add namespace
rez1dent3 Dec 30, 2023
b2d1fc5
minimum php version changed
rez1dent3 Dec 30, 2023
486b26e
revert namespace
rez1dent3 Dec 31, 2023
3b2d146
add units
rez1dent3 Dec 31, 2023
15e7ee1
update composer.json
rez1dent3 Dec 31, 2023
873bbc2
add FormatterServiceInterface
rez1dent3 Dec 31, 2023
437c21a
Merge pull request #834 from bavix/11.x-831-the-buy-function-only-acc…
rez1dent3 Jan 5, 2024
9d2fdc2
add FormatterServiceInterface
rez1dent3 Jan 5, 2024
7c7d693
Merge pull request #835 from bavix/11.x-831-the-buy-function-only-acc…
rez1dent3 Jan 5, 2024
d8c2ad8
rector fix
rez1dent3 Jan 5, 2024
5e2e9ff
Merge pull request #836 from bavix/11.x-831-the-buy-function-only-acc…
rez1dent3 Jan 5, 2024
5f41417
Merge branch 'master' into 11.x
rez1dent3 Jan 5, 2024
1d4a652
fix Qodana
rez1dent3 Jan 5, 2024
8b760f0
Merge pull request #837 from bavix/11.x-831-the-buy-function-only-acc…
rez1dent3 Jan 5, 2024
f956ed0
technical debt
rez1dent3 Jan 5, 2024
48f82c9
add gmp-ext
rez1dent3 Jan 5, 2024
5f31479
Revert "add gmp-ext"
rez1dent3 Jan 5, 2024
9579ffd
dto fix
rez1dent3 Jan 5, 2024
a04c760
Merge pull request #838 from bavix/11.x-dto-refactoring
rez1dent3 Jan 5, 2024
826eca9
drop depends
rez1dent3 Jan 5, 2024
d2fe9bd
remove cknow/laravel-money
rez1dent3 Jan 5, 2024
04486ef
Merge pull request #839 from bavix/11.x-remove-depends-cknow
rez1dent3 Jan 5, 2024
af18d66
Merge branch 'master' into 11.x
rez1dent3 Jan 6, 2024
ec4b994
merge origin/master
rez1dent3 Jan 20, 2024
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
24 changes: 24 additions & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: bcmath
env:
runner: self-hosted

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2023.3
env:
Expand Down
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.1
php-version: 8.2
extensions: bcmath
env:
runner: self-hosted
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deptrac.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.1
php-version: 8.2
extensions: bcmath
env:
runner: self-hosted
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.1
php-version: 8.2
extensions: bcmath
env:
runner: self-hosted
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
php-versions: [8.1, 8.2, 8.3]
php-versions: [8.2, 8.3]
databases: [testing, pgsql, mysql, mariadb]
caches: [array, redis, memcached, database]
locks: [redis, memcached]
Expand Down
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.1
php-version: 8.2
extensions: bcmath
env:
runner: self-hosted
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"ext-pdo": "*",
"brick/math": "~0.10",
Expand All @@ -32,17 +32,17 @@
"ramsey/uuid": "^4.0"
},
"require-dev": {
"brianium/paratest": "^7.2",
"cknow/laravel-money": "^7.1",
"ergebnis/phpstan-rules": "^1.0",
"brianium/paratest": "^7.3",
"cknow/laravel-money": "^7.2",
"ergebnis/phpstan-rules": "^2.1",
"infection/infection": "~0.27",
"laravel/cashier": "^15.0",
"nunomaduro/collision": "^7.7",
"nunomaduro/larastan": "^2.6",
"orchestra/testbench": "^8.5",
"nunomaduro/collision": "^7.10",
"nunomaduro/larastan": "^2.7",
"orchestra/testbench": "^8.19",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.2",
"rector/rector": "^0.17",
"phpunit/phpunit": "^10.5",
"rector/rector": "^0.18",
"symplify/easy-coding-standard": "^12.0"
},
"suggest": {
Expand Down
2 changes: 2 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use Bavix\Wallet\Services\DiscountService;
use Bavix\Wallet\Services\EagerLoaderService;
use Bavix\Wallet\Services\ExchangeService;
use Bavix\Wallet\Services\FormatterService;

Check notice on line 47 in config/config.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Usage of internal entity

Class 'FormatterService' is marked as @internal
use Bavix\Wallet\Services\PrepareService;
use Bavix\Wallet\Services\PurchaseService;
use Bavix\Wallet\Services\RegulatorService;
Expand Down Expand Up @@ -110,6 +111,7 @@
'discount' => DiscountService::class,
'eager_loader' => EagerLoaderService::class,
'exchange' => ExchangeService::class,
'formatter' => FormatterService::class,

Check notice on line 114 in config/config.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Usage of internal entity

Class 'FormatterService' is marked as @internal
'prepare' => PrepareService::class,
'purchase' => PurchaseService::class,
'tax' => TaxService::class,
Expand Down
32 changes: 32 additions & 0 deletions database/2023_12_30_113122_extra_columns_removed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

use Bavix\Wallet\Models\Transfer;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::dropColumns($this->table(), ['from_type', 'to_type']);
}

public function down(): void
{
Schema::table($this->table(), static function (Blueprint $table) {
$table->string('from_type')
->after('from_id')
;
$table->string('to_type')
->after('to_id')
;
});
}

private function table(): string
{
return (new Transfer())->getTable();
}
};
38 changes: 38 additions & 0 deletions database/2023_12_30_204610_soft_delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

use Bavix\Wallet\Models\Transaction;
use Bavix\Wallet\Models\Transfer;
use Bavix\Wallet\Models\Wallet;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::table((new Wallet())->getTable(), static function (Blueprint $table) {
$table->softDeletesTz();
});
Schema::table((new Transfer())->getTable(), static function (Blueprint $table) {
$table->softDeletesTz();
});
Schema::table((new Transaction())->getTable(), static function (Blueprint $table) {
$table->softDeletesTz();
});
}

public function down(): void
{
Schema::table((new Wallet())->getTable(), static function (Blueprint $table) {
$table->dropSoftDeletes();
});
Schema::table((new Transfer())->getTable(), static function (Blueprint $table) {
$table->dropSoftDeletes();
});
Schema::table((new Transaction())->getTable(), static function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
};
54 changes: 1 addition & 53 deletions phpstan.common.neon
Original file line number Diff line number Diff line change
@@ -1,60 +1,8 @@
includes:
- vendor/nunomaduro/larastan/extension.neon
- vendor/ergebnis/phpstan-rules/rules.neon

parameters:
level: 9
fileExtensions:
- php

parametersSchema:
ergebnis: structure([
allowAbstractClasses: bool()
classesAllowedToBeExtended: listOf(string())
classesNotRequiredToBeAbstractOrFinal: listOf(string())
interfacesImplementedByContainers: listOf(string())
])

rules:
- Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Expressions\NoCompactRule
- Ergebnis\PHPStan\Rules\Expressions\NoEmptyRule
- Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule
- Ergebnis\PHPStan\Rules\Expressions\NoEvalRule
- Ergebnis\PHPStan\Rules\Expressions\NoIssetRule
- Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule
- Ergebnis\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule
- Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule
- Ergebnis\PHPStan\Rules\Methods\NoConstructorParameterWithDefaultValueRule
- Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule
- Ergebnis\PHPStan\Rules\Statements\NoSwitchRule

services:
-
class: Ergebnis\PHPStan\Rules\Classes\FinalRule
arguments:
allowAbstractClasses: %ergebnis.allowAbstractClasses%
classesNotRequiredToBeAbstractOrFinal: %ergebnis.classesNotRequiredToBeAbstractOrFinal%
tags:
- phpstan.rules.rule

-
class: Ergebnis\PHPStan\Rules\Classes\NoExtendsRule
arguments:
classesAllowedToBeExtended: %ergebnis.classesAllowedToBeExtended%
tags:
- phpstan.rules.rule

-
class: Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule
tags:
- phpstan.rules.rule

-
class: Ergebnis\PHPStan\Rules\Methods\NoParameterWithContainerTypeDeclarationRule
arguments:
interfacesImplementedByContainers: %ergebnis.interfacesImplementedByContainers%
tags:
- phpstan.rules.rule
14 changes: 7 additions & 7 deletions phpstan.src.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ parameters:
path: src/Internal/Assembler/TransactionDtoAssembler.php

-
message: "#^Parameter \\#6 \\$fromId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransferDto constructor expects int\\|string, mixed given\\.$#"
message: "#^Parameter \\#5 \\$fromId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransferDto constructor expects int\\|string, mixed given\\.$#"
count: 1
path: src/Internal/Assembler/TransferDtoAssembler.php

-
message: "#^Parameter \\#8 \\$toId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransferDto constructor expects int\\|string, mixed given\\.$#"
message: "#^Parameter \\#6 \\$toId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransferDto constructor expects int\\|string, mixed given\\.$#"
count: 1
path: src/Internal/Assembler/TransferDtoAssembler.php

Expand Down Expand Up @@ -61,18 +61,18 @@ parameters:
path: src/Models/Transfer.php

-
message: "#^Cannot cast mixed to string\\.$#"
count: 1
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphOne\\:\\:withTrashed\\(\\)\\.$#"
count: 2
path: src/Models/Wallet.php

-
message: "#^Method Bavix\\\\Wallet\\\\Models\\\\Wallet\\:\\:getAvailableBalanceAttribute\\(\\) should return float\\|int\\|string but returns mixed\\.$#"
message: "#^Cannot cast mixed to string\\.$#"
count: 1
path: src/Models/Wallet.php

-
message: "#^Method Bavix\\\\Wallet\\\\Models\\\\Wallet\\:\\:wallet\\(\\) should return Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphOne\\<Bavix\\\\Wallet\\\\Models\\\\Wallet\\> but returns Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphOne\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\.$#"
count: 2
message: "#^Method Bavix\\\\Wallet\\\\Models\\\\Wallet\\:\\:getAvailableBalanceAttribute\\(\\) should return float\\|int\\|string but returns mixed\\.$#"
count: 1
path: src/Models/Wallet.php

-
Expand Down
44 changes: 26 additions & 18 deletions phpstan.src.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ parameters:
fileExtensions:
- php
ergebnis:
allowAbstractClasses: true
classesAllowedToBeExtended:
# laravel
- Illuminate\Support\ServiceProvider
- Illuminate\Database\Eloquent\Model
noParameterWithNullableTypeDeclaration:
enabled: false
noNullableReturnTypeDeclaration:
enabled: false
noParameterWithNullDefaultValue:
enabled: false
final:
allowAbstractClasses: true
classesNotRequiredToBeAbstractOrFinal:
- Bavix\Wallet\Models\Wallet
- Bavix\Wallet\Models\Transfer
- Bavix\Wallet\Models\Transaction
noExtends:
classesAllowedToBeExtended:
# laravel
- Illuminate\Support\ServiceProvider
- Illuminate\Database\Eloquent\Model

# php exceptions
- LogicException
- RuntimeException
- UnderflowException
- UnexpectedValueException
- InvalidArgumentException

classesNotRequiredToBeAbstractOrFinal:
- Bavix\Wallet\Models\Wallet
- Bavix\Wallet\Models\Transfer
- Bavix\Wallet\Models\Transaction
interfacesImplementedByContainers:
- Psr\Container\ContainerInterface
# php exceptions
- LogicException
- RuntimeException
- UnderflowException
- UnexpectedValueException
- InvalidArgumentException
noParameterWithContainerTypeDeclaration:
interfacesImplementedByContainers:
- Psr\Container\ContainerInterface
paths:
- src/
2 changes: 1 addition & 1 deletion phpstan.tests.baseline.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Method Bavix\\\\Wallet\\\\Test\\\\Infra\\\\Models\\\\Item\\:\\:boughtGoods\\(\\) should return Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphMany\\<Bavix\\\\Wallet\\\\Models\\\\Transfer\\> but returns Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphMany\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\.$#"
message: "#^Method Bavix\\\\Wallet\\\\Test\\\\Infra\\\\Models\\\\Item\\:\\:boughtGoods\\(\\) should return Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\<Bavix\\\\Wallet\\\\Models\\\\Transfer\\> but returns Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\.$#"
count: 1
path: tests/Infra/Models/Item.php

Expand Down
Loading
Loading