From 9acaf95705946812e41486b064139c503d1ec5ba Mon Sep 17 00:00:00 2001 From: Mykhailo Sulyma Date: Wed, 18 Dec 2024 23:09:12 +0200 Subject: [PATCH] Add PHP 8.4 support --- .github/workflows/test.yaml | 6 ++++-- .../Action/Profile/FlushRequestStatesAction.php | 2 +- src/LightSaml/Binding/AbstractBinding.php | 4 ++-- src/LightSaml/Binding/BindingFactory.php | 4 ++-- src/LightSaml/Binding/HttpPostBinding.php | 2 +- src/LightSaml/Binding/HttpRedirectBinding.php | 4 ++-- .../Container/Factory/OwnContainerProvider.php | 2 +- src/LightSaml/Context/AbstractContext.php | 4 ++-- src/LightSaml/Context/ContextInterface.php | 4 ++-- .../Context/Profile/AssertionContext.php | 4 ++-- .../Context/Profile/ExceptionContext.php | 2 +- .../Context/Profile/Helper/LogHelper.php | 6 +++--- src/LightSaml/Context/Profile/MessageContext.php | 2 +- src/LightSaml/Credential/X509Credential.php | 2 +- .../Error/LightSamlAuthenticationException.php | 8 ++++---- .../Error/LightSamlContextException.php | 2 +- src/LightSaml/Meta/ParameterBag.php | 2 +- src/LightSaml/Meta/SigningOptions.php | 14 +++++++------- src/LightSaml/Model/AbstractSamlModel.php | 6 +++--- src/LightSaml/Model/Assertion/AbstractNameID.php | 6 +++--- src/LightSaml/Model/Assertion/Assertion.php | 6 +++--- src/LightSaml/Model/Assertion/Attribute.php | 6 +++--- .../Model/Assertion/ProxyRestriction.php | 4 ++-- src/LightSaml/Model/Assertion/Subject.php | 2 +- .../Model/Assertion/SubjectConfirmation.php | 6 +++--- .../Model/Context/DeserializationContext.php | 2 +- .../Model/Context/SerializationContext.php | 2 +- src/LightSaml/Model/Metadata/Endpoint.php | 6 +++--- .../Model/Metadata/EntityDescriptor.php | 2 +- .../Model/Metadata/IdpSsoDescriptor.php | 2 +- src/LightSaml/Model/Metadata/KeyDescriptor.php | 2 +- src/LightSaml/Model/Metadata/RoleDescriptor.php | 2 +- src/LightSaml/Model/Metadata/SSODescriptor.php | 2 +- src/LightSaml/Model/Metadata/SpSsoDescriptor.php | 2 +- src/LightSaml/Model/Protocol/NameIDPolicy.php | 2 +- src/LightSaml/Model/Protocol/SamlMessage.php | 4 ++-- src/LightSaml/Model/Protocol/Status.php | 2 +- src/LightSaml/Model/Protocol/StatusCode.php | 2 +- .../Model/XmlDSig/SignatureStringReader.php | 2 +- src/LightSaml/Model/XmlDSig/SignatureWriter.php | 2 +- .../Provider/NameID/FixedNameIdProvider.php | 4 ++-- .../Session/FixedSessionInfoProvider.php | 8 ++++---- src/LightSaml/State/Request/RequestState.php | 2 +- .../Credential/Factory/CredentialFactory.php | 4 ++-- .../TrustOptions/FixedTrustOptionsStore.php | 6 +++--- .../AbstractResolveEndpointActionTest.php | 16 ++++++++-------- .../Profile/Helper/MessageContextHelperTest.php | 2 +- .../Tests/Context/Profile/MessageContextTest.php | 2 +- .../Tests/Fixtures/Meta/TimeProviderMock.php | 4 ++-- .../Functional/Bridge/Pimple/ProfileTest.php | 2 +- .../Tests/Helper/ContactPersonChecker.php | 2 +- tests/LightSaml/Tests/Helper/EndpointChecker.php | 2 +- .../Tests/Helper/IndexedEndpointChecker.php | 2 +- .../Tests/Helper/KeyDescriptorChecker.php | 2 +- .../Tests/Helper/OrganizationChecker.php | 2 +- 55 files changed, 104 insertions(+), 102 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7fc59ece..8acaeb1d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,7 @@ on: jobs: test: name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 continue-on-error: false strategy: fail-fast: false @@ -16,16 +16,18 @@ jobs: php-version: - '8.2' - '8.3' + - '8.4' symfony-version: - '5.4.*' - '6.4.*' - '7.0.*' + - '7.1.*' include: - php-version: '8.1' symfony-version: '5.4.*' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/src/LightSaml/Action/Profile/FlushRequestStatesAction.php b/src/LightSaml/Action/Profile/FlushRequestStatesAction.php index 603f1a9c..64a1202d 100644 --- a/src/LightSaml/Action/Profile/FlushRequestStatesAction.php +++ b/src/LightSaml/Action/Profile/FlushRequestStatesAction.php @@ -48,7 +48,7 @@ protected function doExecute(ProfileContext $context) /** * @param ContextInterface|null $requestStateContext */ - protected function flush($requestStateContext = null) + protected function flush(?ContextInterface $requestStateContext = null) { if ($requestStateContext instanceof RequestStateContext && $requestStateContext->getRequestState() && diff --git a/src/LightSaml/Binding/AbstractBinding.php b/src/LightSaml/Binding/AbstractBinding.php index f39b097f..4bb0d8eb 100644 --- a/src/LightSaml/Binding/AbstractBinding.php +++ b/src/LightSaml/Binding/AbstractBinding.php @@ -25,7 +25,7 @@ abstract class AbstractBinding /** * @return AbstractBinding */ - public function setEventDispatcher(EventDispatcherInterface $eventDispatcher = null) + public function setEventDispatcher(?EventDispatcherInterface $eventDispatcher = null) { $this->eventDispatcher = $eventDispatcher; @@ -65,7 +65,7 @@ protected function dispatchSend($messageString) * * @return \Symfony\Component\HttpFoundation\Response */ - abstract public function send(MessageContext $context, $destination = null); + abstract public function send(MessageContext $context, ?string $destination = null); abstract public function receive(Request $request, MessageContext $context); } diff --git a/src/LightSaml/Binding/BindingFactory.php b/src/LightSaml/Binding/BindingFactory.php index 978f46c3..4df2f83e 100644 --- a/src/LightSaml/Binding/BindingFactory.php +++ b/src/LightSaml/Binding/BindingFactory.php @@ -24,7 +24,7 @@ class BindingFactory implements BindingFactoryInterface /** * @param EventDispatcherInterface $eventDispatcher */ - public function __construct(EventDispatcherInterface $eventDispatcher = null) + public function __construct(?EventDispatcherInterface $eventDispatcher = null) { $this->eventDispatcher = $eventDispatcher; } @@ -32,7 +32,7 @@ public function __construct(EventDispatcherInterface $eventDispatcher = null) /** * @return BindingFactoryInterface */ - public function setEventDispatcher(EventDispatcherInterface $eventDispatcher = null) + public function setEventDispatcher(?EventDispatcherInterface $eventDispatcher = null) { $this->eventDispatcher = $eventDispatcher; diff --git a/src/LightSaml/Binding/HttpPostBinding.php b/src/LightSaml/Binding/HttpPostBinding.php index a1d6d16b..b1712277 100644 --- a/src/LightSaml/Binding/HttpPostBinding.php +++ b/src/LightSaml/Binding/HttpPostBinding.php @@ -25,7 +25,7 @@ class HttpPostBinding extends AbstractBinding * * @return SamlPostResponse */ - public function send(MessageContext $context, $destination = null) + public function send(MessageContext $context, ?string $destination = null) { $message = MessageContextHelper::asSamlMessage($context); $destination = $message->getDestination() ? $message->getDestination() : $destination; diff --git a/src/LightSaml/Binding/HttpRedirectBinding.php b/src/LightSaml/Binding/HttpRedirectBinding.php index 2ed1654f..1f136351 100644 --- a/src/LightSaml/Binding/HttpRedirectBinding.php +++ b/src/LightSaml/Binding/HttpRedirectBinding.php @@ -30,7 +30,7 @@ class HttpRedirectBinding extends AbstractBinding * * @return \Symfony\Component\HttpFoundation\Response */ - public function send(MessageContext $context, $destination = null) + public function send(MessageContext $context, ?string $destination = null) { $destination = $context->getMessage()->getDestination() ? $context->getMessage()->getDestination() : $destination; @@ -203,7 +203,7 @@ protected function addRelayStateToUrl(&$msg, SamlMessage $message) /** * @param string $msg */ - protected function addSignatureToUrl(&$msg, SignatureWriter $signature = null) + protected function addSignatureToUrl(&$msg, ?SignatureWriter $signature = null) { /** @var $key XMLSecurityKey */ $key = $signature ? $signature->getXmlSecurityKey() : null; diff --git a/src/LightSaml/Bridge/Pimple/Container/Factory/OwnContainerProvider.php b/src/LightSaml/Bridge/Pimple/Container/Factory/OwnContainerProvider.php index 5180ae16..44b77cc7 100644 --- a/src/LightSaml/Bridge/Pimple/Container/Factory/OwnContainerProvider.php +++ b/src/LightSaml/Bridge/Pimple/Container/Factory/OwnContainerProvider.php @@ -29,7 +29,7 @@ class OwnContainerProvider implements ServiceProviderInterface /** * @param CredentialInterface[] $ownCredentials */ - public function __construct(EntityDescriptorProviderInterface $ownEntityDescriptorProvider, array $ownCredentials = null) + public function __construct(EntityDescriptorProviderInterface $ownEntityDescriptorProvider, ?array $ownCredentials = null) { $this->ownEntityDescriptorProvider = $ownEntityDescriptorProvider; if ($ownCredentials) { diff --git a/src/LightSaml/Context/AbstractContext.php b/src/LightSaml/Context/AbstractContext.php index 52dd98d0..dcab42df 100644 --- a/src/LightSaml/Context/AbstractContext.php +++ b/src/LightSaml/Context/AbstractContext.php @@ -42,7 +42,7 @@ public function getTopParent() /** * @return ContextInterface */ - public function setParent(ContextInterface $parent = null) + public function setParent(?ContextInterface $parent = null) { $this->parent = $parent; @@ -55,7 +55,7 @@ public function setParent(ContextInterface $parent = null) * * @return ContextInterface|null */ - public function getSubContext($name, $class = null) + public function getSubContext($name, ?string $class = null) { if (isset($this->subContexts[$name])) { return $this->subContexts[$name]; diff --git a/src/LightSaml/Context/ContextInterface.php b/src/LightSaml/Context/ContextInterface.php index 626e5730..ed96df17 100644 --- a/src/LightSaml/Context/ContextInterface.php +++ b/src/LightSaml/Context/ContextInterface.php @@ -26,7 +26,7 @@ public function getTopParent(); /** * @return ContextInterface */ - public function setParent(ContextInterface $parent = null); + public function setParent(?ContextInterface $parent = null); /** * @param string $name @@ -34,7 +34,7 @@ public function setParent(ContextInterface $parent = null); * * @return ContextInterface|null */ - public function getSubContext($name, $class = null); + public function getSubContext($name, ?string $class = null); /** * @param string $class diff --git a/src/LightSaml/Context/Profile/AssertionContext.php b/src/LightSaml/Context/Profile/AssertionContext.php index 9c46dc76..7cca4017 100644 --- a/src/LightSaml/Context/Profile/AssertionContext.php +++ b/src/LightSaml/Context/Profile/AssertionContext.php @@ -58,7 +58,7 @@ public function getAssertion() * * @return AssertionContext */ - public function setAssertion(Assertion $assertion = null) + public function setAssertion(?Assertion $assertion = null) { $this->assertion = $assertion; @@ -78,7 +78,7 @@ public function getEncryptedAssertion() * * @return AssertionContext */ - public function setEncryptedAssertion(EncryptedElement $encryptedAssertion = null) + public function setEncryptedAssertion(?EncryptedElement $encryptedAssertion = null) { $this->encryptedAssertion = $encryptedAssertion; diff --git a/src/LightSaml/Context/Profile/ExceptionContext.php b/src/LightSaml/Context/Profile/ExceptionContext.php index e51b75b8..80b2977d 100644 --- a/src/LightSaml/Context/Profile/ExceptionContext.php +++ b/src/LightSaml/Context/Profile/ExceptionContext.php @@ -19,7 +19,7 @@ class ExceptionContext extends AbstractProfileContext /** @var ExceptionContext|null */ protected $nextExceptionContext; - public function __construct(\Exception $exception = null) + public function __construct(?\Exception $exception = null) { $this->exception = $exception; } diff --git a/src/LightSaml/Context/Profile/Helper/LogHelper.php b/src/LightSaml/Context/Profile/Helper/LogHelper.php index 3355c2f2..487a01e5 100644 --- a/src/LightSaml/Context/Profile/Helper/LogHelper.php +++ b/src/LightSaml/Context/Profile/Helper/LogHelper.php @@ -22,7 +22,7 @@ abstract class LogHelper * * @return array */ - public static function getActionContext(ContextInterface $context, ActionInterface $action, array $extraData = null) + public static function getActionContext(ContextInterface $context, ActionInterface $action, ?array $extraData = null) { return self::getContext($context, $action, $extraData, false); } @@ -32,7 +32,7 @@ public static function getActionContext(ContextInterface $context, ActionInterfa * * @return array */ - public static function getActionErrorContext(ContextInterface $context, ActionInterface $action, array $extraData = null) + public static function getActionErrorContext(ContextInterface $context, ActionInterface $action, ?array $extraData = null) { return self::getContext($context, $action, $extraData, true); } @@ -44,7 +44,7 @@ public static function getActionErrorContext(ContextInterface $context, ActionIn * * @return array */ - private static function getContext(ContextInterface $context, ActionInterface $action = null, array $extraData = null, $logWholeContext = false) + private static function getContext(ContextInterface $context, ?ActionInterface $action = null, ?array $extraData = null, $logWholeContext = false) { $topContext = $context->getTopParent(); $result = []; diff --git a/src/LightSaml/Context/Profile/MessageContext.php b/src/LightSaml/Context/Profile/MessageContext.php index fc5a17fc..7306bdc6 100644 --- a/src/LightSaml/Context/Profile/MessageContext.php +++ b/src/LightSaml/Context/Profile/MessageContext.php @@ -58,7 +58,7 @@ public function getMessage() /** * @return MessageContext */ - public function setMessage(SamlMessage $message = null) + public function setMessage(?SamlMessage $message = null) { $this->message = $message; diff --git a/src/LightSaml/Credential/X509Credential.php b/src/LightSaml/Credential/X509Credential.php index ed39afb1..463f4672 100644 --- a/src/LightSaml/Credential/X509Credential.php +++ b/src/LightSaml/Credential/X509Credential.php @@ -21,7 +21,7 @@ class X509Credential extends AbstractCredential implements X509CredentialInterfa /** * @param XMLSecurityKey $privateKey */ - public function __construct(X509Certificate $certificate, XMLSecurityKey $privateKey = null) + public function __construct(X509Certificate $certificate, ?XMLSecurityKey $privateKey = null) { parent::__construct(); $this->certificate = $certificate; diff --git a/src/LightSaml/Error/LightSamlAuthenticationException.php b/src/LightSaml/Error/LightSamlAuthenticationException.php index a7d45cf9..46fa6bbd 100644 --- a/src/LightSaml/Error/LightSamlAuthenticationException.php +++ b/src/LightSaml/Error/LightSamlAuthenticationException.php @@ -19,11 +19,11 @@ class LightSamlAuthenticationException extends LightSamlValidationException protected $response; /** - * @param string $message - * @param int $code - * @param \Exception $previous + * @param string $message + * @param int $code + * @param \Exception|null $previous */ - public function __construct(StatusResponse $response, $message = '', $code = 0, \Exception $previous = null) + public function __construct(StatusResponse $response, $message = '', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/LightSaml/Error/LightSamlContextException.php b/src/LightSaml/Error/LightSamlContextException.php index 78bf769b..e9e6048c 100644 --- a/src/LightSaml/Error/LightSamlContextException.php +++ b/src/LightSaml/Error/LightSamlContextException.php @@ -23,7 +23,7 @@ class LightSamlContextException extends LightSamlException * @param int $code * @param \Exception $previous */ - public function __construct(ContextInterface $context, $message = '', $code = 0, \Exception $previous = null) + public function __construct(ContextInterface $context, $message = '', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/LightSaml/Meta/ParameterBag.php b/src/LightSaml/Meta/ParameterBag.php index 77f11215..0ef0325e 100644 --- a/src/LightSaml/Meta/ParameterBag.php +++ b/src/LightSaml/Meta/ParameterBag.php @@ -74,7 +74,7 @@ public function add(array $parameters = []) * * @return mixed */ - public function get($key, $default = null) + public function get($key, mixed $default = null) { return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } diff --git a/src/LightSaml/Meta/SigningOptions.php b/src/LightSaml/Meta/SigningOptions.php index ad579555..e5f29f9e 100644 --- a/src/LightSaml/Meta/SigningOptions.php +++ b/src/LightSaml/Meta/SigningOptions.php @@ -32,10 +32,10 @@ class SigningOptions private $certificateOptions; /** - * @param XMLSecurityKey $privateKey - * @param X509Certificate $certificate + * @param XMLSecurityKey|null $privateKey + * @param X509Certificate|null $certificate */ - public function __construct(XMLSecurityKey $privateKey = null, X509Certificate $certificate = null) + public function __construct(?XMLSecurityKey $privateKey = null, ?X509Certificate $certificate = null) { $this->enabled = true; $this->privateKey = $privateKey; @@ -52,11 +52,11 @@ public function getCertificate() } /** - * @param X509Certificate $certificate + * @param X509Certificate|null $certificate * * @return SigningOptions */ - public function setCertificate(X509Certificate $certificate = null) + public function setCertificate(?X509Certificate $certificate = null) { $this->certificate = $certificate; @@ -72,11 +72,11 @@ public function getPrivateKey() } /** - * @param XMLSecurityKey $privateKey + * @param XMLSecurityKey|null $privateKey * * @return SigningOptions */ - public function setPrivateKey(XMLSecurityKey $privateKey = null) + public function setPrivateKey(?XMLSecurityKey $privateKey = null) { $this->privateKey = $privateKey; diff --git a/src/LightSaml/Model/AbstractSamlModel.php b/src/LightSaml/Model/AbstractSamlModel.php index 12864147..f56a2e12 100644 --- a/src/LightSaml/Model/AbstractSamlModel.php +++ b/src/LightSaml/Model/AbstractSamlModel.php @@ -41,7 +41,7 @@ protected function createElement($name, $namespace, \DOMNode $parent, Serializat * * @throws \LogicException */ - private function oneElementToXml($name, \DOMNode $parent, SerializationContext $context, $namespace = null) + private function oneElementToXml($name, \DOMNode $parent, SerializationContext $context, ?string $namespace = null) { $value = $this->getPropertyValue($name); if (null == $value) { @@ -65,7 +65,7 @@ private function oneElementToXml($name, \DOMNode $parent, SerializationContext $ * @param array|string[] $names * @param string|null $namespace */ - protected function singleElementsToXml(array $names, \DOMNode $parent, SerializationContext $context, $namespace = null) + protected function singleElementsToXml(array $names, \DOMNode $parent, SerializationContext $context, ?string $namespace = null) { foreach ($names as $name) { $this->oneElementToXml($name, $parent, $context, $namespace); @@ -79,7 +79,7 @@ protected function singleElementsToXml(array $names, \DOMNode $parent, Serializa * * @throws \LogicException */ - protected function manyElementsToXml($value, \DOMNode $node, SerializationContext $context, $nodeName = null, $namespaceUri = null) + protected function manyElementsToXml($value, \DOMNode $node, SerializationContext $context, ?string $nodeName = null, ?string $namespaceUri = null) { if (false == $value) { return; diff --git a/src/LightSaml/Model/Assertion/AbstractNameID.php b/src/LightSaml/Model/Assertion/AbstractNameID.php index ae2fbbe6..27cff276 100644 --- a/src/LightSaml/Model/Assertion/AbstractNameID.php +++ b/src/LightSaml/Model/Assertion/AbstractNameID.php @@ -45,10 +45,10 @@ abstract class AbstractNameID extends AbstractSamlModel protected $spProvidedId; /** - * @param string $value - * @param string $format + * @param string|null $value + * @param string|null $format */ - public function __construct($value = null, $format = null) + public function __construct(?string $value = null, ?string $format = null) { $this->value = $value; $this->format = $format; diff --git a/src/LightSaml/Model/Assertion/Assertion.php b/src/LightSaml/Model/Assertion/Assertion.php index 186152ee..e24bdb3d 100644 --- a/src/LightSaml/Model/Assertion/Assertion.php +++ b/src/LightSaml/Model/Assertion/Assertion.php @@ -137,7 +137,7 @@ public function hasAnySessionIndex() /** * @return Assertion */ - public function setConditions(Conditions $conditions = null) + public function setConditions(?Conditions $conditions = null) { $this->conditions = $conditions; @@ -223,7 +223,7 @@ public function getIssueInstantDateTime() * * @return Assertion */ - public function setIssuer(Issuer $issuer = null) + public function setIssuer(?Issuer $issuer = null) { $this->issuer = $issuer; @@ -243,7 +243,7 @@ public function getIssuer() * * @return Assertion */ - public function setSignature(Signature $signature = null) + public function setSignature(?Signature $signature = null) { $this->signature = $signature; diff --git a/src/LightSaml/Model/Assertion/Attribute.php b/src/LightSaml/Model/Assertion/Attribute.php index 4dc48ba9..ce295026 100644 --- a/src/LightSaml/Model/Assertion/Attribute.php +++ b/src/LightSaml/Model/Assertion/Attribute.php @@ -31,10 +31,10 @@ class Attribute extends AbstractSamlModel protected $attributeValue; /** - * @param string|null $name - * @param string|string[] $value + * @param string|null $name + * @param string|string[]|null $value */ - public function __construct($name = null, $value = null) + public function __construct(?string $name = null, string|array|null $value = null) { $this->name = $name; if ($value) { diff --git a/src/LightSaml/Model/Assertion/ProxyRestriction.php b/src/LightSaml/Model/Assertion/ProxyRestriction.php index 78ba7c57..1ae1fbc2 100644 --- a/src/LightSaml/Model/Assertion/ProxyRestriction.php +++ b/src/LightSaml/Model/Assertion/ProxyRestriction.php @@ -28,10 +28,10 @@ class ProxyRestriction extends AbstractCondition protected $audience; /** - * @param int $count + * @param int|null $count * @param string[] $audience */ - public function __construct($count = null, array $audience = null) + public function __construct(?int $count = null, ?array $audience = null) { $this->count = $count; $this->audience = $audience; diff --git a/src/LightSaml/Model/Assertion/Subject.php b/src/LightSaml/Model/Assertion/Subject.php index ffd46c37..ce98b21b 100644 --- a/src/LightSaml/Model/Assertion/Subject.php +++ b/src/LightSaml/Model/Assertion/Subject.php @@ -29,7 +29,7 @@ class Subject extends AbstractSamlModel * * @return Subject */ - public function setNameID(NameID $nameId = null) + public function setNameID(?NameID $nameId = null) { $this->nameId = $nameId; diff --git a/src/LightSaml/Model/Assertion/SubjectConfirmation.php b/src/LightSaml/Model/Assertion/SubjectConfirmation.php index b3e83b9c..e0402921 100644 --- a/src/LightSaml/Model/Assertion/SubjectConfirmation.php +++ b/src/LightSaml/Model/Assertion/SubjectConfirmation.php @@ -53,7 +53,7 @@ public function getMethod() /** * @return SubjectConfirmation */ - public function setEncryptedId(EncryptedElement $encryptedId = null) + public function setEncryptedId(?EncryptedElement $encryptedId = null) { $this->encryptedId = $encryptedId; @@ -71,7 +71,7 @@ public function getEncryptedId() /** * @return SubjectConfirmation */ - public function setNameID(NameID $nameId = null) + public function setNameID(?NameID $nameId = null) { $this->nameId = $nameId; @@ -89,7 +89,7 @@ public function getNameID() /** * @return SubjectConfirmation */ - public function setSubjectConfirmationData(SubjectConfirmationData $subjectConfirmationData = null) + public function setSubjectConfirmationData(?SubjectConfirmationData $subjectConfirmationData = null) { $this->subjectConfirmationData = $subjectConfirmationData; diff --git a/src/LightSaml/Model/Context/DeserializationContext.php b/src/LightSaml/Model/Context/DeserializationContext.php index b5011d06..1f6f6f00 100644 --- a/src/LightSaml/Model/Context/DeserializationContext.php +++ b/src/LightSaml/Model/Context/DeserializationContext.php @@ -25,7 +25,7 @@ class DeserializationContext /** * @param \DOMDocument $document */ - public function __construct(\DOMDocument $document = null) + public function __construct(?\DOMDocument $document = null) { $this->document = $document ? $document : new \DOMDocument(); } diff --git a/src/LightSaml/Model/Context/SerializationContext.php b/src/LightSaml/Model/Context/SerializationContext.php index 1d796592..f4521b7f 100644 --- a/src/LightSaml/Model/Context/SerializationContext.php +++ b/src/LightSaml/Model/Context/SerializationContext.php @@ -19,7 +19,7 @@ class SerializationContext /** * @param \DOMDocument $document */ - public function __construct(\DOMDocument $document = null) + public function __construct(?\DOMDocument $document = null) { $this->document = $document ? $document : new \DOMDocument(); } diff --git a/src/LightSaml/Model/Metadata/Endpoint.php b/src/LightSaml/Model/Metadata/Endpoint.php index ae3fa48c..328d1e50 100644 --- a/src/LightSaml/Model/Metadata/Endpoint.php +++ b/src/LightSaml/Model/Metadata/Endpoint.php @@ -27,10 +27,10 @@ abstract class Endpoint extends AbstractSamlModel protected $responseLocation; /** - * @param string $location - * @param string $binding + * @param string|null $location + * @param string|null $binding */ - public function __construct($location = null, $binding = null) + public function __construct(?string $location = null, ?string $binding = null) { $this->location = $location; $this->binding = $binding; diff --git a/src/LightSaml/Model/Metadata/EntityDescriptor.php b/src/LightSaml/Model/Metadata/EntityDescriptor.php index 1a60493b..4a1c1b47 100644 --- a/src/LightSaml/Model/Metadata/EntityDescriptor.php +++ b/src/LightSaml/Model/Metadata/EntityDescriptor.php @@ -71,7 +71,7 @@ public static function loadXml($xml) /** * @param string|null $entityId */ - public function __construct($entityId = null, array $items = []) + public function __construct(?string $entityId = null, array $items = []) { $this->entityID = $entityId; $this->items = $items; diff --git a/src/LightSaml/Model/Metadata/IdpSsoDescriptor.php b/src/LightSaml/Model/Metadata/IdpSsoDescriptor.php index 730cc939..57499f1b 100644 --- a/src/LightSaml/Model/Metadata/IdpSsoDescriptor.php +++ b/src/LightSaml/Model/Metadata/IdpSsoDescriptor.php @@ -107,7 +107,7 @@ public function getAllSingleSignOnServicesByBinding($binding) * * @return SingleSignOnService|null */ - public function getFirstSingleSignOnService($binding = null) + public function getFirstSingleSignOnService(?string $binding = null) { foreach ($this->getAllSingleSignOnServices() as $svc) { if (null == $binding || $svc->getBinding() == $binding) { diff --git a/src/LightSaml/Model/Metadata/KeyDescriptor.php b/src/LightSaml/Model/Metadata/KeyDescriptor.php index 38257578..c27e7e55 100644 --- a/src/LightSaml/Model/Metadata/KeyDescriptor.php +++ b/src/LightSaml/Model/Metadata/KeyDescriptor.php @@ -32,7 +32,7 @@ class KeyDescriptor extends AbstractSamlModel /** * @param string|null $use */ - public function __construct($use = null, X509Certificate $certificate = null) + public function __construct(?string $use = null, ?X509Certificate $certificate = null) { $this->use = $use; $this->certificate = $certificate; diff --git a/src/LightSaml/Model/Metadata/RoleDescriptor.php b/src/LightSaml/Model/Metadata/RoleDescriptor.php index d2543437..715bdcc1 100644 --- a/src/LightSaml/Model/Metadata/RoleDescriptor.php +++ b/src/LightSaml/Model/Metadata/RoleDescriptor.php @@ -175,7 +175,7 @@ public function getAllKeyDescriptorsByUse($use) * * @return KeyDescriptor|null */ - public function getFirstKeyDescriptor($use = null) + public function getFirstKeyDescriptor(?string $use = null) { if ($this->getAllKeyDescriptors()) { foreach ($this->getAllKeyDescriptors() as $kd) { diff --git a/src/LightSaml/Model/Metadata/SSODescriptor.php b/src/LightSaml/Model/Metadata/SSODescriptor.php index d32707ad..fa53ae97 100644 --- a/src/LightSaml/Model/Metadata/SSODescriptor.php +++ b/src/LightSaml/Model/Metadata/SSODescriptor.php @@ -63,7 +63,7 @@ public function getAllSingleLogoutServicesByBinding($binding) * * @return SingleLogoutService|null */ - public function getFirstSingleLogoutService($binding = null) + public function getFirstSingleLogoutService(?string $binding = null) { foreach ($this->getAllSingleLogoutServices() as $svc) { if (null == $binding || $binding == $svc->getBinding()) { diff --git a/src/LightSaml/Model/Metadata/SpSsoDescriptor.php b/src/LightSaml/Model/Metadata/SpSsoDescriptor.php index 8f2f4731..cce71cce 100644 --- a/src/LightSaml/Model/Metadata/SpSsoDescriptor.php +++ b/src/LightSaml/Model/Metadata/SpSsoDescriptor.php @@ -105,7 +105,7 @@ public function getAssertionConsumerServicesByIndex($index) * * @return AssertionConsumerService|null */ - public function getFirstAssertionConsumerService($binding = null) + public function getFirstAssertionConsumerService(?string $binding = null) { foreach ($this->getAllAssertionConsumerServices() as $svc) { if (null == $binding || $svc->getBinding() == $binding) { diff --git a/src/LightSaml/Model/Protocol/NameIDPolicy.php b/src/LightSaml/Model/Protocol/NameIDPolicy.php index 94ae9147..51f8e419 100644 --- a/src/LightSaml/Model/Protocol/NameIDPolicy.php +++ b/src/LightSaml/Model/Protocol/NameIDPolicy.php @@ -37,7 +37,7 @@ class NameIDPolicy extends AbstractSamlModel * @param string $format * @param bool $allowCreate */ - public function __construct($format = null, $allowCreate = null) + public function __construct(?string $format = null, ?bool $allowCreate = null) { $this->allowCreate = $allowCreate; $this->format = $format; diff --git a/src/LightSaml/Model/Protocol/SamlMessage.php b/src/LightSaml/Model/Protocol/SamlMessage.php index 58d3823d..ed4c3b44 100644 --- a/src/LightSaml/Model/Protocol/SamlMessage.php +++ b/src/LightSaml/Model/Protocol/SamlMessage.php @@ -209,7 +209,7 @@ public function getDestination() /** * @return SamlMessage */ - public function setIssuer(Issuer $issuer = null) + public function setIssuer(?Issuer $issuer = null) { $this->issuer = $issuer; @@ -247,7 +247,7 @@ public function getConsent() /** * @return SamlMessage */ - public function setSignature(Signature $signature = null) + public function setSignature(?Signature $signature = null) { $this->signature = $signature; diff --git a/src/LightSaml/Model/Protocol/Status.php b/src/LightSaml/Model/Protocol/Status.php index 5d2ca9df..85e751c1 100644 --- a/src/LightSaml/Model/Protocol/Status.php +++ b/src/LightSaml/Model/Protocol/Status.php @@ -27,7 +27,7 @@ class Status extends AbstractSamlModel /** * @param string $message */ - public function __construct(StatusCode $statusCode = null, $message = null) + public function __construct(?StatusCode $statusCode = null, ?string $message = null) { $this->statusCode = $statusCode; $this->statusMessage = $message; diff --git a/src/LightSaml/Model/Protocol/StatusCode.php b/src/LightSaml/Model/Protocol/StatusCode.php index 7a72a01e..ac035fbb 100644 --- a/src/LightSaml/Model/Protocol/StatusCode.php +++ b/src/LightSaml/Model/Protocol/StatusCode.php @@ -27,7 +27,7 @@ class StatusCode extends AbstractSamlModel /** * @param string $value */ - public function __construct($value = null) + public function __construct(?string $value = null) { $this->value = $value; } diff --git a/src/LightSaml/Model/XmlDSig/SignatureStringReader.php b/src/LightSaml/Model/XmlDSig/SignatureStringReader.php index bb1a38fd..3dc058e5 100644 --- a/src/LightSaml/Model/XmlDSig/SignatureStringReader.php +++ b/src/LightSaml/Model/XmlDSig/SignatureStringReader.php @@ -32,7 +32,7 @@ class SignatureStringReader extends AbstractSignatureReader * @param string|null $algorithm * @param string|null $data */ - public function __construct($signature = null, $algorithm = null, $data = null) + public function __construct(?string $signature = null, ?string $algorithm = null, ?string $data = null) { $this->signature = $signature; $this->algorithm = $algorithm; diff --git a/src/LightSaml/Model/XmlDSig/SignatureWriter.php b/src/LightSaml/Model/XmlDSig/SignatureWriter.php index 69057707..3d1e5da2 100644 --- a/src/LightSaml/Model/XmlDSig/SignatureWriter.php +++ b/src/LightSaml/Model/XmlDSig/SignatureWriter.php @@ -59,7 +59,7 @@ public static function createByKeyAndCertificate(X509Certificate $certificate, X /** * @param string $digestAlgorithm */ - public function __construct(X509Certificate $certificate = null, XMLSecurityKey $xmlSecurityKey = null, $digestAlgorithm = XMLSecurityDSig::SHA1) + public function __construct(?X509Certificate $certificate = null, ?XMLSecurityKey $xmlSecurityKey = null, $digestAlgorithm = XMLSecurityDSig::SHA1) { $this->certificate = $certificate; $this->xmlSecurityKey = $xmlSecurityKey; diff --git a/src/LightSaml/Provider/NameID/FixedNameIdProvider.php b/src/LightSaml/Provider/NameID/FixedNameIdProvider.php index bed69511..efe121f8 100644 --- a/src/LightSaml/Provider/NameID/FixedNameIdProvider.php +++ b/src/LightSaml/Provider/NameID/FixedNameIdProvider.php @@ -19,7 +19,7 @@ class FixedNameIdProvider implements NameIdProviderInterface /** @var NameID|null */ protected $nameId; - public function __construct(NameID $nameId = null) + public function __construct(?NameID $nameId = null) { $this->nameId = $nameId; } @@ -27,7 +27,7 @@ public function __construct(NameID $nameId = null) /** * @return FixedNameIdProvider */ - public function setNameId(NameID $nameId = null) + public function setNameId(?NameID $nameId = null) { $this->nameId = $nameId; diff --git a/src/LightSaml/Provider/Session/FixedSessionInfoProvider.php b/src/LightSaml/Provider/Session/FixedSessionInfoProvider.php index 948551de..60c4dd42 100644 --- a/src/LightSaml/Provider/Session/FixedSessionInfoProvider.php +++ b/src/LightSaml/Provider/Session/FixedSessionInfoProvider.php @@ -23,11 +23,11 @@ class FixedSessionInfoProvider implements SessionInfoProviderInterface protected $authnContextClassRef; /** - * @param int $authnInstant - * @param string $sessionIndex - * @param string $authnContextClassRef + * @param int $authnInstant + * @param string|null $sessionIndex + * @param string|null $authnContextClassRef */ - public function __construct($authnInstant = 0, $sessionIndex = null, $authnContextClassRef = null) + public function __construct($authnInstant = 0, ?string $sessionIndex = null, ?string $authnContextClassRef = null) { $this->authnInstant = $authnInstant; $this->sessionIndex = $sessionIndex; diff --git a/src/LightSaml/State/Request/RequestState.php b/src/LightSaml/State/Request/RequestState.php index ca1e678c..edd64c62 100644 --- a/src/LightSaml/State/Request/RequestState.php +++ b/src/LightSaml/State/Request/RequestState.php @@ -25,7 +25,7 @@ class RequestState implements \Serializable * @param string $id * @param mixed $nonce */ - public function __construct($id = null, $nonce = null) + public function __construct(?string $id = null, mixed $nonce = null) { $this->id = $id; $this->parameters = new ParameterBag(); diff --git a/src/LightSaml/Store/Credential/Factory/CredentialFactory.php b/src/LightSaml/Store/Credential/Factory/CredentialFactory.php index ff5c6d54..8d91955d 100644 --- a/src/LightSaml/Store/Credential/Factory/CredentialFactory.php +++ b/src/LightSaml/Store/Credential/Factory/CredentialFactory.php @@ -45,7 +45,7 @@ public function buildFromOwnCredentialStore( EntityDescriptorStoreInterface $spEntityDescriptorStore, $ownEntityId, CredentialStoreInterface $ownCredentialStore, - array $extraCredentials = null + ?array $extraCredentials = null ) { return $this->build( $idpEntityDescriptorStore, @@ -65,7 +65,7 @@ public function build( EntityDescriptorStoreInterface $idpEntityDescriptorStore, EntityDescriptorStoreInterface $spEntityDescriptorStore, array $ownCredentials, - array $extraCredentials = null + ?array $extraCredentials = null ) { if (empty($ownCredentials)) { throw new LightSamlBuildException('There are no own credentials'); diff --git a/src/LightSaml/Store/TrustOptions/FixedTrustOptionsStore.php b/src/LightSaml/Store/TrustOptions/FixedTrustOptionsStore.php index 07230208..182394cc 100644 --- a/src/LightSaml/Store/TrustOptions/FixedTrustOptionsStore.php +++ b/src/LightSaml/Store/TrustOptions/FixedTrustOptionsStore.php @@ -19,9 +19,9 @@ class FixedTrustOptionsStore implements TrustOptionsStoreInterface protected $option; /** - * @param TrustOptions $option + * @param TrustOptions|null $option */ - public function __construct(TrustOptions $option = null) + public function __construct(?TrustOptions $option = null) { $this->option = $option; } @@ -29,7 +29,7 @@ public function __construct(TrustOptions $option = null) /** * @return FixedTrustOptionsStore */ - public function setTrustOptions(TrustOptions $trustOptions = null) + public function setTrustOptions(?TrustOptions $trustOptions = null) { $this->option = $trustOptions; diff --git a/tests/LightSaml/Tests/Action/Profile/Outbound/Message/AbstractResolveEndpointActionTest.php b/tests/LightSaml/Tests/Action/Profile/Outbound/Message/AbstractResolveEndpointActionTest.php index bf44e85a..13b70169 100644 --- a/tests/LightSaml/Tests/Action/Profile/Outbound/Message/AbstractResolveEndpointActionTest.php +++ b/tests/LightSaml/Tests/Action/Profile/Outbound/Message/AbstractResolveEndpointActionTest.php @@ -64,19 +64,19 @@ protected function setEndpointResolver($shouldBeCalled, $callback) } /** - * @param string $ownRole - * @param SamlMessage $inboundMessage - * @param Endpoint $endpoint - * @param EntityDescriptor $partyEntityDescriptor - * @param string $profileId + * @param string $ownRole + * @param SamlMessage|null $inboundMessage + * @param Endpoint|null $endpoint + * @param EntityDescriptor|null $partyEntityDescriptor + * @param string $profileId * * @return \LightSaml\Context\Profile\ProfileContext */ protected function createContext( $ownRole = ProfileContext::ROLE_IDP, - SamlMessage $inboundMessage = null, - Endpoint $endpoint = null, - EntityDescriptor $partyEntityDescriptor = null, + ?SamlMessage $inboundMessage = null, + ?Endpoint $endpoint = null, + ?EntityDescriptor $partyEntityDescriptor = null, $profileId = Profiles::SSO_IDP_RECEIVE_AUTHN_REQUEST ) { $context = $this->getProfileContext($profileId, $ownRole); diff --git a/tests/LightSaml/Tests/Context/Profile/Helper/MessageContextHelperTest.php b/tests/LightSaml/Tests/Context/Profile/Helper/MessageContextHelperTest.php index bdca5e67..8e4c941a 100644 --- a/tests/LightSaml/Tests/Context/Profile/Helper/MessageContextHelperTest.php +++ b/tests/LightSaml/Tests/Context/Profile/Helper/MessageContextHelperTest.php @@ -58,7 +58,7 @@ public function helperProvider() /** * @dataProvider helperProvider */ - public function test__helper($method, SamlMessage $message = null, $expectedException = null, $expectedMessage = null) + public function test__helper($method, ?SamlMessage $message = null, ?string $expectedException = null, ?string $expectedMessage = null) { $context = new MessageContext(); if ($message) { diff --git a/tests/LightSaml/Tests/Context/Profile/MessageContextTest.php b/tests/LightSaml/Tests/Context/Profile/MessageContextTest.php index f4951dc4..b455e131 100644 --- a/tests/LightSaml/Tests/Context/Profile/MessageContextTest.php +++ b/tests/LightSaml/Tests/Context/Profile/MessageContextTest.php @@ -32,7 +32,7 @@ public function message_as_concrete_type_provider() /** * @dataProvider message_as_concrete_type_provider */ - public function test_message_as_concrete_type($method, $hasValue, SamlMessage $message = null) + public function test_message_as_concrete_type($method, $hasValue, ?SamlMessage $message = null) { $context = new MessageContext(); if ($message) { diff --git a/tests/LightSaml/Tests/Fixtures/Meta/TimeProviderMock.php b/tests/LightSaml/Tests/Fixtures/Meta/TimeProviderMock.php index 156eb267..067a0b0a 100644 --- a/tests/LightSaml/Tests/Fixtures/Meta/TimeProviderMock.php +++ b/tests/LightSaml/Tests/Fixtures/Meta/TimeProviderMock.php @@ -10,9 +10,9 @@ class TimeProviderMock implements TimeProviderInterface protected $value; /** - * @param \DateTime $value + * @param \DateTime|null $value */ - public function __construct(\DateTime $value = null) + public function __construct(?\DateTime $value = null) { $this->value = $value; } diff --git a/tests/LightSaml/Tests/Functional/Bridge/Pimple/ProfileTest.php b/tests/LightSaml/Tests/Functional/Bridge/Pimple/ProfileTest.php index 9b81b7ca..f906653e 100644 --- a/tests/LightSaml/Tests/Functional/Bridge/Pimple/ProfileTest.php +++ b/tests/LightSaml/Tests/Functional/Bridge/Pimple/ProfileTest.php @@ -158,7 +158,7 @@ public function test_sp_entity_descriptor() $this->assertInstanceOf(\LightSaml\Store\EntityDescriptor\EntityDescriptorStoreInterface::class, $buildContainer->getPartyContainer()->getSpEntityDescriptorStore()); } - private function getBuildContainer($inResponseTo = null, TimeProviderInterface $timeProvider = null) + private function getBuildContainer(?string $inResponseTo = null, ?TimeProviderInterface $timeProvider = null) { $buildContainer = new BuildContainer($pimple = new Container()); diff --git a/tests/LightSaml/Tests/Helper/ContactPersonChecker.php b/tests/LightSaml/Tests/Helper/ContactPersonChecker.php index c74e0112..87e9ae24 100644 --- a/tests/LightSaml/Tests/Helper/ContactPersonChecker.php +++ b/tests/LightSaml/Tests/Helper/ContactPersonChecker.php @@ -15,7 +15,7 @@ public static function check( $surName, $email, $phone, - ContactPerson $contact = null + ?ContactPerson $contact = null ) { $test->assertNotNull($contact); $test->assertEquals($type, $contact->getContactType()); diff --git a/tests/LightSaml/Tests/Helper/EndpointChecker.php b/tests/LightSaml/Tests/Helper/EndpointChecker.php index 3877726c..cfd10238 100644 --- a/tests/LightSaml/Tests/Helper/EndpointChecker.php +++ b/tests/LightSaml/Tests/Helper/EndpointChecker.php @@ -7,7 +7,7 @@ class EndpointChecker { - public static function check(BaseTestCase $test, $binding, $location, Endpoint $svc = null) + public static function check(BaseTestCase $test, $binding, $location, ?Endpoint $svc = null) { $test->assertNotNull($svc); $test->assertEquals($binding, $svc->getBinding()); diff --git a/tests/LightSaml/Tests/Helper/IndexedEndpointChecker.php b/tests/LightSaml/Tests/Helper/IndexedEndpointChecker.php index 117bee86..1977b844 100644 --- a/tests/LightSaml/Tests/Helper/IndexedEndpointChecker.php +++ b/tests/LightSaml/Tests/Helper/IndexedEndpointChecker.php @@ -7,7 +7,7 @@ class IndexedEndpointChecker { - public static function check(BaseTestCase $test, $binding, $location, $index, $isDefault, IndexedEndpoint $svc = null) + public static function check(BaseTestCase $test, $binding, $location, $index, $isDefault, ?IndexedEndpoint $svc = null) { EndpointChecker::check($test, $binding, $location, $svc); $test->assertEquals($index, $svc->getIndex()); diff --git a/tests/LightSaml/Tests/Helper/KeyDescriptorChecker.php b/tests/LightSaml/Tests/Helper/KeyDescriptorChecker.php index d174c147..081ee15e 100644 --- a/tests/LightSaml/Tests/Helper/KeyDescriptorChecker.php +++ b/tests/LightSaml/Tests/Helper/KeyDescriptorChecker.php @@ -7,7 +7,7 @@ class KeyDescriptorChecker { - public static function checkCertificateCN(BaseTestCase $test, $use, $cn, KeyDescriptor $kd = null) + public static function checkCertificateCN(BaseTestCase $test, $use, $cn, ?KeyDescriptor $kd = null) { $test->assertNotNull($kd); $test->assertEquals($use, $kd->getUse()); diff --git a/tests/LightSaml/Tests/Helper/OrganizationChecker.php b/tests/LightSaml/Tests/Helper/OrganizationChecker.php index c5759a03..f8d13235 100644 --- a/tests/LightSaml/Tests/Helper/OrganizationChecker.php +++ b/tests/LightSaml/Tests/Helper/OrganizationChecker.php @@ -7,7 +7,7 @@ class OrganizationChecker { - public static function check(BaseTestCase $test, $name, $display, $url, Organization $organization = null) + public static function check(BaseTestCase $test, $name, $display, $url, ?Organization $organization = null) { $test->assertNotNull($organization); $test->assertEquals($name, $organization->getOrganizationName());