Skip to content

Commit ffa4172

Browse files
committed
Migrate code to PHP 8.3
1 parent 25bde10 commit ffa4172

File tree

230 files changed

+804
-1303
lines changed

Some content is hidden

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

230 files changed

+804
-1303
lines changed

src/Binding/HTTPArtifact.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class HTTPArtifact extends Binding implements AsynchronousBindingInterface, Rela
4848

4949

5050
/**
51-
* @psalm-suppress UndefinedDocblockClass
52-
* @psalm-suppress UndefinedClass
5351
* @var \SimpleSAML\Configuration
5452
*/
5553
private Configuration $spMetadata;
@@ -58,16 +56,15 @@ class HTTPArtifact extends Binding implements AsynchronousBindingInterface, Rela
5856
/**
5957
* Create the redirect URL for a message.
6058
*
61-
* @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message The message.
59+
* @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message The message.
60+
* @return string The URL the user should be redirected to in order to send a message.
61+
*
6262
* @throws \Exception
63-
* @return string The URL the user should be redirected to in order to send a message.
6463
*/
6564
public function getRedirectURL(AbstractMessage $message): string
6665
{
67-
/** @psalm-suppress UndefinedClass */
6866
$config = Configuration::getInstance();
6967

70-
/** @psalm-suppress UndefinedClass */
7168
$store = StoreFactory::getInstance($config->getString('store.type'));
7269
if ($store === false) {
7370
throw new Exception('Unable to send artifact without a datastore configured.');
@@ -97,7 +94,6 @@ public function getRedirectURL(AbstractMessage $message): string
9794
$params['RelayState'] = $relayState;
9895
}
9996

100-
/** @psalm-suppress UndefinedClass */
10197
$httpUtils = new HTTP();
10298
return $httpUtils->addURLparameters($destination, $params);
10399
}
@@ -211,8 +207,6 @@ public function receive(ServerRequestInterface $request): AbstractMessage
211207

