Skip to content

Commit 3df64ae

Browse files
committed
Migrate code to PHP 8.3
1 parent 613bffc commit 3df64ae

38 files changed

+35
-136
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/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,

src/Certificate/X509.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ public function offsetSet($offset, $value): void
4949

5050
/**
5151
* Get the certificate representation
52-
*
53-
* @return string
5452
*/
5553
public function getCertificate(): string
5654
{

0 commit comments

Comments
 (0)