Skip to content

Commit 1403e77

Browse files
authored
Phpstan/Rector/ECS fixed (#431)
1 parent 420ec60 commit 1403e77

Some content is hidden

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

42 files changed

+272
-48
lines changed

phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ parameters:
66
checkGenericClassInNonGenericObjectType: false
77
treatPhpDocTypesAsCertain: false
88
checkUninitializedProperties: true
9+
checkDynamicProperties: true
910
ignoreErrors:
11+
- "#Method [a-zA-Z0-9\\_\\\\:\\(\\)]+ has parameter \\$[a-zA-Z0-9_]+ with no value type specified in iterable type array#"
12+
- "#Method [a-zA-Z0-9\\_\\\\:\\(\\)]+ return type has no value type specified in iterable type array#"
13+
- "#Property [a-zA-Z0-9\\$\\_\\\\:\\(\\)]+ type has no value type specified in iterable type array#"
1014
- '#Variable static method call on Jose\\Component\\Core\\Util\\Hash\.#'
1115
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\)#'
1216
- '#Invalid type object to throw\.#'

src/Bundle/JoseFramework/DataCollector/AlgorithmCollector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public function __construct(
2222
) {
2323
}
2424

25+
/**
26+
* @param array<string, mixed> $data
27+
*/
2528
public function collect(array &$data, Request $request, Response $response, ?Throwable $exception = null): void
2629
{
2730
$algorithms = $this->algorithmManagerFactory->all();
@@ -90,6 +93,9 @@ private function getAlgorithmType(
9093
}
9194
}
9295

96+
/**
97+
* @return array<string, array<string, string>>
98+
*/
9399
private function getAlgorithmMessages(): array
94100
{
95101
return [

src/Bundle/JoseFramework/DataCollector/CheckerCollector.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,39 @@
1515
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18+
use Symfony\Component\VarDumper\Cloner\Data;
1819
use Symfony\Component\VarDumper\Cloner\VarCloner;
1920
use Throwable;
2021

2122
class CheckerCollector implements Collector, EventSubscriberInterface
2223
{
24+
/**
25+
* @var array<Data>
26+
*/
2327
private array $headerCheckedSuccesses = [];
2428

29+
/**
30+
* @var array<Data>
31+
*/
2532
private array $headerCheckedFailures = [];
2633

34+
/**
35+
* @var array<Data>
36+
*/
2737
private array $claimCheckedSuccesses = [];
2838

39+
/**
40+
* @var array<Data>
41+
*/
2942
private array $claimCheckedFailures = [];
3043

3144
/**
32-
* @var HeaderCheckerManager[]
45+
* @var array<HeaderCheckerManager>
3346
*/
3447
private array $headerCheckerManagers = [];
3548

3649
/**
37-
* @var ClaimCheckerManager[]
50+
* @var array<ClaimCheckerManager>
3851
*/
3952
private array $claimCheckerManagers = [];
4053

@@ -44,6 +57,9 @@ public function __construct(
4457
) {
4558
}
4659

60+
/**
61+
* @param array<string, mixed> $data
62+
*/
4763
public function collect(array &$data, Request $request, Response $response, ?Throwable $exception = null): void
4864
{
4965
$this->collectHeaderCheckerManagers($data);
@@ -97,6 +113,9 @@ public function catchClaimCheckFailure(ClaimCheckedFailureEvent $event): void
97113
$this->claimCheckedFailures[] = $cloner->cloneVar($event);
98114
}
99115

116+
/**
117+
* @param array<string, array<string, mixed>> $data
118+
*/
100119
private function collectHeaderCheckerManagers(array &$data): void
101120
{
102121
$data['checker']['header_checker_managers'] = [];
@@ -111,6 +130,9 @@ private function collectHeaderCheckerManagers(array &$data): void
111130
}
112131
}
113132

133+
/**
134+
* @param array<string, array<string, mixed>> $data
135+
*/
114136
private function collectSupportedHeaderCheckers(array &$data): void
115137
{
116138
$data['checker']['header_checkers'] = [];
@@ -125,6 +147,9 @@ private function collectSupportedHeaderCheckers(array &$data): void
125147
}
126148
}
127149

150+
/**
151+
* @param array<string, array<string, mixed>> $data
152+
*/
128153
private function collectClaimCheckerManagers(array &$data): void
129154
{
130155
$data['checker']['claim_checker_managers'] = [];
@@ -138,6 +163,9 @@ private function collectClaimCheckerManagers(array &$data): void
138163
}
139164
}
140165

