Skip to content

Commit 87cbfb6

Browse files
committed
Bump PHP-version
1 parent 3140883 commit 87cbfb6

36 files changed

Lines changed: 125 additions & 90 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"files": ["tests/_autoload_modules.php"]
4545
},
4646
"require": {
47-
"php": "^8.1",
47+
"php": "^8.2",
4848
"ext-date": "*",
4949
"ext-dom": "*",
5050
"ext-fileinfo": "*",

modules/core/src/Auth/Process/AttributeLimit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ private function filterAttributeValues(array $values, ?array $allowedConfigValue
245245
* @param array|null Array with regular expressions to test against. null is equivalent to an empty array.
246246
* @return string|null Regular expression that matched, or null if no match.
247247
*/
248-
private static function matchAnyRegex(string $needle, ?array $regexps = null): string | null
248+
private static function matchAnyRegex(string $needle, ?array $regexps = null): string|null
249249
{
250250
if ($regexps !== null) {
251251
foreach ($regexps as $x => $y) {

modules/core/src/Controller/Exception.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class Exception
3434
*
3535
* It initializes the global configuration and auth source configuration for the controllers implemented here.
3636
*
37-
* @param \SimpleSAML\Configuration $config The configuration to use by the controllers.
38-
* @param \SimpleSAML\Session $session The session to use by the controllers.
37+
* @param \SimpleSAML\Configuration $config The configuration to use by the controllers.
38+
* @param \SimpleSAML\Session $session The session to use by the controllers.
3939
*
4040
* @throws \Exception
4141
*/

modules/core/src/Storage/SQLPermanentStorage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function exists(string $type, string $key1, string $key2): bool
218218
* @param string|null $key2
219219
* @return array|false
220220
*/
221-
public function getList(?string $type = null, ?string $key1 = null, ?string $key2 = null)
221+
public function getList(?string $type = null, ?string $key1 = null, ?string $key2 = null): array|false
222222
{
223223
$conditions = $this->getCondition($type, $key1, $key2);
224224
$query = 'SELECT * FROM data WHERE ' . $conditions;
@@ -303,6 +303,7 @@ public function removeExpired(): int
303303
return $prepared->rowCount();
304304
}
305305

306+
306307
/**
307308
* Create a SQL condition statement based on parameters
308309
*

modules/saml/src/Auth/Source/SP.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ public function sendSAML2AuthnRequest(Binding $binding, AuthnRequest $ar): Respo
738738
* This function does not return.
739739
*
740740
* @param \SAML2\Binding $binding The binding.
741-
* @param \SAML2\LogoutRequest $ar The logout request.
741+
* @param \SAML2\LogoutRequest $ar The logout request.
742742
*/
743743
public function sendSAML2LogoutRequest(Binding $binding, LogoutRequest $lr): Response
744744
{
@@ -1010,7 +1010,7 @@ public static function askForIdPChange(array &$state): RedirectResponse
10101010
* - 'saml:sp:AuthId': the identifier of the current authentication source.
10111011
* @throws \SAML2\Exception\Protocol\NoPassiveException In case the authentication request was passive.
10121012
*/
1013-
public static function tryStepUpAuth(array &$state): void
1013+
public static function tryStepUpAuth(array &$state): never
10141014
{
10151015
Assert::keyExists($state, 'saml:idp');
10161016
Assert::keyExists($state, 'saml:sp:AuthId');
@@ -1025,7 +1025,6 @@ public static function tryStepUpAuth(array &$state): void
10251025
/** @var \SimpleSAML\Module\saml\Auth\Source\SP $as */
10261026
$as = new Auth\Simple($state['saml:sp:AuthId']);
10271027
$as->login($state);
1028-
Assert::true(false);
10291028
}
10301029

10311030

@@ -1218,6 +1217,7 @@ public function handleResponse(array $state, string $idp, array $attributes): Re
12181217
if (isset($state['saml:sp:NameID'])) {
12191218
$authProcState['saml:sp:NameID'] = $state['saml:sp:NameID'];
12201219
}
1220+
12211221
if (isset($state['saml:sp:SessionIndex'])) {
12221222
$authProcState['saml:sp:SessionIndex'] = $state['saml:sp:SessionIndex'];
12231223
}
@@ -1255,7 +1255,7 @@ public function handleLogout(string $idpEntityId): ?Response
12551255
* manually check the URL on beforehand. Please refer to the 'trusted.url.domains'
12561256
* configuration directive for more information about allowing (or disallowing) URLs.
12571257
*/
1258-
public static function handleUnsolicitedAuth(string $authId, array $state, string $redirectTo): void
1258+
public static function handleUnsolicitedAuth(string $authId, array $state, string $redirectTo): never
12591259
{
12601260
$session = Session::getSessionFromRequest();
12611261
$session->doLogin($authId, Auth\State::getPersistentAuthData($state));

modules/saml/src/Error.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
namespace SimpleSAML\Module\saml;
66

77
use SimpleSAML\SAML2\Constants as C;
8+
use SimpleSAML\Error as SSPError;
9+
use SimpleSAML\Module\saml\Error as SAMLError;
10+
use SimpleSAML\Module\saml\Error\NoPassive;
811
use Throwable;
912

1013
use function strlen;
@@ -16,7 +19,7 @@
1619
* @package SimpleSAMLphp
1720
*/
1821

19-
class Error extends \SimpleSAML\Error\Exception
22+
class Error extends SSPError\Exception
2023
{
2124
/**
2225
* Create a SAML 2 error.
@@ -87,9 +90,9 @@ public function getStatusMessage(): ?string
8790
* @param \Throwable $e The original exception.
8891
* @return \SimpleSAML\Error\Exception The new exception.
8992
*/
90-
public static function fromException(Throwable $e): \SimpleSAML\Error\Exception
93+
public static function fromException(Throwable $e): SSPError\Exception
9194
{
92-
if ($e instanceof \SimpleSAML\Module\saml\Error) {
95+
if ($e instanceof SAMLError) {
9396
// Return the original exception unchanged
9497
return $e;
9598
} else {
@@ -116,15 +119,15 @@ public static function fromException(Throwable $e): \SimpleSAML\Error\Exception
116119
*
117120
* @return \SimpleSAML\Error\Exception An exception representing this error.
118121
*/
119-
public function toException(): \SimpleSAML\Error\Exception
122+
public function toException(): SSPError\Exception
120123
{
121124
$e = null;
122125

123126
switch ($this->status) {
124127
case C::STATUS_RESPONDER:
125128
switch ($this->subStatus) {
126129
case C::STATUS_NO_PASSIVE:
127-
$e = new \SimpleSAML\Module\saml\Error\NoPassive(
130+
$e = new NoPassive(
128131
C::STATUS_RESPONDER,
129132
$this->statusMessage,
130133
);

modules/saml/src/IdP/SQLNameID.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private static function read(string $query, array $params = [], array $config =
5151
* @param array $config
5252
* @return int|false The number of rows affected by the query or false on error.
5353
*/
54-
private static function write(string $query, array $params = [], array $config = [])
54+
private static function write(string $query, array $params = [], array $config = []): int|false
5555
{
5656
if (!empty($config)) {
5757
$database = Database::getInstance(Configuration::loadFromArray($config));
@@ -119,7 +119,7 @@ private static function createAndRead(string $query, array $params = [], array $
119119
* @param array $config
120120
* @return int|false The number of rows affected by the query or false on error.
121121
*/
122-
private static function createAndWrite(string $query, array $params = [], array $config = [])
122+
private static function createAndWrite(string $query, array $params = [], array $config = []): int|false
123123
{
124124
self::create($config);
125125
return self::write($query, $params, $config);

modules/saml/src/Message.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
use RobRichards\XMLSecLibs\XMLSecurityKey;
99
use SAML2\{Assertion, EncryptedAssertion}; // Assertions
1010
use SAML2\{AuthnRequest, LogoutRequest, LogoutResponse, Response, StatusResponse}; // Messages
11+
use SAML2\Message as SAMLMessage;
1112
use SimpleSAML\{Configuration, Error as SSP_Error, Logger, Utils};
1213
use SimpleSAML\Assert\Assert;
1314
use SimpleSAML\SAML2\{Constants as C, SignedElement};
1415
use SimpleSAML\SAML2\XML\saml\Issuer;
1516
use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef;
17+
use SimpleSAML\SAML2\XML\samlp\AbstractMessage;
1618
use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext;
1719
use SimpleSAML\SAML2\XML\samlp\{StatusCode, StatusMessage}; // Status
1820
use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, X509Certificate, X509Data};
@@ -102,7 +104,7 @@ public static function addSign(
102104
private static function addRedirectSign(
103105
Configuration $srcMetadata,
104106
Configuration $dstMetadata,
105-
\SAML2\Message $message,
107+
SAMLMessage $message,
106108
): void {
107109
$signingEnabled = null;
108110
if ($message instanceof LogoutRequest || $message instanceof LogoutResponse) {
@@ -209,7 +211,7 @@ public static function checkSign(Configuration $srcMetadata, SignedElement $elem
209211
public static function validateMessage(
210212
Configuration $srcMetadata,
211213
Configuration $dstMetadata,
212-
\SimpleSAML\SAML2\XML\samlp\AbstractMessage $message,
214+
AbstractMessage $message,
213215
): bool {
214216
$enabled = null;
215217
if ($message instanceof LogoutRequest || $message instanceof LogoutResponse) {
@@ -262,7 +264,7 @@ public static function validateMessage(
262264
public static function getDecryptionKeys(
263265
Configuration $srcMetadata,
264266
Configuration $dstMetadata,
265-
$encryptionMethod = null,
267+
?string $encryptionMethod = null,
266268
): array {
267269
$sharedKey = $srcMetadata->getOptionalString('sharedkey', null);
268270
if ($sharedKey !== null) {
@@ -414,7 +416,6 @@ private static function decryptAssertion(
414416
* @param \SimpleSAML\SAML2\Assertion|\SimpleSAML\SAML2\Assertion $assertion
415417
* The assertion containing any possibly encrypted attributes.
416418
*
417-
*
418419
* @throws \SimpleSAML\Error\Exception if we cannot get the decryption keys or decryption fails.
419420
*/
420421
private static function decryptAttributes(
@@ -458,10 +459,11 @@ private static function decryptAttributes(
458459
*
459460
* @return \SimpleSAML\Module\saml\Error The error.
460461
*/
461-
public static function getResponseError(StatusResponse $response): \SimpleSAML\Module\saml\Error
462+
public static function getResponseError(StatusResponse $response): SAMLError
462463
{
463464
$status = $response->getStatus();
464465
$subcode = null;
466+
465467
if (!empty($status->getStatusCode()->getSubCodes())) {
466468
$subcodes = array_map(
467469
function (StatusCode $code) {
@@ -472,7 +474,7 @@ function (StatusCode $code) {
472474
$subcode = implode(' / ', $subcodes);
473475
}
474476

475-
return new \SimpleSAML\Module\saml\Error(
477+
return new SAMLError(
476478
$status->getStatusCode()->getValue(),
477479
$subcode,
478480
$status->getStatusMessage()?->getContent(),

modules/saml/src/SP/LogoutStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public static function addSession(string $authId, NameID $nameId, ?string $sessi
323323
* @param array $sessionIndexes The SessionIndexes we should log out of. Logs out of all if this is empty.
324324
* @return int|false Number of sessions logged out, or FALSE if not supported.
325325
*/
326-
public static function logoutSessions(string $authId, NameID $nameId, array $sessionIndexes)
326+
public static function logoutSessions(string $authId, NameID $nameId, array $sessionIndexes): int|false
327327
{
328328
$config = Configuration::getInstance();
329329
$storeType = $config->getOptionalString('store.type', 'phpsession');

src/SimpleSAML/Auth/State.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,13 @@ class State
8989
*/
9090
public const EXCEPTION_STAGE = '\SimpleSAML\Auth\State.exceptionStage';
9191

92-
9392
/**
9493
* The URL parameter which contains the exception state id.
9594
* Note that this does not contain a "." since it's used in the
9695
* _REQUEST superglobal that does not allow dots.
9796
*/
9897
public const EXCEPTION_PARAM = '\SimpleSAML\Auth\State_exceptionId';
9998

100-
10199
/**
102100
* State timeout.
103101
*/
@@ -171,6 +169,7 @@ public static function getStateId(array &$state, bool $rawId = false): string
171169
return $id . ':' . $state[self::RESTART];
172170
}
173171

172+
174173
/**
175174
* Perform syntactic validation of an incoming state ID.
176175
*
@@ -188,6 +187,7 @@ public static function validateStateId(string $stateId): void
188187
}
189188
}
190189

190+
191191
/**
192192
* Retrieve state timeout.
193193
*

0 commit comments

Comments
 (0)