212208
/**
213209
* @param \SimpleSAML\Configuration $sp
214-
*
215-
* @psalm-suppress UndefinedClass
216210
*/
217211
public function setSPMetadata(Configuration $sp): void
218212
{
@@ -225,7 +219,6 @@ public function setSPMetadata(Configuration $sp): void
225219
*
226220
* @param \SimpleSAML\SAML2\XML\samlp\ArtifactResponse $message
227221
* @param \SimpleSAML\XMLSecurity\XMLSecurityKey $key
228-
* @return bool
229222
*/
230223
public static function validateSignature(ArtifactResponse $message, XMLSecurityKey $key): bool
231224
{

src/Binding/HTTPPost.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function send(AbstractMessage $message): ResponseInterface
8282
*
8383
* @param \Psr\Http\Message\ServerRequestInterface $request
8484
* @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The received message.
85+
*
8586
* @throws \Exception
8687
*/
8788
public function receive(ServerRequestInterface $request): AbstractMessage

src/Binding/HTTPRedirect.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function send(AbstractMessage $message): ResponseInterface
126126
*
127127
* @param \Psr\Http\Message\ServerRequestInterface $request
128128
* @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The received message.
129+
*
129130
* @throws \Exception
130131
*
131132
* NPath is currently too high but solving that just moves code around.

src/Binding/RelayStateInterface.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@ interface RelayStateInterface
1313
{
1414
/**
1515
* Set the RelayState associated with he message.
16-
*
17-
* @param string|null $relayState The RelayState.
1816
*/
1917
public function setRelayState(?string $relayState = null): void;
2018

2119

2220
/**
2321
* Get the RelayState associated with the message.
24-
*
25-
* @return string|null The RelayState.
2622
*/
2723
public function getRelayState(): ?string;
2824
}

src/Binding/RelayStateTrait.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ trait RelayStateTrait
1515
{
1616
/**
1717
* The relay state.
18-
*
19-
* @var string|null
2018
*/
2119
protected ?string $relayState = null;
2220

2321

2422
/**
2523
* Set the RelayState associated with he message.
26-
*
27-
* @param string|null $relayState The RelayState.
2824
*/
2925
public function setRelayState(?string $relayState = null): void
3026
{
@@ -35,8 +31,6 @@ public function setRelayState(?string $relayState = null): void
3531

3632
/**
3733
* Get the RelayState associated with the message.
38-
*
39-
* @return string|null The RelayState.
4034
*/
4135
public function getRelayState(): ?string
4236
{

src/Binding/SOAP.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class SOAP extends Binding implements SynchronousBindingInterface
3535
{
3636
/**
3737
* @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message
38-
* @throws \Exception
3938
* @return string|false The XML or false on error
39+
*
40+
* @throws \Exception
4041
*/
41-
public function getOutputToSend(AbstractMessage $message)
42+
public function getOutputToSend(AbstractMessage $message): string|false
4243
{
4344
$header = new Header();
4445

@@ -113,7 +114,7 @@ public function receive(/** @scrutinizer ignore-unused */ServerRequestInterface
113114
/**
114115
* @return string|false
115116
*/
116-
protected function getInputStream()
117+
protected function getInputStream(): string|false
117118
{
118119
return file_get_contents('php://input');
119120
}

src/Certificate/Key.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
class Key implements ArrayAccess
2020
{
2121
// Possible key usages
22-
public const USAGE_SIGNING = 'signing';
22+
public const string USAGE_SIGNING = 'signing';
2323

24-
public const USAGE_ENCRYPTION = 'encryption';
24+
public const string USAGE_ENCRYPTION = 'encryption';
2525

2626

2727
/** @var array */
@@ -43,8 +43,6 @@ public function __construct(array $keyData)
4343
/**
4444
* Whether or not the key is configured to be used for usage given
4545
*
46-
* @param string $usage
47-
* @return bool
4846
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
4947
*/
5048
public function canBeUsedFor(string $usage): bool
@@ -62,8 +60,8 @@ public function canBeUsedFor(string $usage): bool
6260

6361
/**
6462
* @param mixed $offset
63+
*
6564
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
66-
* @return bool
6765
*/
6866
public function offsetExists(mixed $offset): bool
6967
{
@@ -75,9 +73,7 @@ public function offsetExists(mixed $offset): bool
7573

7674

7775
/**
78-
* @param mixed $offset
7976
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
80-
* @return mixed
8177
*/
8278
public function offsetGet($offset): mixed
8379
{
@@ -89,8 +85,6 @@ public function offsetGet($offset): mixed
8985

9086

9187
/**
92-
* @param mixed $offset
93-
* @param mixed $value
9488
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
9589
*/
9690
public function offsetSet(mixed $offset, mixed $value): void
@@ -103,7 +97,6 @@ public function offsetSet(mixed $offset, mixed $value): void
10397

10498

10599
/**
106-
* @param mixed $offset
107100
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
108101
*/
109102
public function offsetUnset(mixed $offset): void

src/Certificate/KeyCollection.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ class KeyCollection extends ArrayCollection
1616
* Add a key to the collection
1717
*
1818
* @param \SimpleSAML\SAML2\Certificate\Key $element
19-
* @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false
2019
*
21-
* Type hint not possible due to upstream method signature
22-
* @psalm-suppress MoreSpecificImplementedParamType
20+
* @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false
2321
*/
2422
public function add($element): void
2523
{
26-
/** @psalm-suppress RedundantConditionGivenDocblockType */
2724
Assert::isInstanceOf($element, Key::class);
2825
parent::add($element);
2926
}

src/Certificate/KeyLoader.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use SimpleSAML\SAML2\Configuration\CertificateProvider;
1111
use SimpleSAML\SAML2\Utilities\File;
1212
use SimpleSAML\XMLSecurity\Utils\Certificate;
13+
use Traversable;
1314

1415
use function count;
1516
use function preg_match;
@@ -40,8 +41,6 @@ public function __construct()
4041
* Prioritisation order is keys > certData > certificate
4142
*
4243
* @param \SimpleSAML\SAML2\Configuration\CertificateProvider $config
43-
* @param string|null $usage
44-
* @param bool $required
4544
* @return \SimpleSAML\SAML2\Certificate\KeyCollection
4645
*/
4746
public static function extractPublicKeys(
@@ -57,8 +56,6 @@ public static function extractPublicKeys(
5756

5857
/**
5958
* @param \SimpleSAML\SAML2\Configuration\CertificateProvider $config
60-
* @param null|string $usage
61-
* @param bool $required
6259
* @return \SimpleSAML\SAML2\Certificate\KeyCollection
6360
*/
6461
public function loadKeysFromConfiguration(
@@ -92,11 +89,8 @@ public function loadKeysFromConfiguration(
9289
/**
9390
* Loads the keys given, optionally excluding keys when a usage is given and they
9491
* are not configured to be used with the usage given
95-
*
96-
* @param array|\Traversable $configuredKeys
97-
* @param string|null $usage
9892
*/
99-
public function loadKeys($configuredKeys, ?string $usage = null): void
93+
public function loadKeys(array|Traversable $configuredKeys, ?string $usage = null): void
10094
{
10195
foreach ($configuredKeys as $keyData) {
10296
if (isset($keyData['X509Certificate'])) {
@@ -116,8 +110,6 @@ public function loadKeys($configuredKeys, ?string $usage = null): void
116110

117111
/**
118112
* Attempts to load a key based on the given certificateData
119-
*
120-
* @param string $certificateData
121113
*/
122114
public function loadCertificateData(string $certificateData): void
123115
{
@@ -156,7 +148,6 @@ public function getKeys(): KeyCollection
156148

157149

158150
/**
159-
* @return bool
160151
*/
161152
public function hasKeys(): bool
162153
{

src/Certificate/PrivateKeyLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ public function loadPrivateKey(PrivateKeyConfiguration $key): PrivateKey
3030
/**
3131
* @param \SimpleSAML\SAML2\Configuration\DecryptionProvider $identityProvider
3232
* @param \SimpleSAML\SAML2\Configuration\DecryptionProvider $serviceProvider
33-
* @throws \Exception
3433
* @return \SimpleSAML\SAML2\Utilities\ArrayCollection
34+
*
35+
* @throws \Exception
3536
*/
3637
public function loadDecryptionKeys(
3738
DecryptionProvider $identityProvider,

0 commit comments

Comments
 (0)