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

Fixes deprecation of Implicitly nullable parameter #606

Closed
wants to merge 2 commits into from
Closed
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 .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service_name: travis-ci
service_name: github

src_dir: lib

Expand Down
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

16 changes: 8 additions & 8 deletions src/Saml2/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Auth
* @throws Exception
* @throws Error
*/
public function __construct(?array $settings = null, bool $spValidationOnly = false)
public function __construct(array|null $settings, bool $spValidationOnly = false)
{
$this->_settings = new Settings($settings, $spValidationOnly);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ public function setSchemasPath($path)
* @throws Error
* @throws ValidationError
*/
public function processResponse($requestId = null)
public function processResponse(string|null $requestId)
{
$this->_errors = array();
$this->_lastError = $this->_lastErrorException = null;
Expand Down Expand Up @@ -274,7 +274,7 @@ public function processResponse($requestId = null)
*
* @throws Error
*/
public function processSLO($keepLocalSession = false, $requestId = null, $retrieveParametersFromServer = false, $cbDeleteSession = null, $stay = false)
public function processSLO($keepLocalSession = false, string|null $requestId, $retrieveParametersFromServer = false, callable|null $cbDeleteSession, $stay = false)
{
$this->_errors = array();
$this->_lastError = $this->_lastErrorException = null;
Expand Down Expand Up @@ -539,7 +539,7 @@ public function getAttributeWithFriendlyName($friendlyName)
*
* @throws Error
*/
public function login($returnTo = null, array $parameters = array(), $forceAuthn = false, $isPassive = false, $stay = false, $setNameIdPolicy = true, $nameIdValueReq = null)
public function login(string|null $returnTo, array $parameters = array(), $forceAuthn = false, $isPassive = false, $stay = false, $setNameIdPolicy = true, string|null $nameIdValueReq)
{
$authnRequest = $this->buildAuthnRequest($this->_settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq);

Expand Down Expand Up @@ -580,7 +580,7 @@ public function login($returnTo = null, array $parameters = array(), $forceAuthn
*
* @throws Error
*/
public function logout($returnTo = null, array $parameters = array(), $nameId = null, $sessionIndex = null, $stay = false, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
public function logout(string|null $returnTo, array $parameters = array(), string|null $nameId, string|null $sessionIndex, $stay = false, string|null $nameIdFormat, string|null $nameIdNameQualifier, string|null $nameIdSPNameQualifier)
{
$sloUrl = $this->getSLOurl();
if (empty($sloUrl)) {
Expand Down Expand Up @@ -673,7 +673,7 @@ public function getLastRequestID()
*
* @return AuthnRequest The AuthnRequest object
*/
public function buildAuthnRequest(Settings $settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq = null)
public function buildAuthnRequest(Settings $settings, $forceAuthn, $isPassive, $setNameIdPolicy, string|null $nameIdValueReq)
{
return new AuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq);
}
Expand All @@ -689,7 +689,7 @@ public function buildAuthnRequest(Settings $settings, $forceAuthn, $isPassive, $
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
* @param string|null $nameIdSPNameQualifier The NameID SP NameQualifier will be set in the LogoutRequest.
*/
public function buildLogoutRequest(Settings $settings, $request = null, $nameId = null, $sessionIndex = null, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
public function buildLogoutRequest(Settings $settings, string|null $request, string|null $nameId, string|null $sessionIndex, string|null $nameIdFormat, string|null $nameIdNameQualifier, string|null $nameIdSPNameQualifier)
{
return new LogoutRequest($settings, $request, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
}
Expand All @@ -704,7 +704,7 @@ public function buildLogoutRequest(Settings $settings, $request = null, $nameId
* @throws Error
* @throws Exception
*/
public function buildLogoutResponse(Settings $settings, $response = null)
public function buildLogoutResponse(Settings $settings, string|null $response)
{
return new LogoutResponse($settings, $response);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Saml2/AuthnRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AuthnRequest
* @param bool $setNameIdPolicy When true the AuthNReuqest will set a nameIdPolicy
* @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated
*/
public function __construct(\OneLogin\Saml2\Settings $settings, $forceAuthn = false, $isPassive = false, $setNameIdPolicy = true, $nameIdValueReq = null)
public function __construct(\OneLogin\Saml2\Settings $settings, $forceAuthn = false, $isPassive = false, $setNameIdPolicy = true, string|null nameIdValueReq)
{
$this->_settings = $settings;

Expand Down Expand Up @@ -174,7 +174,7 @@ public function __construct(\OneLogin\Saml2\Settings $settings, $forceAuthn = fa
*
* @return string
*/
public function getRequest($deflate = null)
public function getRequest(bool|null $deflate)
{
$subject = $this->_authnRequest;

Expand Down
56 changes: 28 additions & 28 deletions src/Saml2/IdPMetadataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ class IdPMetadataParser
* make sure to validate it properly before use it in the parseRemoteXML
* method in order to avoid security issues like SSRF attacks.
*
* @param string $url URL where the IdP metadata is published
* @param string $entityId Entity Id of the desired IdP, if no
* entity Id is provided and the XML
* metadata contains more than one
* IDPSSODescriptor, the first is returned
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
* @param bool $validatePeer Enable or disable validate peer SSL certificate
* @param string $url URL where the IdP metadata is published
* @param string|null $entityId Entity Id of the desired IdP, if no
* entity Id is provided and the XML
* metadata contains more than one
* IDPSSODescriptor, the first is returned
* @param string|null $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
* @param string|null $desiredSSOBinding Parse specific binding SSO endpoint
* @param string|null $desiredSLOBinding Parse specific binding SLO endpoint
* @param bool $validatePeer Enable or disable validate peer SSL certificate
*
* @return array metadata info in php-saml settings format
*/
public static function parseRemoteXML($url, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT, $validatePeer = false)
public static function parseRemoteXML($url, string|null $entityId, string|null $desiredNameIdFormat, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT, $validatePeer = false)
{
$metadataInfo = array();

Expand Down Expand Up @@ -70,18 +70,18 @@ public static function parseRemoteXML($url, $entityId = null, $desiredNameIdForm
/**
* Get IdP Metadata Info from File
*
* @param string $filepath File path
* @param string $entityId Entity Id of the desired IdP, if no
* entity Id is provided and the XML
* metadata contains more than one
* IDPSSODescriptor, the first is returned
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
* @param string $filepath File path
* @param string|null $entityId Entity Id of the desired IdP, if no
* entity Id is provided and the XML
* metadata contains more than one
* IDPSSODescriptor, the first is returned
* @param string|null $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
*
* @return array metadata info in php-saml settings format
*/
public static function parseFileXML($filepath, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
public static function parseFileXML($filepath, string|null $entityId, string|null $desiredNameIdFormat, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
{
$metadataInfo = array();

Expand All @@ -99,20 +99,20 @@ public static function parseFileXML($filepath, $entityId = null, $desiredNameIdF
/**
* Get IdP Metadata Info from URL
*
* @param string $xml XML that contains IdP metadata
* @param string $entityId Entity Id of the desired IdP, if no
* entity Id is provided and the XML
* metadata contains more than one
* IDPSSODescriptor, the first is returned
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
* @param string $xml XML that contains IdP metadata
* @param string|null $entityId Entity Id of the desired IdP, if no
* entity Id is provided and the XML
* metadata contains more than one
* IDPSSODescriptor, the first is returned
* @param string|null $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
*
* @return array metadata info in php-saml settings format
*
* @throws Exception
*/
public static function parseXML($xml, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
public static function parseXML($xml, string|null $entityId, string|null $desiredNameIdFormat, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
{
$metadataInfo = array();

Expand Down
8 changes: 4 additions & 4 deletions src/Saml2/LogoutRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LogoutRequest
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
* @param string|null $nameIdSPNameQualifier The NameID SP NameQualifier will be set in the LogoutRequest.
*/
public function __construct(\OneLogin\Saml2\Settings $settings, $request = null, $nameId = null, $sessionIndex = null, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
public function __construct(\OneLogin\Saml2\Settings $settings, string|null $request, string|null $nameId, string|null $sessionIndex, string|null $nameIdFormat, string|null $nameIdNameQualifier, string|null $nameIdSPNameQualifier)
{
$this->_settings = $settings;

Expand Down Expand Up @@ -161,7 +161,7 @@ public function __construct(\OneLogin\Saml2\Settings $settings, $request = null,
*
* @return string Deflated base64 encoded Logout Request
*/
public function getRequest($deflate = null)
public function getRequest(bool|null $deflate)
{
$subject = $this->_logoutRequest;

Expand Down Expand Up @@ -218,7 +218,7 @@ public static function getID($request)
* @throws Exception
* @throws ValidationError
*/
public static function getNameIdData($request, $key = null)
public static function getNameIdData($request, string|null $key)
{
if ($request instanceof DOMDocument) {
$dom = $request;
Expand Down Expand Up @@ -282,7 +282,7 @@ public static function getNameIdData($request, $key = null)
* @throws Exception
* @throws ValidationError
*/
public static function getNameId($request, $key = null)
public static function getNameId($request, string|null $key)
{
$nameId = self::getNameIdData($request, $key);
return $nameId['Value'];
Expand Down
6 changes: 3 additions & 3 deletions src/Saml2/LogoutResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LogoutResponse
* @throws Error
* @throws Exception
*/
public function __construct(\OneLogin\Saml2\Settings $settings, $response = null)
public function __construct(\OneLogin\Saml2\Settings $settings, string|null $response)
{
$this->_settings = $settings;

Expand Down Expand Up @@ -140,7 +140,7 @@ public function getStatus()
*
* @throws ValidationError
*/
public function isValid($requestId = null, $retrieveParametersFromServer = false)
public function isValid(string|null $requestId, $retrieveParametersFromServer = false)
{
$this->_error = null;
try {
Expand Down Expand Up @@ -286,7 +286,7 @@ public function build($inResponseTo)
*
* @return string Logout Response deflated and base64 encoded
*/
public function getResponse($deflate = null)
public function getResponse(bool|null $deflate)
{
$logoutResponse = $this->_logoutResponse;

Expand Down
2 changes: 1 addition & 1 deletion src/Saml2/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Metadata
*
* @return string SAML Metadata XML
*/
public static function builder($sp, $authnsign = false, $wsign = false, $validUntil = null, $cacheDuration = null, $contacts = array(), $organization = array(), $attributes = array(), $ignoreValidUntil = false)
public static function builder($sp, $authnsign = false, $wsign = false, int|null $validUntil, int|null $cacheDuration, $contacts = array(), $organization = array(), $attributes = array(), $ignoreValidUntil = false)
{

if (!isset($validUntil)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Saml2/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function __construct(\OneLogin\Saml2\Settings $settings, $response)
* @throws Exception
* @throws ValidationError
*/
public function isValid($requestId = null)
public function isValid(string|null $requestId)
{
$this->_error = null;
try {
Expand Down
20 changes: 10 additions & 10 deletions src/Saml2/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Settings
* @throws Error If any settings parameter is invalid
* @throws Exception If Settings is incorrectly supplied
*/
public function __construct(?array $settings = null,bool $spValidationOnly = false)
public function __construct(array|null $settings,bool $spValidationOnly = false)
{
$this->_spValidationOnly = $spValidationOnly;
$this->_loadPaths();
Expand Down Expand Up @@ -872,20 +872,20 @@ public function getIdPSLOResponseUrl()
/**
* Gets the SP metadata. The XML representation.
*
* @param bool $alwaysPublishEncryptionCert When 'true', the returned
* metadata will always include an 'encryption' KeyDescriptor. Otherwise,
* the 'encryption' KeyDescriptor will only be included if
* $advancedSettings['security']['wantNameIdEncrypted'] or
* $advancedSettings['security']['wantAssertionsEncrypted'] are enabled.
* @param int|null $validUntil Metadata's valid time
* @param int|null $cacheDuration Duration of the cache in seconds
* @param bool $ignoreValidUntil exclude the validUntil tag from metadata
* @param bool $alwaysPublishEncryptionCert When 'true', the returned
* metadata will always include an 'encryption' KeyDescriptor. Otherwise,
* the 'encryption' KeyDescriptor will only be included if
* $advancedSettings['security']['wantNameIdEncrypted'] or
* $advancedSettings['security']['wantAssertionsEncrypted'] are enabled.
* @param int|null $validUntil Metadata's valid time
* @param int|null $cacheDuration Duration of the cache in seconds
* @param bool $ignoreValidUntil Exclude the validUntil tag from metadata
*
* @return string SP metadata (xml)
* @throws Exception
* @throws Error
*/
public function getSPMetadata($alwaysPublishEncryptionCert = false, $validUntil = null, $cacheDuration = null, $ignoreValidUntil = false)
public function getSPMetadata($alwaysPublishEncryptionCert = false, int|null $validUntil, int|null $cacheDuration, $ignoreValidUntil = false)
{
$metadata = Metadata::builder($this->_sp, $this->_security['authnRequestsSigned'], $this->_security['wantAssertionsSigned'], $validUntil, $cacheDuration, $this->getContacts(), $this->getOrganization(), [], $ignoreValidUntil);

Expand Down
Loading
Loading