Skip to content

Commit 66c7604

Browse files
committed
Upgrade test-framework with new phpcs-rules
1 parent a6499b3 commit 66c7604

125 files changed

Lines changed: 811 additions & 41 deletions

File tree

Some content is hidden

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

src/Algorithms/AlgorithmManagerDecorator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public function __construct(
1313
) {
1414
}
1515

16+
1617
public function algorithmManager(): AlgorithmManager
1718
{
1819
return $this->algorithmManager;

src/Algorithms/SignatureAlgorithmBag.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ class SignatureAlgorithmBag
1111
/** @var \SimpleSAML\OpenID\Algorithms\SignatureAlgorithmEnum[] */
1212
protected array $algorithms;
1313

14+
1415
public function __construct(SignatureAlgorithmEnum $algorithm, SignatureAlgorithmEnum ...$algorithms)
1516
{
1617
$this->algorithms = [$algorithm, ...$algorithms];
1718
}
1819

20+
1921
public function add(SignatureAlgorithmEnum $algorithm): void
2022
{
2123
$this->algorithms[] = $algorithm;
2224
}
2325

26+
2427
/**
2528
* @return \SimpleSAML\OpenID\Algorithms\SignatureAlgorithmEnum[]
2629
*/
@@ -29,6 +32,7 @@ public function getAll(): array
2932
return $this->algorithms;
3033
}
3134

35+
3236
/**
3337
* @return \Jose\Component\Signature\Algorithm\SignatureAlgorithm[]
3438
*/

src/Algorithms/SignatureAlgorithmEnum.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum SignatureAlgorithmEnum: string
3131
case RS384 = 'RS384';
3232
case RS512 = 'RS512';
3333

34+
3435
public function instance(): SignatureAlgorithm
3536
{
3637
return match ($this) {

src/Claims/ClaimInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ interface ClaimInterface extends \JsonSerializable
88
{
99
public function getName(): string;
1010

11+
1112
public function getValue(): mixed;
1213
}

src/Claims/GenericClaim.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ public function __construct(
1515
) {
1616
}
1717

18+
1819
public function getValue(): mixed
1920
{
2021
return $this->value;
2122
}
2223

24+
2325
public function getName(): string
2426
{
2527
return $this->name;
2628
}
2729

30+
2831
/**
2932
* @return array<non-empty-string,mixed>
3033
*/

src/Claims/JwksClaim.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function __construct(
1818
) {
1919
}
2020

21+
2122
/**
2223
* @return array{keys:non-empty-array<array<string,mixed>>}
2324
*/
@@ -26,6 +27,7 @@ public function getValue(): array
2627
return $this->value;
2728
}
2829

30+
2931
/**
3032
* @return non-empty-string
3133
*/
@@ -34,6 +36,7 @@ public function getName(): string
3436
return $this->name;
3537
}
3638

39+
3740
/**
3841
* @return array<non-empty-string,array{keys:non-empty-array<array<string,mixed>>}>
3942
*/

src/Codebooks/MetadataPolicyOperatorsEnum.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ enum MetadataPolicyOperatorsEnum: string
2020
case SupersetOf = 'superset_of';
2121
case Essential = 'essential';
2222

23+
2324
/**
2425
* @return string[]
2526
*/
@@ -28,6 +29,7 @@ public static function values(): array
2829
return array_column(self::cases(), 'value');
2930
}
3031

32+
3133
/**
3234
* @return string[]
3335
*/
@@ -60,6 +62,7 @@ public function getSupportedOperatorValueTypes(): array
6062
};
6163
}
6264

65+
6366
/**
6467
* @return string[]
6568
*/
@@ -87,6 +90,7 @@ public function getSupportedParameterValueTypes(): array
8790
};
8891
}
8992

93+
9094
/**
9195
* @return string[]
9296
* @throws \SimpleSAML\OpenID\Exceptions\MetadataPolicyException
@@ -105,6 +109,7 @@ public function getSupportedOperatorContainedValueTypes(): array
105109
};
106110
}
107111

112+
108113
/**
109114
* @return string[]
110115
* @throws \SimpleSAML\OpenID\Exceptions\MetadataPolicyException
@@ -124,6 +129,7 @@ public function getSupportedParameterContainedValueTypes(): array
124129
};
125130
}
126131

132+
127133
/**
128134
* @phpstan-ignore missingType.iterableValue (We can handle mixed type using array_diff)
129135
*/
@@ -134,6 +140,7 @@ public function isValueSubsetOf(mixed $value, array $superset): bool
134140
return array_diff($value, $superset) === [];
135141
}
136142

