Skip to content

Commit da88ba5

Browse files
committed
config update
1 parent f2ca3bb commit da88ba5

18 files changed

+96
-40
lines changed

analyze/phpstan/stubs/Container.stub

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ interface Container extends ContainerInterface
2929
/**
3030
* Assign a set of tags to a given binding.
3131
*
32-
* @param array|string $abstracts
33-
* @param array|mixed ...$tags
32+
* @param array<string>|string $abstracts
33+
* @param array<mixed>|mixed ...$tags
3434
* @return void
3535
*/
3636
public function tag($abstracts, $tags);
@@ -39,7 +39,7 @@ interface Container extends ContainerInterface
3939
* Resolve all of the bindings for a given tag.
4040
*
4141
* @param string $tag
42-
* @return iterable
42+
* @return iterable<mixed>
4343
*/
4444
public function tagged($tag);
4545

@@ -132,8 +132,9 @@ interface Container extends ContainerInterface
132132
/**
133133
* Define a contextual binding.
134134
*
135-
* @param string|array $concrete
136-
* @return \Illuminate\Contracts\Container\ContextualBindingBuilder
135+
* @param string|array<string> $concrete
136+
*
137+
* @return mixed
137138
*/
138139
public function when($concrete);
139140

@@ -156,19 +157,17 @@ interface Container extends ContainerInterface
156157
* Resolve the given type from the container.
157158
*
158159
* @template T
159-
* @param class-string<T> $abstract
160-
* @param array $parameters
160+
* @param class-string<T> $abstract
161+
* @param array<mixed> $parameters
161162
* @return T
162-
*
163-
* @throws \Illuminate\Contracts\Container\BindingResolutionException
164163
*/
165164
public function make($abstract, array $parameters = []);
166165

167166
/**
168167
* Call the given Closure / class@method and inject its dependencies.
169168
*
170169
* @param callable|string $callback
171-
* @param array $parameters
170+
* @param array<mixed> $parameters
172171
* @param string|null $defaultMethod
173172
* @return mixed
174173
*/

analyze/phpstan/stubs/ContainerInterface.stub

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ interface ContainerInterface
1515
* @template T
1616
* @param class-string<T> $id Identifier of the entry to look for.
1717
*
18-
* @throws NotFoundExceptionInterface No entry was found for **this** identifier.
19-
* @throws ContainerExceptionInterface Error while retrieving the entry.
20-
*
2118
* @return T
2219
*/
2320
public function get(string $id);

analyze/phpstan/stubs/helpers.stub

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ declare(strict_types=1);
55
use Illuminate\Contracts\Foundation\Application;
66

77
/**
8-
* Get the available container instance.
9-
*
108
* @template T
119
* @param class-string<T> $abstract
1210
*
1311
* @return T
1412
*/
1513
function app(string $abstract) {
14+
}
1615