166+
/**
167+
* @param array<string, array<string, mixed>> $data
168+
*/
141169
private function collectSupportedClaimCheckers(array &$data): void
142170
{
143171
$data['checker']['claim_checkers'] = [];
@@ -151,6 +179,9 @@ private function collectSupportedClaimCheckers(array &$data): void
151179
}
152180
}
153181

182+
/**
183+
* @param array<string, array<string, mixed>> $data
184+
*/
154185
private function collectEvents(array &$data): void
155186
{
156187
$data['checker']['events'] = [

src/Bundle/JoseFramework/DataCollector/Collector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010

1111
interface Collector
1212
{
13+
/**
14+
* @param array<string, mixed> $data
15+
*/
1316
public function collect(array &$data, Request $request, Response $response, ?Throwable $exception = null): void;
1417
}

src/Bundle/JoseFramework/DataCollector/JWECollector.php

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,44 @@
1616
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpFoundation\Response;
19+
use Symfony\Component\VarDumper\Cloner\Data;
1920
use Symfony\Component\VarDumper\Cloner\VarCloner;
2021
use Throwable;
2122

2223
class JWECollector implements Collector, EventSubscriberInterface
2324
{
25+
/**
26+
* @var array<Data>
27+
*/
2428
private array $jweDecryptionSuccesses = [];
2529

30+
/**
31+
* @var array<Data>
32+
*/
2633
private array $jweDecryptionFailures = [];
2734

35+
/**
36+
* @var array<Data>
37+
*/
2838
private array $jweBuiltSuccesses = [];
2939

40+
/**
41+
* @var array<Data>
42+
*/
3043
private array $jweBuiltFailures = [];
3144

3245
/**
33-
* @var JWEBuilder[]
46+
* @var array<JWEBuilder>
3447
*/
3548
private array $jweBuilders = [];
3649

3750
/**
38-
* @var JWEDecrypter[]
51+
* @var array<JWEDecrypter>
3952
*/
4053
private array $jweDecrypters = [];
4154

4255
/**
43-
* @var JWELoader[]
56+
* @var array<JWELoader>
4457
*/
4558
private array $jweLoaders = [];
4659

@@ -50,6 +63,9 @@ public function __construct(
5063
) {
5164
}
5265

66+
/**
67+
* @param array<string, mixed> $data
68+
*/
5369
public function collect(array &$data, Request $request, Response $response, ?Throwable $exception = null): void
5470
{
5571
$this->collectSupportedCompressionMethods($data);
@@ -109,6 +125,9 @@ public function catchJweBuiltFailure(JWEBuiltFailureEvent $event): void
109125
$this->jweBuiltFailures[] = $cloner->cloneVar($event);
110126
}
111127

128+
/**
129+
* @param array<string, array<string, mixed>> $data
130+
*/
112131
private function collectSupportedCompressionMethods(array &$data): void
113132
{
114133
$data['jwe']['compression_methods'] = [];
@@ -121,6 +140,9 @@ private function collectSupportedCompressionMethods(array &$data): void
121140
}
122141
}
123142

143+
/**
144+
* @param array<string, array<string, mixed>> $data
145+
*/
124146
private function collectSupportedJWESerializations(array &$data): void
125147
{
126148
$data['jwe']['jwe_serialization'] = [];
@@ -133,6 +155,9 @@ private function collectSupportedJWESerializations(array &$data): void
133155
}
134156
}
135157

158+
/**
159+
* @param array<string, array<string, mixed>> $data
160+
*/
136161
private function collectSupportedJWEBuilders(array &$data): void
137162
{
138163
$data['jwe']['jwe_builders'] = [];
@@ -148,6 +173,9 @@ private function collectSupportedJWEBuilders(array &$data): void
148173
}
149174
}
150175

176+
/**
177+
* @param array<string, array<string, mixed>> $data
178+
*/
151179
private function collectSupportedJWEDecrypters(array &$data): void
152180
{
153181
$data['jwe']['jwe_decrypters'] = [];
@@ -163,6 +191,9 @@ private function collectSupportedJWEDecrypters(array &$data): void
163191
}
164192
}
165193