143+
137144
/**
138145
* @phpstan-ignore missingType.iterableValue (We can handle mixed type using array_diff)
139146
*/
@@ -145,6 +152,7 @@ public function isValueSupersetOf(mixed $value, array $subset): bool
145152
return array_diff($subset, $value) === [];
146153
}
147154

155+
148156
/**
149157
* @throws \SimpleSAML\OpenID\Exceptions\MetadataPolicyException
150158
*/
@@ -169,6 +177,7 @@ public function isOperatorValueTypeSupported(mixed $operatorValue): bool
169177
return true;
170178
}
171179

180+
172181
/**
173182
* @throws \SimpleSAML\OpenID\Exceptions\MetadataPolicyException
174183
*/
@@ -193,6 +202,7 @@ public function isParameterValueTypeSupported(mixed $parameterValue): bool
193202
return true;
194203
}
195204

205+
196206
/**
197207
* @return string[]
198208
*/
@@ -255,6 +265,7 @@ public function getSupportedOperatorCombinations(): array
255265
];
256266
}
257267

268+
258269
/**
259270
* @param string[] $operatorKeys
260271
*/
@@ -263,6 +274,7 @@ public function isOperatorCombinationSupported(array $operatorKeys): bool
263274
return array_diff($operatorKeys, $this->getSupportedOperatorCombinations()) === [];
264275
}
265276

277+
266278
/**
267279
* Validate general parameter operation rules like operator combinations and operator value type.
268280
*
@@ -307,6 +319,7 @@ public static function validateGeneralParameterOperationRules(array $parameterOp
307319
}
308320
}
309321

322+
310323
/**
311324
* @param array<string,mixed> $parameterOperations
312325
* @throws \SimpleSAML\OpenID\Exceptions\MetadataPolicyException
@@ -505,6 +518,7 @@ public static function validateSpecificParameterOperationRules(array $parameterO
505518
}
506519
}
507520

521+
508522
/**
509523
* @throws \SimpleSAML\OpenID\Exceptions\MetadataPolicyException
510524
*/

src/Codebooks/WellKnownEnum.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ enum WellKnownEnum: string
99
case Prefix = '.well-known';
1010
case OpenIdFederation = 'openid-federation';
1111