16+
/**
17+
* @template T
18+
* @param T $default
19+
*
20+
* @return T
21+
*/
22+
function config(string $name, ?mixed $default = null) {
1723
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"ecs": "@php vendor/bin/ecs check",
7171
"ecs-fix": "@php vendor/bin/ecs check --fix",
7272
"ecs-cc": "@php vendor/bin/ecs --clear-cache",
73-
"psalm": "@php vendor/bin/psalm",
73+
"psalm": "@php vendor/bin/psalm --show-info=true",
7474
"psalm-cc": "@php vendor/bin/psalm --clear-cache",
7575
"rector": "@php vendor/bin/rector process --dry-run",
7676
"rector-fix": "@php vendor/bin/rector process"

phpstan-baseline.neon

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,41 @@ parameters:
55
count: 1
66
path: src/External/Dto/Option.php
77

8+
-
9+
message: "#^Parameter \\#3 \\$payableId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransactionDto constructor expects int\\|string, mixed given\\.$#"
10+
count: 1
11+
path: src/Internal/Assembler/TransactionDtoAssembler.php
12+
13+
-
14+
message: "#^Parameter \\#6 \\$fromId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransferDto constructor expects int\\|string, mixed given\\.$#"
15+
count: 1
16+
path: src/Internal/Assembler/TransferDtoAssembler.php
17+
18+
-
19+
message: "#^Parameter \\#8 \\$toId of class Bavix\\\\Wallet\\\\Internal\\\\Dto\\\\TransferDto constructor expects int\\|string, mixed given\\.$#"
20+
count: 1
21+
path: src/Internal/Assembler/TransferDtoAssembler.php
22+
23+
-
24+
message: "#^Method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\TransactionRepository\\:\\:findBy\\(\\) should return array\\<Bavix\\\\Wallet\\\\Models\\\\Transaction\\> but returns array\\.$#"
25+
count: 1
26+
path: src/Internal/Repository/TransactionRepository.php
27+
28+
-
29+
message: "#^Method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\TransferRepository\\:\\:findBy\\(\\) should return array\\<Bavix\\\\Wallet\\\\Models\\\\Transfer\\> but returns array\\.$#"
30+
count: 1
31+
path: src/Internal/Repository/TransferRepository.php
32+
33+
-
34+
message: "#^Method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\WalletRepository\\:\\:findDefaultAll\\(\\) should return array\\<Bavix\\\\Wallet\\\\Models\\\\Wallet\\> but returns array\\.$#"
35+
count: 1
36+
path: src/Internal/Repository/WalletRepository.php
37+
38+
-
39+
message: "#^Parameter \\#1 \\$number of method Bavix\\\\Wallet\\\\Internal\\\\Service\\\\MathServiceInterface\\:\\:round\\(\\) expects float\\|int\\|string, mixed given\\.$#"
40+
count: 1
41+
path: src/Internal/Service/StorageService.php
42+
843
-
944
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\:\\:where\\(\\)\\.$#"
1045
count: 1
@@ -15,12 +50,27 @@ parameters:
1550
count: 2
1651
path: src/Models/Wallet.php
1752

53+
-
54+
message: "#^Cannot cast mixed to string\\.$#"
55+
count: 1
56+
path: src/Models/Wallet.php
57+
1858
-
1959
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\MorphMany\\:\\:with\\(\\)\\.$#"
2060
count: 1
2161
path: src/Services/PurchaseService.php
2262

2363
-
24-
message: "#^Parameter \\#1 \\$attributes of method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\WalletRepositoryInterface\\:\\:create\\(\\) expects array\\{holder_type\\: string, holder_id\\: int\\|string, name\\: string, slug\\?\\: string, uuid\\: string, description\\?\\: string, meta\\: array\\|null, balance\\?\\: int, \\.\\.\\.\\}, non\\-empty\\-array given\\.$#"
64+
message: "#^Parameter \\#1 \\$attributes of method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\WalletRepositoryInterface\\:\\:create\\(\\) expects array\\{holder_type\\: string, holder_id\\: int\\|string, name\\: string, slug\\?\\: string, uuid\\: string, description\\?\\: string, meta\\: array\\|null, balance\\?\\: int, \\.\\.\\.\\}, array\\{uuid\\: string, name\\: string, slug\\?\\: string, description\\?\\: string, meta\\?\\: array\\|null, decimal_places\\?\\: int\\<1, max\\>, holder_type\\: string, holder_id\\: mixed\\} given\\.$#"
65+
count: 1
66+
path: src/Services/WalletService.php
67+
68+
-
69+
message: "#^Parameter \\#2 \\$holderId of method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\WalletRepositoryInterface\\:\\:findBySlug\\(\\) expects int\\|string, mixed given\\.$#"
70+
count: 1
71+
path: src/Services/WalletService.php
72+
73+
-
74+
message: "#^Parameter \\#2 \\$holderId of method Bavix\\\\Wallet\\\\Internal\\\\Repository\\\\WalletRepositoryInterface\\:\\:getBySlug\\(\\) expects int\\|string, mixed given\\.$#"
2575
count: 1
2676
path: src/Services/WalletService.php

src/Internal/Service/DatabaseService.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Bavix\Wallet\Internal\Exceptions\TransactionFailedException;
99
use Bavix\Wallet\Internal\Exceptions\TransactionStartException;
1010
use Bavix\Wallet\Services\RegulatorServiceInterface;
11-
use Illuminate\Config\Repository as ConfigRepository;
1211
use Illuminate\Database\ConnectionInterface;
1312
use Illuminate\Database\ConnectionResolverInterface;
1413
use Illuminate\Database\RecordsNotFoundException;
@@ -22,10 +21,9 @@ final class DatabaseService implements DatabaseServiceInterface
2221

2322
public function __construct(
2423
ConnectionResolverInterface $connectionResolver,
25-
private RegulatorServiceInterface $regulatorService,
26-
ConfigRepository $config
24+
private RegulatorServiceInterface $regulatorService
2725
) {
28-
$this->connection = $connectionResolver->connection($config->get('wallet.database.connection'));
26+
$this->connection = $connectionResolver->connection(config('wallet.database.connection'));
2927
}
3028

3129
/**

src/Internal/Service/DatabaseServiceInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
interface DatabaseServiceInterface
1313
{
1414
/**
15+
* @template T
16+
* @param callable(): T $callback
17+
* @return T
18+
*
1519
* @throws RecordsNotFoundException
1620
* @throws TransactionStartException
1721
* @throws TransactionFailedException

src/Internal/Service/JsonService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Throwable;
88

99
/**
10-
* @psalm-internal
10+
* @internal
1111
*/
1212
final class JsonService implements JsonServiceInterface
1313
{

src/Internal/Service/LockService.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Bavix\Wallet\Internal\Exceptions\ExceptionInterface;
88
use Bavix\Wallet\Internal\Exceptions\LockProviderNotFoundException;
9-
use Illuminate\Config\Repository as ConfigRepository;
109
use Illuminate\Contracts\Cache\Factory as CacheFactory;
1110
use Illuminate\Contracts\Cache\LockProvider;
1211
use Illuminate\Contracts\Cache\Repository as CacheRepository;
@@ -17,10 +16,10 @@ final class LockService implements LockServiceInterface
1716

1817
private int $seconds;
1918

20-
public function __construct(CacheFactory $cacheFactory, ConfigRepository $config)
19+
public function __construct(CacheFactory $cacheFactory)
2120
{
22-
$this->seconds = (int) $config->get('wallet.lock.seconds', 1);
23-
$this->cache = $cacheFactory->store($config->get('wallet.lock.driver', 'array'));
21+
$this->seconds = (int) config('wallet.lock.seconds', 1);
22+
$this->cache = $cacheFactory->store(config('wallet.lock.driver', 'array'));
2423
}
2524

2625
/**

src/Internal/Service/LockServiceInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
interface LockServiceInterface
1010
{
1111
/**
12+
* @template T
13+
* @param callable(): T $callback
14+
*
15+
* @return T
16+
*
1217
* @throws LockProviderNotFoundException
1318
*/
1419
public function block(string $key, callable $callback): mixed;

0 commit comments

Comments
 (0)