Skip to content

Commit 5c72808

Browse files
committed
Added explicit nullable types to satisfy PHP 8.4 deprecation
1 parent 298b326 commit 5c72808

Some content is hidden

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

66 files changed

+155
-155
lines changed

src/SAML2/ArtifactResolve.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ArtifactResolve extends Request
2525
*
2626
* @param \DOMElement|null $xml The input assertion.
2727
*/
28-
public function __construct(DOMElement $xml = null)
28+
public function __construct(?DOMElement $xml = null)
2929
{
3030
parent::__construct('ArtifactResolve', $xml);
3131

src/SAML2/ArtifactResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ArtifactResponse extends StatusResponse
3030
* @param \DOMElement|null $xml The input assertion.
3131
* @throws \Exception
3232
*/
33-
public function __construct(DOMElement $xml = null)
33+
public function __construct(?DOMElement $xml = null)
3434
{
3535
parent::__construct('ArtifactResponse', $xml);
3636

@@ -54,7 +54,7 @@ public function __construct(DOMElement $xml = null)
5454
* @param \DOMElement|null $any
5555
* @return void
5656
*/
57-
public function setAny(DOMElement $any = null) : void
57+
public function setAny(?DOMElement $any = null) : void
5858
{
5959
$this->any = $any;
6060
}

src/SAML2/Assertion.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class Assertion extends SignedElement
247247
* @param \DOMElement|null $xml The input assertion.
248248
* @throws \Exception
249249
*/
250-
public function __construct(DOMElement $xml = null)
250+
public function __construct(?DOMElement $xml = null)
251251
{
252252
// Create an Issuer
253253
$issuer = new Issuer();
@@ -771,7 +771,7 @@ public function getNameId() : ?NameID
771771
* @param \SAML2\XML\saml\NameID|null $nameId The name identifier of the assertion.
772772
* @return void
773773
*/
774-
public function setNameId(NameID $nameId = null) : void
774+
public function setNameId(?NameID $nameId = null) : void
775775
{
776776
$this->nameId = $nameId;
777777
}
@@ -937,7 +937,7 @@ public function getNotBefore() : ?int
937937
* @param int|null $notBefore The earliest timestamp this assertion is valid.
938938
* @return void
939939
*/
940-
public function setNotBefore(int $notBefore = null) : void
940+
public function setNotBefore(?int $notBefore = null) : void
941941
{
942942
$this->notBefore = $notBefore;
943943
}
@@ -965,7 +965,7 @@ public function getNotOnOrAfter() : ?int
965965
* @param int|null $notOnOrAfter The latest timestamp this assertion is valid.
966966
* @return void
967967
*/
968-
public function setNotOnOrAfter(int $notOnOrAfter = null) : void
968+
public function setNotOnOrAfter(?int $notOnOrAfter = null) : void
969969
{
970970
$this->notOnOrAfter = $notOnOrAfter;
971971
}
@@ -1015,7 +1015,7 @@ public function getValidAudiences() : ?array
10151015
* @param array|null $validAudiences The allowed audiences.
10161016
* @return void
10171017
*/
1018-
public function setValidAudiences(array $validAudiences = null) : void
1018+
public function setValidAudiences(?array $validAudiences = null) : void
10191019
{
10201020
$this->validAudiences = $validAudiences;
10211021
}
@@ -1038,7 +1038,7 @@ public function getAuthnInstant() : ?int
10381038
* @param int|null $authnInstant Timestamp the user was authenticated, or NULL if we don't want an AuthnStatement.
10391039
* @return void
10401040
*/
1041-
public function setAuthnInstant(int $authnInstant = null) : void
1041+
public function setAuthnInstant(?int $authnInstant = null) : void
10421042
{
10431043
$this->authnInstant = $authnInstant;
10441044
}
@@ -1066,7 +1066,7 @@ public function getSessionNotOnOrAfter() : ?int
10661066
* @param int|null $sessionNotOnOrAfter The latest timestamp this session is valid.
10671067
* @return void
10681068
*/
1069-
public function setSessionNotOnOrAfter(int $sessionNotOnOrAfter = null) : void
1069+
public function setSessionNotOnOrAfter(?int $sessionNotOnOrAfter = null) : void
10701070
{
10711071
$this->sessionNotOnOrAfter = $sessionNotOnOrAfter;
10721072
}
@@ -1092,7 +1092,7 @@ public function getSessionIndex() : ?string
10921092
* @param string|null $sessionIndex The session index of the user at the IdP.
10931093
* @return void
10941094
*/
1095-
public function setSessionIndex(string $sessionIndex = null) : void
1095+
public function setSessionIndex(?string $sessionIndex = null) : void
10961096
{
10971097
$this->sessionIndex = $sessionIndex;
10981098
}
@@ -1121,7 +1121,7 @@ public function getAuthnContextClassRef() : ?string
11211121
* @param string|null $authnContextClassRef The authentication method.
11221122
* @return void
11231123
*/
1124-
public function setAuthnContextClassRef(string $authnContextClassRef = null) : void
1124+
public function setAuthnContextClassRef(?string $authnContextClassRef = null) : void
11251125
{
11261126
$this->authnContextClassRef = $authnContextClassRef;
11271127
}
@@ -1144,7 +1144,7 @@ public function getSignatureMethod() : ?string
11441144
* @param string|null $signatureMethod
11451145
* @return void
11461146
*/
1147-
public function setSignatureMethod(string $signatureMethod = null) : void
1147+
public function setSignatureMethod(?string $signatureMethod = null) : void
11481148
{
11491149
$this->signatureMethod = $signatureMethod;
11501150
}
@@ -1190,7 +1190,7 @@ public function getAuthnContextDecl() : ?Chunk
11901190
* @throws \Exception
11911191
* @return void
11921192
*/
1193-
public function setAuthnContextDeclRef(string $authnContextDeclRef = null) : void
1193+
public function setAuthnContextDeclRef(?string $authnContextDeclRef = null) : void
11941194
{
11951195
if (!empty($this->authnContextDecl)) {
11961196
throw new \Exception(
@@ -1274,7 +1274,7 @@ public function getSignatureData() : ?array
12741274
* @param array|null $signatureData
12751275
* @return void
12761276
*/
1277-
public function setSignatureData(array $signatureData = null) : void
1277+
public function setSignatureData(?array $signatureData = null) : void
12781278
{
12791279
$this->signatureData = $signatureData;
12801280
}
@@ -1394,7 +1394,7 @@ public function getSignatureKey() : ?XMLSecurityKey
13941394
* @param XMLSecurityKey|null $signatureKey
13951395
* @return void
13961396
*/
1397-
public function setSignatureKey(XMLSecurityKey $signatureKey = null) : void
1397+
public function setSignatureKey(?XMLSecurityKey $signatureKey = null) : void
13981398
{
13991399
$this->signatureKey = $signatureKey;
14001400
}
@@ -1418,7 +1418,7 @@ public function getEncryptionKey() : ?XMLSecurityKey
14181418
* @param XMLSecurityKey|null $Key
14191419
* @return void
14201420
*/
1421-
public function setEncryptionKey(XMLSecurityKey $Key = null) : void
1421+
public function setEncryptionKey(?XMLSecurityKey $Key = null) : void
14221422
{
14231423
$this->encryptionKey = $Key;
14241424
}
@@ -1464,7 +1464,7 @@ public function wasSignedAtConstruction() : bool
14641464
* @param \DOMNode|null $parentElement The DOM node the assertion should be created in.
14651465
* @return \DOMElement This assertion.
14661466
*/
1467-
public function toXML(\DOMNode $parentElement = null) : DOMElement
1467+
public function toXML(?\DOMNode $parentElement = null) : DOMElement
14681468
{
14691469
if ($parentElement === null) {
14701470
$document = DOMDocumentFactory::create();

src/SAML2/AttributeQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AttributeQuery extends SubjectQuery
4747
* @param \DOMElement|null $xml The input message.
4848
* @throws \Exception
4949
*/
50-
public function __construct(DOMElement $xml = null)
50+
public function __construct(?DOMElement $xml = null)
5151
{
5252
parent::__construct('AttributeQuery', $xml);
5353

src/SAML2/AuthnRequest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class AuthnRequest extends Request
139139
* @param \DOMElement|null $xml The input message.
140140
* @throws \Exception
141141
*/
142-
public function __construct(DOMElement $xml = null)
142+
public function __construct(?DOMElement $xml = null)
143143
{
144144
parent::__construct('AuthnRequest', $xml);
145145

@@ -567,7 +567,7 @@ public function getAssertionConsumerServiceURL() : ?string
567567
* @param string|null $assertionConsumerServiceURL The AssertionConsumerServiceURL attribute.
568568
* @return void
569569
*/
570-
public function setAssertionConsumerServiceURL(string $assertionConsumerServiceURL = null) : void
570+
public function setAssertionConsumerServiceURL(?string $assertionConsumerServiceURL = null) : void
571571
{
572572
$this->assertionConsumerServiceURL = $assertionConsumerServiceURL;
573573
}
@@ -590,7 +590,7 @@ public function getProtocolBinding() : ?string
590590
* @param string $protocolBinding The ProtocolBinding attribute.
591591
* @return void
592592
*/
593-
public function setProtocolBinding(string $protocolBinding = null) : void
593+
public function setProtocolBinding(?string $protocolBinding = null) : void
594594
{
595595
$this->protocolBinding = $protocolBinding;
596596
}
@@ -613,7 +613,7 @@ public function getAttributeConsumingServiceIndex() : ?int
613613
* @param int|null $attributeConsumingServiceIndex The AttributeConsumingServiceIndex attribute.
614614
* @return void
615615
*/
616-
public function setAttributeConsumingServiceIndex(int $attributeConsumingServiceIndex = null) : void
616+
public function setAttributeConsumingServiceIndex(?int $attributeConsumingServiceIndex = null) : void
617617
{
618618
$this->attributeConsumingServiceIndex = $attributeConsumingServiceIndex;
619619
}
@@ -636,7 +636,7 @@ public function getAssertionConsumerServiceIndex() : ?int
636636
* @param int|null $assertionConsumerServiceIndex The AssertionConsumerServiceIndex attribute.
637637
* @return void
638638
*/
639-
public function setAssertionConsumerServiceIndex(int $assertionConsumerServiceIndex = null) : void
639+
public function setAssertionConsumerServiceIndex(?int $assertionConsumerServiceIndex = null) : void
640640
{
641641
$this->assertionConsumerServiceIndex = $assertionConsumerServiceIndex;
642642
}
@@ -659,7 +659,7 @@ public function getRequestedAuthnContext() : ?array
659659
* @param array|null $requestedAuthnContext The RequestedAuthnContext.
660660
* @return void
661661
*/
662-
public function setRequestedAuthnContext(array $requestedAuthnContext = null) : void
662+
public function setRequestedAuthnContext(?array $requestedAuthnContext = null) : void
663663
{
664664
$this->requestedAuthnContext = $requestedAuthnContext;
665665
}
@@ -687,7 +687,7 @@ public function getNameId() : ?NameID
687687
* @param \SAML2\XML\saml\NameID|null $nameId The name identifier of the assertion.
688688
* @return void
689689
*/
690-
public function setNameId(NameID $nameId = null) : void
690+
public function setNameId(?NameID $nameId = null) : void
691691
{
692692
$this->nameId = $nameId;
693693
}

src/SAML2/Binding.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function getDestination() : ?string
137137
* @param string|null $destination The destination the message should be delivered to.
138138
* @return void
139139
*/
140-
public function setDestination(string $destination = null) : void
140+
public function setDestination(?string $destination = null) : void
141141
{
142142
$this->destination = $destination;
143143
}

src/SAML2/Certificate/KeyLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct()
4343
*/
4444
public static function extractPublicKeys(
4545
CertificateProvider $config,
46-
string $usage = null,
46+
?string $usage = null,
4747
bool $required = false
4848
) : KeyCollection {
4949
$keyLoader = new self();
@@ -60,7 +60,7 @@ public static function extractPublicKeys(
6060
*/
6161
public function loadKeysFromConfiguration(
6262
CertificateProvider $config,
63-
string $usage = null,
63+
?string $usage = null,
6464
bool $required = false
6565
) : KeyCollection {
6666
$keys = $config->getKeys();
@@ -94,7 +94,7 @@ public function loadKeysFromConfiguration(
9494
* @param string|null $usage
9595
* @return void
9696
*/
97-
public function loadKeys($configuredKeys, string $usage = null) : void
97+
public function loadKeys($configuredKeys, ?string $usage = null) : void
9898
{
9999
foreach ($configuredKeys as $keyData) {
100100
if (isset($keyData['X509Certificate'])) {

src/SAML2/Certificate/PrivateKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PrivateKey extends Key
1414
* @throws InvalidArgumentException
1515
* @return PrivateKey
1616
*/
17-
public static function create(string $keyContents, string $passphrase = null) : PrivateKey
17+
public static function create(string $keyContents, ?string $passphrase = null) : PrivateKey
1818
{
1919
$keyData = ['PEM' => $keyContents, self::USAGE_ENCRYPTION => true];
2020
if ($passphrase) {

src/SAML2/Compat/AbstractContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ abstract public function getTempDir() : string;
8080
* @param int $mode The permissions to apply to the file. Defaults to 0600.
8181
* @return void
8282
*/
83-
abstract public function writeFile(string $filename, string $data, int $mode = null) : void;
83+
abstract public function writeFile(string $filename, string $data, ?int $mode = null) : void;
8484
}

src/SAML2/Compat/MockContainer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function redirect(string $url, array $data = []) : void
103103
* @param array $data
104104
* @return void
105105
*/
106-
public function postRedirect(string $url = null, array $data = []) : void
106+
public function postRedirect(?string $url = null, array $data = []) : void
107107
{
108108
$this->postRedirectUrl = $url;
109109
$this->postRedirectData = $data;
@@ -125,7 +125,7 @@ public function getTempDir() : string
125125
* @param int|null $mode
126126
* @return void
127127
*/
128-
public function writeFile(string $filename, string $data, int $mode = null) : void
128+
public function writeFile(string $filename, string $data, ?int $mode = null) : void
129129
{
130130
if ($mode === null) {
131131
$mode = 0600;

0 commit comments

Comments
 (0)