12+
1213
public function path(): string
1314
{
1415
if ($this === WellKnownEnum::Prefix) {
@@ -18,6 +19,7 @@ public function path(): string
1819
return self::Prefix->value . '/' . $this->value;
1920
}
2021

22+
2123
public function uriFor(string $entityId): string
2224
{
2325
return rtrim($entityId, '/') . '/' . $this->path();

src/Core.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Core
5252

5353
protected ?ClaimFactory $claimFactory = null;
5454

55+
5556
public function __construct(
5657
protected readonly SupportedAlgorithms $supportedAlgorithms = new SupportedAlgorithms(
5758
new SignatureAlgorithmBag(
@@ -67,6 +68,7 @@ public function __construct(
6768
->build($timestampValidationLeeway);
6869
}
6970

71+
7072
public function requestObjectFactory(): RequestObjectFactory
7173
{
7274
return $this->requestObjectFactory ??= new RequestObjectFactory(
@@ -80,6 +82,7 @@ public function requestObjectFactory(): RequestObjectFactory
8082
);
8183
}
8284

85+
8386
public function clientAssertionFactory(): ClientAssertionFactory
8487
{
8588
return $this->clientAssertionFactory ??= new ClientAssertionFactory(
@@ -93,11 +96,13 @@ public function clientAssertionFactory(): ClientAssertionFactory
9396
);
9497
}
9598

99+
96100
public function helpers(): Helpers
97101
{
98102
return $this->helpers ??= new Helpers();
99103
}
100104

105+
101106
public function algorithmManagerDecoratorFactory(): AlgorithmManagerDecoratorFactory
102107
{
103108
if (is_null($this->algorithmManagerDecoratorFactory)) {
@@ -107,6 +112,7 @@ public function algorithmManagerDecoratorFactory(): AlgorithmManagerDecoratorFac
107112
return $this->algorithmManagerDecoratorFactory;
108113
}
109114

115+
110116
public function jwsSerializerManagerDecoratorFactory(): JwsSerializerManagerDecoratorFactory
111117
{
112118
if (is_null($this->jwsSerializerManagerDecoratorFactory)) {
@@ -116,6 +122,7 @@ public function jwsSerializerManagerDecoratorFactory(): JwsSerializerManagerDeco
116122
return $this->jwsSerializerManagerDecoratorFactory;
117123
}
118124

125+
119126
public function jwsParserFactory(): JwsParserFactory
120127
{
121128
if (is_null($this->jwsParserFactory)) {
@@ -125,6 +132,7 @@ public function jwsParserFactory(): JwsParserFactory
125132
return $this->jwsParserFactory;
126133
}
127134

135+
128136
public function jwsVerifierDecoratorFactory(): JwsVerifierDecoratorFactory
129137
{
130138
if (is_null($this->jwsVerifierDecoratorFactory)) {
@@ -134,11 +142,13 @@ public function jwsVerifierDecoratorFactory(): JwsVerifierDecoratorFactory
134142
return $this->jwsVerifierDecoratorFactory;
135143
}
136144

145+
137146
public function jwksFactory(): JwksFactory
138147
{
139148
return $this->jwksFactory ??= new JwksFactory();
140149
}
141150

151+
142152
public function dateIntervalDecoratorFactory(): DateIntervalDecoratorFactory
143153
{
144154
if (is_null($this->dateIntervalDecoratorFactory)) {
@@ -148,6 +158,7 @@ public function dateIntervalDecoratorFactory(): DateIntervalDecoratorFactory
148158
return $this->dateIntervalDecoratorFactory;
149159
}
150160

161+
151162
public function jwsSerializerManagerDecorator(): JwsSerializerManagerDecorator
152163
{
153164
if (is_null($this->jwsSerializerManagerDecorator)) {
@@ -158,6 +169,7 @@ public function jwsSerializerManagerDecorator(): JwsSerializerManagerDecorator
158169
return $this->jwsSerializerManagerDecorator;
159170
}
160171

172+
161173
public function jwsParser(): JwsParser
162174
{
163175
if (is_null($this->jwsParser)) {
@@ -167,6 +179,7 @@ public function jwsParser(): JwsParser
167179
return $this->jwsParser;
168180
}
169181

182+
170183
public function jwsVerifierDecorator(): JwsVerifierDecorator
171184
{
172185
if (is_null($this->jwsVerifierDecorator)) {
@@ -178,6 +191,7 @@ public function jwsVerifierDecorator(): JwsVerifierDecorator
178191
return $this->jwsVerifierDecorator;
179192
}
180193

194+
181195
public function claimFactory(): ClaimFactory
182196
{
183197
return $this->claimFactory ??= new ClaimFactory(

src/Core/ClientAssertion.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected function validate(): void
2626
);
2727
}
2828

29+
2930
/**
3031
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
3132
* @throws \SimpleSAML\OpenID\Exceptions\ClientAssertionException
@@ -39,6 +40,7 @@ protected function validateIssuerAndSubject(): void
3940
}
4041
}
4142

43+
4244
/**
4345
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
4446
* @throws \SimpleSAML\OpenID\Exceptions\ClientAssertionException
@@ -49,6 +51,7 @@ public function getIssuer(): string
4951
return parent::getIssuer() ?? throw new ClientAssertionException('No Issuer claim found.');
5052
}
5153

54+
5255
/**
5356
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
5457
* @throws \SimpleSAML\OpenID\Exceptions\ClientAssertionException
@@ -59,6 +62,7 @@ public function getSubject(): string
5962
return parent::getSubject() ?? throw new ClientAssertionException('No Subject claim found.');
6063
}
6164

65+
6266
/**
6367
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
6468
* @throws \SimpleSAML\OpenID\Exceptions\ClientAssertionException
@@ -69,6 +73,7 @@ public function getAudience(): array
6973
return parent::getAudience() ?? throw new ClientAssertionException('No Audience claim found.');
7074
}
7175

76+
7277
/**
7378
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
7479
* @throws \SimpleSAML\OpenID\Exceptions\ClientAssertionException
@@ -78,6 +83,7 @@ public function getJwtId(): string
7883
return parent::getJwtId() ?? throw new ClientAssertionException('No JWT ID claim found.');
7984
}
8085

86+
8187
/**
8288
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
8389
* @throws \SimpleSAML\OpenID\Exceptions\ClientAssertionException

0 commit comments

Comments
 (0)