Skip to content

Commit b040720

Browse files
committed
fix errors with help phpstan
1 parent aa4db6d commit b040720

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

analyze/phpstan/stubs/helpers.stub

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Illuminate\Contracts\Foundation\Application;
6+
7+
/**
8+
* Get the available container instance.
9+
*
10+
* @template T
11+
* @param class-string<T> $abstract
12+
*
13+
* @return T
14+
*/
15+
function app(string $abstract) {
16+
17+
}

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5+
stubFiles:
6+
- analyze/phpstan/stubs/helpers.stub
57
level: 8
68
fileExtensions:
79
- php

rector.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@
44

55
use Rector\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector;
66
use Rector\Config\RectorConfig;
7-
use Rector\Core\Configuration\Option;
87
use Rector\Laravel\Set\LaravelSetList;
98
use Rector\Php74\Rector\Property\TypedPropertyRector;
109
use Rector\PHPUnit\Set\PHPUnitSetList;
1110
use Rector\Set\ValueObject\SetList;
1211

1312
return static function (RectorConfig $containerConfigurator): void {
14-
// get parameters
15-
$parameters = $containerConfigurator->parameters();
16-
$parameters->set(Option::PATHS, [
13+
$containerConfigurator->paths([
1714
__DIR__ . '/src',
1815
__DIR__ . '/tests',
1916
]);
2017

21-
$parameters->set(Option::SKIP, [ExplicitMethodCallOverMagicGetSetRector::class]);
18+
$containerConfigurator->skip([ExplicitMethodCallOverMagicGetSetRector::class]);
2219

2320
// Define what rule sets will be applied
2421
$containerConfigurator->import(PHPUnitSetList::PHPUNIT_91);

src/Traits/CartPay.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ public function payFreeCart(CartInterface $cart): array
7979
);
8080
}
8181

82+
assert(count($transfers) > 0);
83+
8284
return app(TransferServiceInterface::class)->apply($transfers);
8385
});
8486
}
@@ -149,6 +151,8 @@ public function payCart(CartInterface $cart, bool $force = false): array
149151
app(ConsistencyServiceInterface::class)->checkTransfer($transfers);
150152
}
151153

154+
assert(count($transfers) > 0);
155+
152156
return app(TransferServiceInterface::class)->apply($transfers);
153157
});
154158
}
@@ -224,6 +228,8 @@ public function refundCart(CartInterface $cart, bool $force = false, bool $gifts
224228
app(ConsistencyServiceInterface::class)->checkTransfer($objects);
225229
}
226230

231+
assert(count($objects) > 0);
232+
227233
$transferService = app(TransferServiceInterface::class);
228234

229235
$transferService->apply($objects);

src/Traits/HasWallet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function canWithdraw(int|string $amount, bool $allowZero = false): bool
173173
*/
174174
public function forceWithdraw(
175175
int|string $amount,
176-
ExtraDtoInterface|array|null $meta = null,
176+
array|null $meta = null,
177177
bool $confirmed = true
178178
): Transaction {
179179
return app(AtomicServiceInterface::class)->block(

0 commit comments

Comments
 (0)