194+
/**
195+
* @param array<string, array<string, mixed>> $data
196+
*/
166197
private function collectSupportedJWELoaders(array &$data): void
167198
{
168199
$data['jwe']['jwe_loaders'] = [];
@@ -183,6 +214,9 @@ private function collectSupportedJWELoaders(array &$data): void
183214
}
184215
}
185216

217+
/**
218+
* @param array<string, array<string, mixed>> $data
219+
*/
186220
private function collectEvents(array &$data): void
187221
{
188222
$data['jwe']['events'] = [

src/Bundle/JoseFramework/DataCollector/JWSCollector.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18+
use Symfony\Component\VarDumper\Cloner\Data;
1819
use Symfony\Component\VarDumper\Cloner\VarCloner;
1920
use Throwable;
2021

2122
class JWSCollector implements Collector, EventSubscriberInterface
2223
{
2324
/**
24-
* @var JWSBuilder[]
25+
* @var array<JWSBuilder>
2526
*/
2627
private array $jwsBuilders = [];
2728

@@ -35,19 +36,34 @@ class JWSCollector implements Collector, EventSubscriberInterface
3536
*/
3637
private array $jwsLoaders = [];
3738

39+
/**
40+
* @var array<Data>
41+
*/
3842
private array $jwsVerificationSuccesses = [];
3943

44+
/**
45+
* @var array<Data>
46+
*/
4047
private array $jwsVerificationFailures = [];
4148

49+
/**
50+
* @var array<Data>
51+
*/
4252
private array $jwsBuiltSuccesses = [];
4353

54+
/**
55+
* @var array<Data>
56+
*/
4457
private array $jwsBuiltFailures = [];
4558

4659
public function __construct(
4760
private readonly ?JWSSerializerManagerFactory $jwsSerializerManagerFactory = null
4861
) {
4962
}
5063

64+
/**
65+
* @param array<string, mixed> $data
66+
*/
5167
public function collect(array &$data, Request $request, Response $response, ?Throwable $exception = null): void
5268
{
5369
$this->collectSupportedJWSSerializations($data);
@@ -106,6 +122,9 @@ public function catchJwsBuiltFailure(JWSBuiltFailureEvent $event): void
106122
$this->jwsBuiltFailures[] = $cloner->cloneVar($event);
107123
}
108124

125+
/**
126+
* @param array<string, array<string, mixed>> $data
127+
*/
109128
private function collectSupportedJWSSerializations(array &$data): void
110129
{
111130
$data['jws']['jws_serialization'] = [];
@@ -118,6 +137,9 @@ private function collectSupportedJWSSerializations(array &$data): void
118137
}
119138
}
120139

140+
/**
141+
* @param array<string, array<string, mixed>> $data
142+
*/
121143
private function collectSupportedJWSBuilders(array &$data): void
122144
{
123145
$data['jws']['jws_builders'] = [];
@@ -129,6 +151,9 @@ private function collectSupportedJWSBuilders(array &$data): void
129151
}
130152
}
131153

154+
/**
155+
* @param array<string, array<string, mixed>> $data
156+
*/
132157
private function collectSupportedJWSVerifiers(array &$data): void
133158
{
134159
$data['jws']['jws_verifiers'] = [];
@@ -140,6 +165,9 @@ private function collectSupportedJWSVerifiers(array &$data): void
140165
}
141166
}
142167

168+
/**
169+
* @param array<string, array<string, mixed>> $data
170+
*/
143171
private function collectSupportedJWSLoaders(array &$data): void
144172
{
145173
$data['jws']['jws_loaders'] = [];
@@ -154,6 +182,9 @@ private function collectSupportedJWSLoaders(array &$data): void
154182
}
155183
}
156184

185+
/**
186+
* @param array<string, array<string, mixed>> $data
187+
*/
157188
private function collectEvents(array &$data): void
158189
{
159190
$data['jws']['events'] = [

src/Bundle/JoseFramework/DataCollector/JoseCollector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function getName(): string
3434
return 'jose_collector';
3535
}
3636

37+
/**
38+
* @return array<string, mixed>|Data
39+
*/
3740
public function getData(): array|Data
3841
{
3942
return $this->data;

0 commit comments

Comments
 (0)