Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added explicit nullable types to satisfy PHP 8.4 deprecation #369

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SAML2/ArtifactResolve.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ArtifactResolve extends Request
*
* @param \DOMElement|null $xml The input assertion.
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
parent::__construct('ArtifactResolve', $xml);

Expand Down
4 changes: 2 additions & 2 deletions src/SAML2/ArtifactResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ArtifactResponse extends StatusResponse
* @param \DOMElement|null $xml The input assertion.
* @throws \Exception
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
parent::__construct('ArtifactResponse', $xml);

Expand All @@ -54,7 +54,7 @@ public function __construct(DOMElement $xml = null)
* @param \DOMElement|null $any
* @return void
*/
public function setAny(DOMElement $any = null) : void
public function setAny(?DOMElement $any = null) : void
{
$this->any = $any;
}
Expand Down
30 changes: 15 additions & 15 deletions src/SAML2/Assertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class Assertion extends SignedElement
* @param \DOMElement|null $xml The input assertion.
* @throws \Exception
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
// Create an Issuer
$issuer = new Issuer();
Expand Down Expand Up @@ -771,7 +771,7 @@ public function getNameId() : ?NameID
* @param \SAML2\XML\saml\NameID|null $nameId The name identifier of the assertion.
* @return void
*/
public function setNameId(NameID $nameId = null) : void
public function setNameId(?NameID $nameId = null) : void
{
$this->nameId = $nameId;
}
Expand Down Expand Up @@ -937,7 +937,7 @@ public function getNotBefore() : ?int
* @param int|null $notBefore The earliest timestamp this assertion is valid.
* @return void
*/
public function setNotBefore(int $notBefore = null) : void
public function setNotBefore(?int $notBefore = null) : void
{
$this->notBefore = $notBefore;
}
Expand Down Expand Up @@ -965,7 +965,7 @@ public function getNotOnOrAfter() : ?int
* @param int|null $notOnOrAfter The latest timestamp this assertion is valid.
* @return void
*/
public function setNotOnOrAfter(int $notOnOrAfter = null) : void
public function setNotOnOrAfter(?int $notOnOrAfter = null) : void
{
$this->notOnOrAfter = $notOnOrAfter;
}
Expand Down Expand Up @@ -1015,7 +1015,7 @@ public function getValidAudiences() : ?array
* @param array|null $validAudiences The allowed audiences.
* @return void
*/
public function setValidAudiences(array $validAudiences = null) : void
public function setValidAudiences(?array $validAudiences = null) : void
{
$this->validAudiences = $validAudiences;
}
Expand All @@ -1038,7 +1038,7 @@ public function getAuthnInstant() : ?int
* @param int|null $authnInstant Timestamp the user was authenticated, or NULL if we don't want an AuthnStatement.
* @return void
*/
public function setAuthnInstant(int $authnInstant = null) : void
public function setAuthnInstant(?int $authnInstant = null) : void
{
$this->authnInstant = $authnInstant;
}
Expand Down Expand Up @@ -1066,7 +1066,7 @@ public function getSessionNotOnOrAfter() : ?int
* @param int|null $sessionNotOnOrAfter The latest timestamp this session is valid.
* @return void
*/
public function setSessionNotOnOrAfter(int $sessionNotOnOrAfter = null) : void
public function setSessionNotOnOrAfter(?int $sessionNotOnOrAfter = null) : void
{
$this->sessionNotOnOrAfter = $sessionNotOnOrAfter;
}
Expand All @@ -1092,7 +1092,7 @@ public function getSessionIndex() : ?string
* @param string|null $sessionIndex The session index of the user at the IdP.
* @return void
*/
public function setSessionIndex(string $sessionIndex = null) : void
public function setSessionIndex(?string $sessionIndex = null) : void
{
$this->sessionIndex = $sessionIndex;
}
Expand Down Expand Up @@ -1121,7 +1121,7 @@ public function getAuthnContextClassRef() : ?string
* @param string|null $authnContextClassRef The authentication method.
* @return void
*/
public function setAuthnContextClassRef(string $authnContextClassRef = null) : void
public function setAuthnContextClassRef(?string $authnContextClassRef = null) : void
{
$this->authnContextClassRef = $authnContextClassRef;
}
Expand All @@ -1144,7 +1144,7 @@ public function getSignatureMethod() : ?string
* @param string|null $signatureMethod
* @return void
*/
public function setSignatureMethod(string $signatureMethod = null) : void
public function setSignatureMethod(?string $signatureMethod = null) : void
{
$this->signatureMethod = $signatureMethod;
}
Expand Down Expand Up @@ -1190,7 +1190,7 @@ public function getAuthnContextDecl() : ?Chunk
* @throws \Exception
* @return void
*/
public function setAuthnContextDeclRef(string $authnContextDeclRef = null) : void
public function setAuthnContextDeclRef(?string $authnContextDeclRef = null) : void
{
if (!empty($this->authnContextDecl)) {
throw new \Exception(
Expand Down Expand Up @@ -1274,7 +1274,7 @@ public function getSignatureData() : ?array
* @param array|null $signatureData
* @return void
*/
public function setSignatureData(array $signatureData = null) : void
public function setSignatureData(?array $signatureData = null) : void
{
$this->signatureData = $signatureData;
}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ public function getSignatureKey() : ?XMLSecurityKey
* @param XMLSecurityKey|null $signatureKey
* @return void
*/
public function setSignatureKey(XMLSecurityKey $signatureKey = null) : void
public function setSignatureKey(?XMLSecurityKey $signatureKey = null) : void
{
$this->signatureKey = $signatureKey;
}
Expand All @@ -1418,7 +1418,7 @@ public function getEncryptionKey() : ?XMLSecurityKey
* @param XMLSecurityKey|null $Key
* @return void
*/
public function setEncryptionKey(XMLSecurityKey $Key = null) : void
public function setEncryptionKey(?XMLSecurityKey $Key = null) : void
{
$this->encryptionKey = $Key;
}
Expand Down Expand Up @@ -1464,7 +1464,7 @@ public function wasSignedAtConstruction() : bool
* @param \DOMNode|null $parentElement The DOM node the assertion should be created in.
* @return \DOMElement This assertion.
*/
public function toXML(\DOMNode $parentElement = null) : DOMElement
public function toXML(?\DOMNode $parentElement = null) : DOMElement
{
if ($parentElement === null) {
$document = DOMDocumentFactory::create();
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/AttributeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AttributeQuery extends SubjectQuery
* @param \DOMElement|null $xml The input message.
* @throws \Exception
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
parent::__construct('AttributeQuery', $xml);

Expand Down
14 changes: 7 additions & 7 deletions src/SAML2/AuthnRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AuthnRequest extends Request
* @param \DOMElement|null $xml The input message.
* @throws \Exception
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
parent::__construct('AuthnRequest', $xml);

Expand Down Expand Up @@ -567,7 +567,7 @@ public function getAssertionConsumerServiceURL() : ?string
* @param string|null $assertionConsumerServiceURL The AssertionConsumerServiceURL attribute.
* @return void
*/
public function setAssertionConsumerServiceURL(string $assertionConsumerServiceURL = null) : void
public function setAssertionConsumerServiceURL(?string $assertionConsumerServiceURL = null) : void
{
$this->assertionConsumerServiceURL = $assertionConsumerServiceURL;
}
Expand All @@ -590,7 +590,7 @@ public function getProtocolBinding() : ?string
* @param string $protocolBinding The ProtocolBinding attribute.
* @return void
*/
public function setProtocolBinding(string $protocolBinding = null) : void
public function setProtocolBinding(?string $protocolBinding = null) : void
{
$this->protocolBinding = $protocolBinding;
}
Expand All @@ -613,7 +613,7 @@ public function getAttributeConsumingServiceIndex() : ?int
* @param int|null $attributeConsumingServiceIndex The AttributeConsumingServiceIndex attribute.
* @return void
*/
public function setAttributeConsumingServiceIndex(int $attributeConsumingServiceIndex = null) : void
public function setAttributeConsumingServiceIndex(?int $attributeConsumingServiceIndex = null) : void
{
$this->attributeConsumingServiceIndex = $attributeConsumingServiceIndex;
}
Expand All @@ -636,7 +636,7 @@ public function getAssertionConsumerServiceIndex() : ?int
* @param int|null $assertionConsumerServiceIndex The AssertionConsumerServiceIndex attribute.
* @return void
*/
public function setAssertionConsumerServiceIndex(int $assertionConsumerServiceIndex = null) : void
public function setAssertionConsumerServiceIndex(?int $assertionConsumerServiceIndex = null) : void
{
$this->assertionConsumerServiceIndex = $assertionConsumerServiceIndex;
}
Expand All @@ -659,7 +659,7 @@ public function getRequestedAuthnContext() : ?array
* @param array|null $requestedAuthnContext The RequestedAuthnContext.
* @return void
*/
public function setRequestedAuthnContext(array $requestedAuthnContext = null) : void
public function setRequestedAuthnContext(?array $requestedAuthnContext = null) : void
{
$this->requestedAuthnContext = $requestedAuthnContext;
}
Expand Down Expand Up @@ -687,7 +687,7 @@ public function getNameId() : ?NameID
* @param \SAML2\XML\saml\NameID|null $nameId The name identifier of the assertion.
* @return void
*/
public function setNameId(NameID $nameId = null) : void
public function setNameId(?NameID $nameId = null) : void
{
$this->nameId = $nameId;
}
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Binding.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getDestination() : ?string
* @param string|null $destination The destination the message should be delivered to.
* @return void
*/
public function setDestination(string $destination = null) : void
public function setDestination(?string $destination = null) : void
{
$this->destination = $destination;
}
Expand Down
6 changes: 3 additions & 3 deletions src/SAML2/Certificate/KeyLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct()
*/
public static function extractPublicKeys(
CertificateProvider $config,
string $usage = null,
?string $usage = null,
bool $required = false
) : KeyCollection {
$keyLoader = new self();
Expand All @@ -60,7 +60,7 @@ public static function extractPublicKeys(
*/
public function loadKeysFromConfiguration(
CertificateProvider $config,
string $usage = null,
?string $usage = null,
bool $required = false
) : KeyCollection {
$keys = $config->getKeys();
Expand Down Expand Up @@ -94,7 +94,7 @@ public function loadKeysFromConfiguration(
* @param string|null $usage
* @return void
*/
public function loadKeys($configuredKeys, string $usage = null) : void
public function loadKeys($configuredKeys, ?string $usage = null) : void
{
foreach ($configuredKeys as $keyData) {
if (isset($keyData['X509Certificate'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Certificate/PrivateKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PrivateKey extends Key
* @throws InvalidArgumentException
* @return PrivateKey
*/
public static function create(string $keyContents, string $passphrase = null) : PrivateKey
public static function create(string $keyContents, ?string $passphrase = null) : PrivateKey
{
$keyData = ['PEM' => $keyContents, self::USAGE_ENCRYPTION => true];
if ($passphrase) {
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Compat/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ abstract public function getTempDir() : string;
* @param int $mode The permissions to apply to the file. Defaults to 0600.
* @return void
*/
abstract public function writeFile(string $filename, string $data, int $mode = null) : void;
abstract public function writeFile(string $filename, string $data, ?int $mode = null) : void;
}
4 changes: 2 additions & 2 deletions src/SAML2/Compat/MockContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function redirect(string $url, array $data = []) : void
* @param array $data
* @return void
*/
public function postRedirect(string $url = null, array $data = []) : void
public function postRedirect(?string $url = null, array $data = []) : void
{
$this->postRedirectUrl = $url;
$this->postRedirectData = $data;
Expand All @@ -125,7 +125,7 @@ public function getTempDir() : string
* @param int|null $mode
* @return void
*/
public function writeFile(string $filename, string $data, int $mode = null) : void
public function writeFile(string $filename, string $data, ?int $mode = null) : void
{
if ($mode === null) {
$mode = 0600;
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Compat/Ssp/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function getTempDir() : string
* @param int|null $mode
* @return void
*/
public function writeFile(string $filename, string $data, int $mode = null) : void
public function writeFile(string $filename, string $data, ?int $mode = null) : void
{
if ($mode === null) {
$mode = 0600;
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Configuration/DecryptionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getSharedKey() : ?string;
*
* @return mixed
*/
public function getPrivateKey(string $name, bool $required = null);
public function getPrivateKey(string $name, ?bool $required = null);



Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Configuration/IdentityProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function hasBase64EncodedAttributes()
* @param bool $required
* @return mixed|null
*/
public function getPrivateKey(string $name, bool $required = null)
public function getPrivateKey(string $name, ?bool $required = null)
{
if ($required === null) {
$required = false;
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Configuration/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getSharedKey() : ?string
* @param bool $required
* @return mixed|null
*/
public function getPrivateKey(string $name, bool $required = null)
public function getPrivateKey(string $name, ?bool $required = null)
{
if ($required === null) {
$required = false;
Expand Down
4 changes: 2 additions & 2 deletions src/SAML2/EncryptedAssertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EncryptedAssertion
* @param \DOMElement|null $xml The encrypted assertion XML element.
* @throws \Exception
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
if ($xml === null) {
return;
Expand Down Expand Up @@ -133,7 +133,7 @@ public function getAssertion(XMLSecurityKey $inputKey, array $blacklist = []) :
* @param \DOMNode|null $parentElement The DOM node the assertion should be created in.
* @return \DOMElement This encrypted assertion.
*/
public function toXML(DOMNode $parentElement = null) : DOMElement
public function toXML(?DOMNode $parentElement = null) : DOMElement
{
if ($parentElement === null) {
$document = DOMDocumentFactory::create();
Expand Down
6 changes: 3 additions & 3 deletions src/SAML2/LogoutRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LogoutRequest extends Request
* @param \DOMElement|null $xml The input message.
* @throws \Exception
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
parent::__construct('LogoutRequest', $xml);

Expand Down Expand Up @@ -120,7 +120,7 @@ public function getNotOnOrAfter() : ?int
* @param int|null $notOnOrAfter The expiration time of this request.
* @return void
*/
public function setNotOnOrAfter(int $notOnOrAfter = null) : void
public function setNotOnOrAfter(?int $notOnOrAfter = null) : void
{
$this->notOnOrAfter = $notOnOrAfter;
}
Expand Down Expand Up @@ -295,7 +295,7 @@ public function getSessionIndex() : ?string
* @param string|null $sessionIndex The sesion index of the session that should be terminated.
* @return void
*/
public function setSessionIndex(string $sessionIndex = null) : void
public function setSessionIndex(?string $sessionIndex = null) : void
{
if (is_null($sessionIndex)) {
$this->sessionIndexes = [];
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/LogoutResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LogoutResponse extends StatusResponse
*
* @param \DOMElement|null $xml The input message.
*/
public function __construct(DOMElement $xml = null)
public function __construct(?DOMElement $xml = null)
{
parent::__construct('LogoutResponse', $xml);

Expand Down
Loading
Loading