Skip to content

Commit 947c55d

Browse files
committed
Bump PHP-version
1 parent b873d72 commit 947c55d

39 files changed

Lines changed: 197 additions & 164 deletions

composer.json

Lines changed: 2 additions & 2 deletions
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-hash": "*",
@@ -142,5 +142,5 @@
142142
"echo 'Post-install tasks completed!'"
143143
]
144144
},
145-
"version": "v2.4.2"
145+
"version": "v2.5.0"
146146
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function filterAttributeValues(array $values, ?array $allowedConfigValue
247247
* @param array|null Array with regular expressions to test against. null is equivalent to an empty array.
248248
* @return string|null Regular expression that matched, or null if no match.
249249
*/
250-
private static function matchAnyRegex(string $needle, ?array $regexps = null): string | null
250+
private static function matchAnyRegex(string $needle, ?array $regexps = null): string|null
251251
{
252252
if ($regexps !== null) {
253253
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
@@ -206,7 +206,7 @@ public function exists(string $type, string $key1, string $key2): bool
206206
* @param string|null $key2
207207
* @return array|false
208208
*/
209-
public function getList(?string $type = null, ?string $key1 = null, ?string $key2 = null)
209+
public function getList(?string $type = null, ?string $key1 = null, ?string $key2 = null): array|false
210210
{
211211
$conditions = $this->getCondition($type, $key1, $key2);
212212
$query = 'SELECT * FROM data WHERE ' . $conditions;
@@ -291,6 +291,7 @@ public function removeExpired(): int
291291
return $prepared->rowCount();
292292
}
293293

294+
294295
/**
295296
* Create a SQL condition statement based on parameters
296297
*

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

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
use SimpleSAML\Store\StoreFactory;
2828
use SimpleSAML\Utils;
2929

30-
class SP extends \SimpleSAML\Auth\Source
30+
class SP extends Auth\Source
3131
{
3232
/**
3333
* The entity ID of this SP.
@@ -699,12 +699,11 @@ private function startSSO2(Configuration $idpMetadata, array $state): void
699699
* This function does not return.
700700
*
701701
* @param \SAML2\Binding $binding The binding.
702-
* @param \SAML2\AuthnRequest $ar The authentication request.
702+
* @param \SAML2\AuthnRequest $ar The authentication request.
703703
*/
704-
public function sendSAML2AuthnRequest(Binding $binding, AuthnRequest $ar): void
704+
public function sendSAML2AuthnRequest(Binding $binding, AuthnRequest $ar): never
705705
{
706706
$binding->send($ar);
707-
Assert::true(false);
708707
}
709708

710709

@@ -714,12 +713,11 @@ public function sendSAML2AuthnRequest(Binding $binding, AuthnRequest $ar): void
714713
* This function does not return.
715714
*
716715
* @param \SAML2\Binding $binding The binding.
717-
* @param \SAML2\LogoutRequest $ar The logout request.
716+
* @param \SAML2\LogoutRequest $ar The logout request.
718717
*/
719-
public function sendSAML2LogoutRequest(Binding $binding, LogoutRequest $lr): void
718+
public function sendSAML2LogoutRequest(Binding $binding, LogoutRequest $lr): never
720719
{
721720
$binding->send($lr);
722-
Assert::true(false);
723721
}
724722

725723

@@ -729,15 +727,14 @@ public function sendSAML2LogoutRequest(Binding $binding, LogoutRequest $lr): voi
729727
* @param string $idp The entity ID of the IdP.
730728
* @param array $state The state array for the current authentication.
731729
*/
732-
public function startSSO(string $idp, array $state): void
730+
public function startSSO(string $idp, array $state): never
733731
{
734732
$idpMetadata = $this->getIdPMetadata($idp);
735733

736734
$type = $idpMetadata->getString('metadata-set');
737735
Assert::oneOf($type, ['saml20-idp-remote']);
738736

739737
$this->startSSO2($idpMetadata, $state);
740-
Assert::true(false); // Should not return
741738
}
742739

743740

@@ -746,7 +743,7 @@ public function startSSO(string $idp, array $state): void
746743
*
747744
* @param array $state The state array.
748745
*/
749-
private function startDisco(array $state): void
746+
private function startDisco(array $state): never
750747
{
751748
$id = Auth\State::saveState($state, 'saml:sp:sso');
752749

@@ -784,7 +781,7 @@ private function startDisco(array $state): void
784781
*
785782
* @param array &$state Information about the current authentication.
786783
*/
787-
public function authenticate(array &$state): void
784+
public function authenticate(array &$state): never
788785
{
789786
// We are going to need the authId in order to retrieve this authentication source later
790787
$state['saml:sp:AuthId'] = $this->authId;
@@ -822,11 +819,9 @@ public function authenticate(array &$state): void
822819

823820
if ($idp === null) {
824821
$this->startDisco($state);
825-
Assert::true(false);
822+
} else {
823+
$this->startSSO($idp, $state);
826824
}
827-
828-
$this->startSSO($idp, $state);
829-
Assert::true(false);
830825
}
831826

832827

@@ -949,7 +944,7 @@ public function reauthenticate(array &$state): void
949944
*
950945
* @throws \SAML2\Exception\Protocol\NoPassiveException In case the authentication request was passive.
951946
*/
952-
public static function askForIdPChange(array &$state): void
947+
public static function askForIdPChange(array &$state): never
953948
{
954949
Assert::keyExists($state, 'saml:sp:IdPMetadata');
955950
Assert::keyExists($state, 'saml:sp:AuthId');
@@ -969,7 +964,6 @@ public static function askForIdPChange(array &$state): void
969964

970965
$httpUtils = new Utils\HTTP();
971966
$httpUtils->redirectTrustedURL($url, ['AuthState' => $id]);
972-
Assert::true(false);
973967
}
974968

975969

@@ -985,7 +979,7 @@ public static function askForIdPChange(array &$state): void
985979
* - 'saml:sp:AuthId': the identifier of the current authentication source.
986980
* @throws \SAML2\Exception\Protocol\NoPassiveException In case the authentication request was passive.
987981
*/
988-
public static function tryStepUpAuth(array &$state): void
982+
public static function tryStepUpAuth(array &$state): never
989983
{
990984
Assert::keyExists($state, 'saml:idp');
991985
Assert::keyExists($state, 'saml:sp:AuthId');
@@ -1000,7 +994,6 @@ public static function tryStepUpAuth(array &$state): void
1000994
/** @var \SimpleSAML\Module\saml\Auth\Source\SP $as */
1001995
$as = new Auth\Simple($state['saml:sp:AuthId']);
1002996
$as->login($state);
1003-
Assert::true(false);
1004997
}
1005998

1006999

@@ -1011,7 +1004,7 @@ public static function tryStepUpAuth(array &$state): void
10111004
*
10121005
* @param array $state The state array.
10131006
*/
1014-
public static function reauthLogout(array $state): void
1007+
public static function reauthLogout(array $state): never
10151008
{
10161009
Logger::debug('Proxy: logging the user out before re-authentication.');
10171010

@@ -1022,7 +1015,6 @@ public static function reauthLogout(array $state): void
10221015

10231016
$idp = IdP::getByState($state);
10241017
$idp->handleLogoutRequest($state, null);
1025-
Assert::true(false);
10261018
}
10271019

10281020

@@ -1031,7 +1023,7 @@ public static function reauthLogout(array $state): void
10311023
*
10321024
* @param array $state The authentication state.
10331025
*/
1034-
public static function reauthPostLogin(array $state): void
1026+
public static function reauthPostLogin(array $state): never
10351027
{
10361028
Assert::keyExists($state, 'ReturnCallback');
10371029

@@ -1042,7 +1034,6 @@ public static function reauthPostLogin(array $state): void
10421034

10431035
// resume the login process
10441036
call_user_func($state['ReturnCallback'], $state);
1045-
Assert::true(false);
10461037
}
10471038

10481039

@@ -1054,7 +1045,7 @@ public static function reauthPostLogin(array $state): void
10541045
* @param \SimpleSAML\IdP $idp The IdP we are logging out from.
10551046
* @param array &$state The state array with the state during logout.
10561047
*/
1057-
public static function reauthPostLogout(IdP $idp, array $state): void
1048+
public static function reauthPostLogout(IdP $idp, array $state): never
10581049
{
10591050
Assert::keyExists($state, 'saml:sp:AuthId');
10601051

@@ -1069,7 +1060,6 @@ public static function reauthPostLogout(IdP $idp, array $state): void
10691060

10701061
Logger::debug('Proxy: logging in again.');
10711062
$sp->authenticate($state);
1072-
Assert::true(false);
10731063
}
10741064

10751065

@@ -1160,7 +1150,7 @@ public function logout(array &$state): void
11601150
* @param string $idp The entity id of the IdP.
11611151
* @param array $attributes The attributes.
11621152
*/
1163-
public function handleResponse(array $state, string $idp, array $attributes): void
1153+
public function handleResponse(array $state, string $idp, array $attributes): never
11641154
{
11651155
Assert::keyExists($state, 'LogoutState');
11661156
Assert::keyExists($state['LogoutState'], 'saml:logout:Type');
@@ -1187,6 +1177,7 @@ public function handleResponse(array $state, string $idp, array $attributes): vo
11871177
if (isset($state['saml:sp:NameID'])) {
11881178
$authProcState['saml:sp:NameID'] = $state['saml:sp:NameID'];
11891179
}
1180+
11901181
if (isset($state['saml:sp:SessionIndex'])) {
11911182
$authProcState['saml:sp:SessionIndex'] = $state['saml:sp:SessionIndex'];
11921183
}
@@ -1203,7 +1194,7 @@ public function handleResponse(array $state, string $idp, array $attributes): vo
12031194
*
12041195
* @param string $idpEntityId The entity ID of the IdP.
12051196
*/
1206-
public function handleLogout(string $idpEntityId): void
1197+
public function handleLogout(string $idpEntityId): never
12071198
{
12081199
/* Call the logout callback we registered in onProcessingCompleted(). */
12091200
$this->callLogoutCallback($idpEntityId);
@@ -1224,7 +1215,7 @@ public function handleLogout(string $idpEntityId): void
12241215
* manually check the URL on beforehand. Please refer to the 'trusted.url.domains'
12251216
* configuration directive for more information about allowing (or disallowing) URLs.
12261217
*/
1227-
public static function handleUnsolicitedAuth(string $authId, array $state, string $redirectTo): void
1218+
public static function handleUnsolicitedAuth(string $authId, array $state, string $redirectTo): never
12281219
{
12291220
$session = Session::getSessionFromRequest();
12301221
$session->doLogin($authId, Auth\State::getPersistentAuthData($state));
@@ -1239,7 +1230,7 @@ public static function handleUnsolicitedAuth(string $authId, array $state, strin
12391230
*
12401231
* @param array $authProcState The processing chain state.
12411232
*/
1242-
public static function onProcessingCompleted(array $authProcState): void
1233+
public static function onProcessingCompleted(array $authProcState): never
12431234
{
12441235
Assert::keyExists($authProcState, 'saml:sp:IdP');
12451236
Assert::keyExists($authProcState, 'saml:sp:State');

modules/saml/src/Error.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace SimpleSAML\Module\saml;
66

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

1013
/**
@@ -13,7 +16,7 @@
1316
* @package SimpleSAMLphp
1417
*/
1518

16-
class Error extends \SimpleSAML\Error\Exception
19+
class Error extends SSPError\Exception
1720
{
1821
/**
1922
* Create a SAML 2 error.
@@ -84,9 +87,9 @@ public function getStatusMessage(): ?string
8487
* @param \Throwable $e The original exception.
8588
* @return \SimpleSAML\Error\Exception The new exception.
8689
*/
87-
public static function fromException(Throwable $e): \SimpleSAML\Error\Exception
90+
public static function fromException(Throwable $e): SSPError\Exception
8891
{
89-
if ($e instanceof \SimpleSAML\Module\saml\Error) {
92+
if ($e instanceof SAMLError) {
9093
// Return the original exception unchanged
9194
return $e;
9295
} else {
@@ -113,15 +116,15 @@ public static function fromException(Throwable $e): \SimpleSAML\Error\Exception
113116
*
114117
* @return \SimpleSAML\Error\Exception An exception representing this error.
115118
*/
116-
public function toException(): \SimpleSAML\Error\Exception
119+
public function toException(): SSPError\Exception
117120
{
118121
$e = null;
119122

120123
switch ($this->status) {
121124
case Constants::STATUS_RESPONDER:
122125
switch ($this->subStatus) {
123126
case Constants::STATUS_NO_PASSIVE:
124-
$e = new \SimpleSAML\Module\saml\Error\NoPassive(
127+
$e = new NoPassive(
125128
Constants::STATUS_RESPONDER,
126129
$this->statusMessage,
127130
);

modules/saml/src/IdP/SQLNameID.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static function read(string $query, array $params = [], array $config =
5353
* @param array $config
5454
* @return int|false The number of rows affected by the query or false on error.
5555
*/
56-
private static function write(string $query, array $params = [], array $config = [])
56+
private static function write(string $query, array $params = [], array $config = []): int|false
5757
{
5858
if (!empty($config)) {
5959
$database = Database::getInstance(Configuration::loadFromArray($config));
@@ -121,7 +121,7 @@ private static function createAndRead(string $query, array $params = [], array $
121121
* @param array $config
122122
* @return int|false The number of rows affected by the query or false on error.
123123
*/
124-
private static function createAndWrite(string $query, array $params = [], array $config = [])
124+
private static function createAndWrite(string $query, array $params = [], array $config = []): int|false
125125
{
126126
self::create($config);
127127
return self::write($query, $params, $config);

0 commit comments

Comments
 (0)