From 49d6254155a8919185b189087c441835d2fd98f9 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 19 Dec 2025 22:29:16 +0100 Subject: [PATCH 1/4] Restrict allowed attributes for scd --- src/XML/saml/AbstractSubjectConfirmationData.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/XML/saml/AbstractSubjectConfirmationData.php b/src/XML/saml/AbstractSubjectConfirmationData.php index 77d6c9293..7bd0b7723 100644 --- a/src/XML/saml/AbstractSubjectConfirmationData.php +++ b/src/XML/saml/AbstractSubjectConfirmationData.php @@ -41,6 +41,12 @@ abstract class AbstractSubjectConfirmationData extends AbstractAnyType /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** The exclusions for the xs:anyAttribute element */ + public const XS_ANY_ATTR_EXCLUSIONS = [ + ['urn:oasis:names:tc:SAML:2.0:assertion', '*'], + ['urn:oasis:names:tc:SAML:2.0:protocol', '*'], + ]; + /** * Initialize (and parse) a SubjectConfirmationData element. @@ -87,6 +93,14 @@ public function __construct( } $this->setElements($children); + + foreach ($namespacedAttributes as $attr) { + Assert::notNull( + $attr->getNamespaceURI(), + "Local (non-namespaced) attributes are not allowed.", + ProtocolViolationException::class, + ); + } $this->setAttributesNS($namespacedAttributes); } From a1fb12ef98554025a75ed13a36cae8594e765b76 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 19 Dec 2025 22:32:52 +0100 Subject: [PATCH 2/4] Bump minimum PHP-version --- .github/workflows/php.yml | 20 ++++++++++---------- composer.json | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d1f9dc5ba..d5d0b57fd 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,9 +19,9 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.2', '8.3', '8.4'] + php-version: ['8.3', '8.4', '8.5'] - uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.6 + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.11.0 with: php-version: ${{ matrix.php-version }} @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false - uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.10.6 + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.11.0 with: enable_eslinter: false enable_jsonlinter: true @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.2', '8.3', '8.4'] + php-versions: ['8.3', '8.4', '8.5'] steps: - name: Setup PHP, with composer and extensions @@ -85,15 +85,15 @@ jobs: run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Run unit tests with coverage - if: ${{ matrix.php-versions == '8.4' }} + if: ${{ matrix.php-versions == '8.5' }} run: vendor/bin/phpunit - name: Run unit tests (no coverage) - if: ${{ matrix.php-versions != '8.4' }} + if: ${{ matrix.php-versions != '8.5' }} run: vendor/bin/phpunit --no-coverage - name: Save coverage data - if: ${{ matrix.php-versions == '8.4' }} + if: ${{ matrix.php-versions == '8.5' }} uses: actions/upload-artifact@v6 with: name: coverage-data @@ -107,7 +107,7 @@ jobs: fail-fast: true matrix: operating-system: [windows-latest] - php-versions: ['8.2', '8.3', '8.4'] + php-versions: ['8.3', '8.4', '8.5'] steps: - name: Setup PHP, with composer and extensions @@ -161,7 +161,7 @@ jobs: uses: shivammathur/setup-php@v2 with: # Should be the higest supported version, so we can use the newest tools - php-version: '8.4' + php-version: '8.5' tools: composer, composer-require-checker, composer-unused extensions: ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml coverage: none @@ -215,7 +215,7 @@ jobs: uses: shivammathur/setup-php@v2 with: # Should be the lowest supported version - php-version: '8.2' + php-version: '8.3' extensions: ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml tools: composer coverage: none diff --git a/composer.json b/composer.json index 139c7c81a..f31f5c830 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": "^8.2", + "php": "^8.3", "ext-date": "*", "ext-dom": "*", "ext-filter": "*", @@ -29,18 +29,18 @@ "nyholm/psr7": "~1.8", "psr/clock": "~1.0", "psr/http-message": "~2.0", - "psr/log": "~2.3 || ~3.0", + "psr/log": "~3.0", "simplesamlphp/assert": "~1.9", - "simplesamlphp/xml-common": "~2.4", - "simplesamlphp/xml-security": "~2.0", - "simplesamlphp/xml-soap": "~2.0" + "simplesamlphp/xml-common": "~2.5", + "simplesamlphp/xml-security": "~2.1", + "simplesamlphp/xml-soap": "~2.1" }, "require-dev": { "ext-intl": "*", "beste/clock": "~3.0", "mockery/mockery": "~1.6", - "simplesamlphp/simplesamlphp-test-framework": "~1.10" + "simplesamlphp/simplesamlphp-test-framework": "~1.11" }, "suggest": { "ext-soap": "*" @@ -58,7 +58,7 @@ }, "extra": { "branch-alias": { - "dev-master": "v5.1.x-dev" + "dev-master": "v6.1.x-dev" } }, "config": { From 9c7417ecb2c23dc1a47d4b5cdce3a6cd96723272 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 19 Dec 2025 22:34:01 +0100 Subject: [PATCH 3/4] Add ext-intl + ext-sodium for composer-require-checker --- .github/workflows/php.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d5d0b57fd..92952639f 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -53,7 +53,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, spl, xml + extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, spl, sodium, xml tools: composer ini-values: error_reporting=E_ALL coverage: pcov @@ -115,7 +115,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, spl, xml + extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, sodium, spl, xml tools: composer ini-values: error_reporting=E_ALL coverage: none @@ -163,7 +163,7 @@ jobs: # Should be the higest supported version, so we can use the newest tools php-version: '8.5' tools: composer, composer-require-checker, composer-unused - extensions: ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml + extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, sodium, spl, xml coverage: none - name: Setup problem matchers for PHP @@ -216,7 +216,7 @@ jobs: with: # Should be the lowest supported version php-version: '8.3' - extensions: ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml + extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, sodium, spl, xml tools: composer coverage: none From cb5cde7e4d258bc98680c32fe9105dd460a47b5f Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sat, 20 Dec 2025 22:38:00 +0100 Subject: [PATCH 4/4] Migrate code to PHP 8.3 --- src/Binding/HTTPArtifact.php | 13 +- src/Binding/HTTPPost.php | 1 + src/Binding/HTTPRedirect.php | 1 + src/Binding/RelayStateInterface.php | 4 - src/Binding/RelayStateTrait.php | 6 - src/Binding/SOAP.php | 7 +- src/Certificate/Key.php | 13 +- src/Certificate/KeyCollection.php | 5 +- src/Certificate/KeyLoader.php | 13 +- src/Certificate/PrivateKeyLoader.php | 3 +- src/Certificate/X509.php | 2 - src/Compat/AbstractContainer.php | 18 +- src/Compat/MockContainer.php | 5 +- src/Configuration/ArrayAdapter.php | 3 - src/Configuration/CertificateProvider.php | 4 - src/Configuration/DecryptionProvider.php | 2 - src/Configuration/Destination.php | 4 - src/Configuration/EntityIdProvider.php | 1 - src/Configuration/IdentityProvider.php | 7 - src/Configuration/PrivateKey.php | 19 +- src/Configuration/Queryable.php | 4 - src/Configuration/ServiceProvider.php | 7 - src/Constants.php | 166 +++++++++--------- .../Protocol/AuthnFailedException.php | 2 +- .../InvalidAttrNameOrValueException.php | 2 +- .../Protocol/InvalidNameIDPolicyException.php | 2 +- .../Protocol/NoAuthnContextException.php | 2 +- .../Protocol/NoAvailableIDPException.php | 2 +- src/Exception/Protocol/NoPassiveException.php | 2 +- .../Protocol/NoSupportedIDPException.php | 2 +- .../Protocol/PartialLogoutException.php | 2 +- .../Protocol/ProxyCountExceededException.php | 2 +- .../Protocol/RequestDeniedException.php | 2 +- .../Protocol/RequestUnsupportedException.php | 2 +- .../RequestVersionDeprecatedException.php | 2 +- .../RequestVersionTooHighException.php | 2 +- .../RequestVersionTooLowException.php | 2 +- .../ResourceNotRecognizedException.php | 2 +- .../Protocol/TooManyResponsesException.php | 2 +- .../Protocol/UnknownAttrProfileException.php | 2 +- .../Protocol/UnknownPrincipalException.php | 2 +- .../Protocol/UnsupportedBindingException.php | 2 +- src/Exception/ProtocolViolationException.php | 1 - src/Response/Processor.php | 7 +- .../ConstraintValidator/IsSuccessful.php | 4 - src/Response/Validation/Result.php | 2 - src/Signature/AbstractChainedValidator.php | 2 - src/Signature/ChainedValidator.php | 2 - src/Signature/PublicKeyValidator.php | 4 - src/Signature/Validator.php | 2 - src/Signature/ValidatorChain.php | 2 - src/Signature/ValidatorInterface.php | 2 - src/Type/AuthnContextComparisonTypeValue.php | 6 +- src/Type/CIDRValue.php | 4 - src/Type/DecisionTypeValue.php | 6 +- src/Type/DomainValue.php | 4 - src/Type/EmailAddressValue.php | 4 - src/Type/EntityIDValue.php | 12 +- src/Type/GeolocationValue.php | 5 - src/Type/KeyTypesValue.php | 2 - src/Type/ListOfStringsValue.php | 14 +- src/Type/SAMLAnyURIListValue.php | 7 +- src/Type/SAMLAnyURIValue.php | 3 - src/Type/SAMLDateTimeValue.php | 5 +- src/Type/SAMLStringValue.php | 3 - src/Utilities/ArrayCollection.php | 9 +- src/Utilities/Collection.php | 1 - src/Utilities/File.php | 2 - src/Utils/Random.php | 5 +- src/XML/EncryptableElementTrait.php | 3 + src/XML/EncryptedElementTrait.php | 6 + src/XML/ExtensionsTrait.php | 3 - src/XML/IdentifierTrait.php | 1 - src/XML/SignableElementTrait.php | 3 + src/XML/SignedElementTrait.php | 3 + src/XML/alg/AbstractAlgElement.php | 9 +- src/XML/alg/DigestMethod.php | 5 +- src/XML/alg/SigningMethod.php | 6 +- src/XML/ecp/AbstractEcpElement.php | 9 +- src/XML/ecp/RelayState.php | 5 +- src/XML/ecp/Request.php | 2 - src/XML/ecp/RequestAuthenticated.php | 2 - src/XML/ecp/Response.php | 2 - src/XML/ecp/SubjectConfirmation.php | 2 - src/XML/emd/AbstractEmdElement.php | 9 +- src/XML/emd/RepublishRequest.php | 7 +- src/XML/emd/RepublishTarget.php | 3 +- src/XML/idpdisc/DiscoveryResponse.php | 9 +- src/XML/init/RequestInitiator.php | 11 +- src/XML/md/AbstractEndpointType.php | 39 +++- src/XML/md/AbstractIndexedEndpointType.php | 42 ++++- src/XML/md/AbstractLocalizedName.php | 13 +- src/XML/md/AbstractLocalizedURI.php | 9 +- src/XML/md/AbstractMdElement.php | 9 +- src/XML/md/AbstractMetadataDocument.php | 4 - src/XML/md/AbstractRoleDescriptor.php | 5 +- src/XML/md/AbstractRoleDescriptorType.php | 5 +- src/XML/md/AbstractSSODescriptor.php | 3 - src/XML/md/AbstractSignedMdElement.php | 10 -- src/XML/md/AdditionalMetadataLocation.php | 6 - src/XML/md/AffiliateMember.php | 3 +- src/XML/md/AffiliationDescriptor.php | 7 +- src/XML/md/ArtifactResolutionService.php | 2 +- src/XML/md/AttributeAuthorityDescriptor.php | 5 - src/XML/md/AttributeConsumingService.php | 72 ++++---- src/XML/md/AttributeProfile.php | 3 +- src/XML/md/AuthnAuthorityDescriptor.php | 10 +- src/XML/md/Company.php | 3 +- src/XML/md/ContactPerson.php | 60 +++++-- src/XML/md/EmailAddress.php | 16 +- src/XML/md/EncryptionMethod.php | 9 +- src/XML/md/EntitiesDescriptor.php | 5 - src/XML/md/EntityDescriptor.php | 7 +- src/XML/md/Extensions.php | 3 - src/XML/md/GivenName.php | 3 +- src/XML/md/IDPSSODescriptor.php | 5 - src/XML/md/KeyDescriptor.php | 6 - src/XML/md/NameIDFormat.php | 3 +- src/XML/md/NameIDMappingService.php | 9 +- src/XML/md/Organization.php | 41 +++-- src/XML/md/PDPDescriptor.php | 5 - src/XML/md/RequestedAttribute.php | 15 +- src/XML/md/SPSSODescriptor.php | 5 - src/XML/md/SurName.php | 3 +- src/XML/md/TelephoneNumber.php | 8 +- src/XML/md/UnknownRoleDescriptor.php | 5 +- src/XML/mdattr/AbstractMdattrElement.php | 9 +- src/XML/mdattr/EntityAttributes.php | 9 +- src/XML/mdrpi/AbstractMdrpiElement.php | 9 +- src/XML/mdrpi/Publication.php | 31 ++-- src/XML/mdrpi/PublicationInfo.php | 35 ++-- src/XML/mdrpi/PublicationPath.php | 11 +- src/XML/mdrpi/RegistrationInfo.php | 32 ++-- src/XML/mdrpi/RegistrationPolicy.php | 6 +- src/XML/mdrpi/UsagePolicy.php | 6 +- src/XML/mdui/AbstractMduiElement.php | 9 +- src/XML/mdui/Description.php | 6 +- src/XML/mdui/DiscoHints.php | 47 +++-- src/XML/mdui/DisplayName.php | 6 +- src/XML/mdui/DomainHint.php | 3 +- src/XML/mdui/GeolocationHint.php | 3 +- src/XML/mdui/IPHint.php | 3 +- src/XML/mdui/InformationURL.php | 6 +- src/XML/mdui/Keywords.php | 13 +- src/XML/mdui/Logo.php | 41 +++-- src/XML/mdui/PrivacyStatementURL.php | 6 +- src/XML/mdui/UIInfo.php | 70 +++++--- src/XML/saml/AbstractBaseID.php | 12 +- src/XML/saml/AbstractBaseIDType.php | 3 - src/XML/saml/AbstractCondition.php | 9 +- src/XML/saml/AbstractSamlElement.php | 9 +- src/XML/saml/AbstractStatement.php | 9 +- .../saml/AbstractSubjectConfirmationData.php | 26 ++- src/XML/saml/Action.php | 12 +- src/XML/saml/Advice.php | 12 +- src/XML/saml/Assertion.php | 22 +-- src/XML/saml/AssertionIDRef.php | 3 +- src/XML/saml/AssertionURIRef.php | 3 +- src/XML/saml/Attribute.php | 13 +- src/XML/saml/AttributeStatement.php | 7 - src/XML/saml/AttributeValue.php | 16 -- src/XML/saml/Audience.php | 3 +- src/XML/saml/AudienceRestriction.php | 6 - src/XML/saml/AuthenticatingAuthority.php | 3 +- src/XML/saml/AuthnContext.php | 6 - src/XML/saml/AuthnContextClassRef.php | 3 +- src/XML/saml/AuthnContextDecl.php | 12 +- src/XML/saml/AuthnContextDeclRef.php | 3 +- src/XML/saml/AuthnStatement.php | 6 - src/XML/saml/AuthzDecisionStatement.php | 6 - src/XML/saml/Conditions.php | 8 - src/XML/saml/Evidence.php | 8 - src/XML/saml/NameID.php | 36 +++- src/XML/saml/NameIDType.php | 9 +- src/XML/saml/OneTimeUse.php | 6 - src/XML/saml/ProxyRestriction.php | 6 - src/XML/saml/Subject.php | 6 - src/XML/saml/SubjectConfirmation.php | 6 - src/XML/saml/SubjectConfirmationData.php | 3 - src/XML/saml/SubjectLocality.php | 8 - src/XML/saml/UnknownCondition.php | 3 - src/XML/saml/UnknownID.php | 3 - src/XML/saml/UnknownStatement.php | 3 - src/XML/samlp/AbstractMessage.php | 20 --- src/XML/samlp/AbstractSamlpElement.php | 9 +- src/XML/samlp/AbstractStatusResponse.php | 2 - src/XML/samlp/AbstractSubjectQuery.php | 2 - src/XML/samlp/Artifact.php | 3 +- src/XML/samlp/ArtifactResolve.php | 5 - src/XML/samlp/ArtifactResponse.php | 5 - src/XML/samlp/AssertionIDRequest.php | 6 - src/XML/samlp/AttributeQuery.php | 5 - src/XML/samlp/AuthnQuery.php | 5 - src/XML/samlp/AuthnRequest.php | 6 +- src/XML/samlp/AuthzDecisionQuery.php | 7 +- src/XML/samlp/Extensions.php | 3 - src/XML/samlp/GetComplete.php | 8 +- src/XML/samlp/IDPEntry.php | 31 ++-- src/XML/samlp/IDPList.php | 27 +-- src/XML/samlp/LogoutRequest.php | 6 +- src/XML/samlp/LogoutResponse.php | 3 - src/XML/samlp/MessageFactory.php | 3 - src/XML/samlp/NameIDPolicy.php | 33 ++-- src/XML/samlp/NewEncryptedID.php | 9 +- src/XML/samlp/NewID.php | 3 +- src/XML/samlp/RequestedAuthnContext.php | 3 - src/XML/samlp/RequesterID.php | 8 +- src/XML/samlp/Response.php | 5 - src/XML/samlp/Scoping.php | 8 - src/XML/samlp/SessionIndex.php | 3 +- src/XML/samlp/Status.php | 6 - src/XML/samlp/StatusCode.php | 6 - src/XML/samlp/StatusDetail.php | 12 +- src/XML/samlp/StatusMessage.php | 3 +- src/XML/samlp/Terminate.php | 6 - src/XML/shibmd/AbstractShibmdElement.php | 9 +- src/XML/shibmd/KeyAuthority.php | 8 +- src/XML/shibmd/Scope.php | 9 +- .../NameIdDecryptionTransformerTest.php | 3 +- tests/SAML2/Constants.php | 30 ++-- tests/SAML2/CustomBaseID.php | 12 +- tests/SAML2/CustomCondition.php | 15 +- tests/SAML2/CustomRoleDescriptor.php | 19 +- tests/SAML2/CustomStatement.php | 15 +- tests/SAML2/XML/md/ContactPersonTest.php | 4 - tests/SAML2/XML/md/EncryptionMethodTest.php | 2 + tests/SAML2/XML/md/EndpointTypeTest.php | 1 - tests/SAML2/XML/mdui/LogoTest.php | 6 +- tests/SAML2/XML/saml/AssertionTest.php | 12 +- .../GoldenSAMLResponseTest.php | 7 +- 230 files changed, 804 insertions(+), 1303 deletions(-) diff --git a/src/Binding/HTTPArtifact.php b/src/Binding/HTTPArtifact.php index ed8be8d3a..4b55d523d 100644 --- a/src/Binding/HTTPArtifact.php +++ b/src/Binding/HTTPArtifact.php @@ -48,8 +48,6 @@ class HTTPArtifact extends Binding implements AsynchronousBindingInterface, Rela /** - * @psalm-suppress UndefinedDocblockClass - * @psalm-suppress UndefinedClass * @var \SimpleSAML\Configuration */ private Configuration $spMetadata; @@ -58,16 +56,15 @@ class HTTPArtifact extends Binding implements AsynchronousBindingInterface, Rela /** * Create the redirect URL for a message. * - * @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message The message. + * @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message The message. + * @return string The URL the user should be redirected to in order to send a message. + * * @throws \Exception - * @return string The URL the user should be redirected to in order to send a message. */ public function getRedirectURL(AbstractMessage $message): string { - /** @psalm-suppress UndefinedClass */ $config = Configuration::getInstance(); - /** @psalm-suppress UndefinedClass */ $store = StoreFactory::getInstance($config->getString('store.type')); if ($store === false) { throw new Exception('Unable to send artifact without a datastore configured.'); @@ -97,7 +94,6 @@ public function getRedirectURL(AbstractMessage $message): string $params['RelayState'] = $relayState; } - /** @psalm-suppress UndefinedClass */ $httpUtils = new HTTP(); return $httpUtils->addURLparameters($destination, $params); } @@ -211,8 +207,6 @@ public function receive(ServerRequestInterface $request): AbstractMessage /** * @param \SimpleSAML\Configuration $sp - * - * @psalm-suppress UndefinedClass */ public function setSPMetadata(Configuration $sp): void { @@ -225,7 +219,6 @@ public function setSPMetadata(Configuration $sp): void * * @param \SimpleSAML\SAML2\XML\samlp\ArtifactResponse $message * @param \SimpleSAML\XMLSecurity\XMLSecurityKey $key - * @return bool */ public static function validateSignature(ArtifactResponse $message, XMLSecurityKey $key): bool { diff --git a/src/Binding/HTTPPost.php b/src/Binding/HTTPPost.php index 136c913c8..51281d7ca 100644 --- a/src/Binding/HTTPPost.php +++ b/src/Binding/HTTPPost.php @@ -82,6 +82,7 @@ public function send(AbstractMessage $message): ResponseInterface * * @param \Psr\Http\Message\ServerRequestInterface $request * @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The received message. + * * @throws \Exception */ public function receive(ServerRequestInterface $request): AbstractMessage diff --git a/src/Binding/HTTPRedirect.php b/src/Binding/HTTPRedirect.php index 998315784..0cf966582 100644 --- a/src/Binding/HTTPRedirect.php +++ b/src/Binding/HTTPRedirect.php @@ -126,6 +126,7 @@ public function send(AbstractMessage $message): ResponseInterface * * @param \Psr\Http\Message\ServerRequestInterface $request * @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The received message. + * * @throws \Exception * * NPath is currently too high but solving that just moves code around. diff --git a/src/Binding/RelayStateInterface.php b/src/Binding/RelayStateInterface.php index 2c1d3b016..7db975491 100644 --- a/src/Binding/RelayStateInterface.php +++ b/src/Binding/RelayStateInterface.php @@ -13,16 +13,12 @@ interface RelayStateInterface { /** * Set the RelayState associated with he message. - * - * @param string|null $relayState The RelayState. */ public function setRelayState(?string $relayState = null): void; /** * Get the RelayState associated with the message. - * - * @return string|null The RelayState. */ public function getRelayState(): ?string; } diff --git a/src/Binding/RelayStateTrait.php b/src/Binding/RelayStateTrait.php index d5af43883..cf3a736d5 100644 --- a/src/Binding/RelayStateTrait.php +++ b/src/Binding/RelayStateTrait.php @@ -15,16 +15,12 @@ trait RelayStateTrait { /** * The relay state. - * - * @var string|null */ protected ?string $relayState = null; /** * Set the RelayState associated with he message. - * - * @param string|null $relayState The RelayState. */ public function setRelayState(?string $relayState = null): void { @@ -35,8 +31,6 @@ public function setRelayState(?string $relayState = null): void /** * Get the RelayState associated with the message. - * - * @return string|null The RelayState. */ public function getRelayState(): ?string { diff --git a/src/Binding/SOAP.php b/src/Binding/SOAP.php index 4bf651a23..1afd02c71 100644 --- a/src/Binding/SOAP.php +++ b/src/Binding/SOAP.php @@ -35,10 +35,11 @@ class SOAP extends Binding implements SynchronousBindingInterface { /** * @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message - * @throws \Exception * @return string|false The XML or false on error + * + * @throws \Exception */ - public function getOutputToSend(AbstractMessage $message) + public function getOutputToSend(AbstractMessage $message): string|false { $header = new Header(); @@ -113,7 +114,7 @@ public function receive(/** @scrutinizer ignore-unused */ServerRequestInterface /** * @return string|false */ - protected function getInputStream() + protected function getInputStream(): string|false { return file_get_contents('php://input'); } diff --git a/src/Certificate/Key.php b/src/Certificate/Key.php index 486e85d8a..0eac84e45 100644 --- a/src/Certificate/Key.php +++ b/src/Certificate/Key.php @@ -19,9 +19,9 @@ class Key implements ArrayAccess { // Possible key usages - public const USAGE_SIGNING = 'signing'; + public const string USAGE_SIGNING = 'signing'; - public const USAGE_ENCRYPTION = 'encryption'; + public const string USAGE_ENCRYPTION = 'encryption'; /** @var array */ @@ -43,8 +43,6 @@ public function __construct(array $keyData) /** * Whether or not the key is configured to be used for usage given * - * @param string $usage - * @return bool * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException */ public function canBeUsedFor(string $usage): bool @@ -62,8 +60,8 @@ public function canBeUsedFor(string $usage): bool /** * @param mixed $offset + * * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException - * @return bool */ public function offsetExists(mixed $offset): bool { @@ -75,9 +73,7 @@ public function offsetExists(mixed $offset): bool /** - * @param mixed $offset * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException - * @return mixed */ public function offsetGet($offset): mixed { @@ -89,8 +85,6 @@ public function offsetGet($offset): mixed /** - * @param mixed $offset - * @param mixed $value * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException */ public function offsetSet(mixed $offset, mixed $value): void @@ -103,7 +97,6 @@ public function offsetSet(mixed $offset, mixed $value): void /** - * @param mixed $offset * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException */ public function offsetUnset(mixed $offset): void diff --git a/src/Certificate/KeyCollection.php b/src/Certificate/KeyCollection.php index f5331c3b3..2a8c8c62f 100644 --- a/src/Certificate/KeyCollection.php +++ b/src/Certificate/KeyCollection.php @@ -16,14 +16,11 @@ class KeyCollection extends ArrayCollection * Add a key to the collection * * @param \SimpleSAML\SAML2\Certificate\Key $element - * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false * - * Type hint not possible due to upstream method signature - * @psalm-suppress MoreSpecificImplementedParamType + * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false */ public function add($element): void { - /** @psalm-suppress RedundantConditionGivenDocblockType */ Assert::isInstanceOf($element, Key::class); parent::add($element); } diff --git a/src/Certificate/KeyLoader.php b/src/Certificate/KeyLoader.php index 444e33b64..48d727b8c 100644 --- a/src/Certificate/KeyLoader.php +++ b/src/Certificate/KeyLoader.php @@ -10,6 +10,7 @@ use SimpleSAML\SAML2\Configuration\CertificateProvider; use SimpleSAML\SAML2\Utilities\File; use SimpleSAML\XMLSecurity\Utils\Certificate; +use Traversable; use function count; use function preg_match; @@ -40,8 +41,6 @@ public function __construct() * Prioritisation order is keys > certData > certificate * * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $config - * @param string|null $usage - * @param bool $required * @return \SimpleSAML\SAML2\Certificate\KeyCollection */ public static function extractPublicKeys( @@ -57,8 +56,6 @@ public static function extractPublicKeys( /** * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $config - * @param null|string $usage - * @param bool $required * @return \SimpleSAML\SAML2\Certificate\KeyCollection */ public function loadKeysFromConfiguration( @@ -92,11 +89,8 @@ public function loadKeysFromConfiguration( /** * Loads the keys given, optionally excluding keys when a usage is given and they * are not configured to be used with the usage given - * - * @param array|\Traversable $configuredKeys - * @param string|null $usage */ - public function loadKeys($configuredKeys, ?string $usage = null): void + public function loadKeys(array|Traversable $configuredKeys, ?string $usage = null): void { foreach ($configuredKeys as $keyData) { if (isset($keyData['X509Certificate'])) { @@ -116,8 +110,6 @@ public function loadKeys($configuredKeys, ?string $usage = null): void /** * Attempts to load a key based on the given certificateData - * - * @param string $certificateData */ public function loadCertificateData(string $certificateData): void { @@ -156,7 +148,6 @@ public function getKeys(): KeyCollection /** - * @return bool */ public function hasKeys(): bool { diff --git a/src/Certificate/PrivateKeyLoader.php b/src/Certificate/PrivateKeyLoader.php index a1b1d5378..c621d09fa 100644 --- a/src/Certificate/PrivateKeyLoader.php +++ b/src/Certificate/PrivateKeyLoader.php @@ -30,8 +30,9 @@ public function loadPrivateKey(PrivateKeyConfiguration $key): PrivateKey /** * @param \SimpleSAML\SAML2\Configuration\DecryptionProvider $identityProvider * @param \SimpleSAML\SAML2\Configuration\DecryptionProvider $serviceProvider - * @throws \Exception * @return \SimpleSAML\SAML2\Utilities\ArrayCollection + * + * @throws \Exception */ public function loadDecryptionKeys( DecryptionProvider $identityProvider, diff --git a/src/Certificate/X509.php b/src/Certificate/X509.php index 53b382e9d..6ac24bcbe 100644 --- a/src/Certificate/X509.php +++ b/src/Certificate/X509.php @@ -49,8 +49,6 @@ public function offsetSet($offset, $value): void /** * Get the certificate representation - * - * @return string */ public function getCertificate(): string { diff --git a/src/Compat/AbstractContainer.php b/src/Compat/AbstractContainer.php index 1e7660df7..931c65f80 100644 --- a/src/Compat/AbstractContainer.php +++ b/src/Compat/AbstractContainer.php @@ -50,7 +50,6 @@ public function getBlacklistedEncryptionAlgorithms(): ?array * Register a class that can handle a given element. * * @param string $class The class name of a class extending AbstractElement - * @psalm-param class-string $class */ public function registerElementHandler(string $class): void { @@ -64,7 +63,6 @@ public function registerElementHandler(string $class): void * Register a class that can handle given extension points of the standard. * * @param string $class The class name of a class extending AbstractElement or implementing ExtensionPointInterface. - * @psalm-param class-string $class */ public function registerExtensionHandler(string $class): void { @@ -83,8 +81,7 @@ public function registerExtensionHandler(string $class): void * @param \SimpleSAML\XMLSchema\Type\QNameValue $qName The qualified name of the element. * * @return string|null The fully-qualified name of a class extending \SimpleSAML\XML\AbstractElement and - * implementing support for the given element, or null if no such class has been registered before. - * @psalm-return class-string|null + * implementing support for the given element, or null if no such class has been registered before. */ public function getElementHandler(QNameValue $qName): ?string { @@ -106,8 +103,7 @@ public function getElementHandler(QNameValue $qName): ?string * * @param \SimpleSAML\XMLSchema\Type\QNameValue $qName The qualified name of the extension. * @return string|null The fully-qualified name of a class implementing - * \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface or null if no such class has been registered before. - * @psalm-return class-string|null + * \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface or null if no such class has been registered before. */ public function getExtensionHandler(QNameValue $qName): ?string { @@ -125,7 +121,7 @@ public function getExtensionHandler(QNameValue $qName): ?string * Set the list of algorithms that are blacklisted for any encryption operation. * * @param string[]|null $algos An array with all algorithm identifiers that are blacklisted, - * or null if we want to use the defaults. + * or null if we want to use the defaults. */ abstract public function setBlacklistedAlgorithms(?array $algos): void; @@ -147,17 +143,12 @@ abstract public function getLogger(): LoggerInterface; * - **decrypt** XML that was just decrypted * * @param \DOMElement|string $message - * @param string $type */ abstract public function debugMessage($message, string $type): void; /** * Trigger the user to perform a POST to the given URL with the given data. - * - * @param string $url - * @param array $data - * @return string */ abstract public function getPOSTRedirectURL(string $url, array $data = []): string; @@ -165,9 +156,10 @@ abstract public function getPOSTRedirectURL(string $url, array $data = []): stri /** * This function retrieves the path to a directory where temporary files can be saved. * + * @return string Path to a temporary directory, without a trailing directory separator. + * * @throws \Exception If the temporary directory cannot be created or it exists and does not belong * to the current user. - * @return string Path to a temporary directory, without a trailing directory separator. */ abstract public function getTempDir(): string; diff --git a/src/Compat/MockContainer.php b/src/Compat/MockContainer.php index 4806f811d..788c7a878 100644 --- a/src/Compat/MockContainer.php +++ b/src/Compat/MockContainer.php @@ -27,6 +27,7 @@ class MockContainer extends AbstractContainer /** * Get a PSR-3 compatible logger. + * * @return \Psr\Log\LoggerInterface */ public function getLogger(): LoggerInterface @@ -45,7 +46,6 @@ public function getLogger(): LoggerInterface * - **decrypt** XML that was just decrypted * * @param \DOMElement|string $message - * @param string $type */ public function debugMessage($message, string $type): void { @@ -58,7 +58,6 @@ public function debugMessage($message, string $type): void * * @param string|null $url * @param array $data - * @return string */ public function getPOSTRedirectURL( /** @scrutinizer ignore-unused */?string $url = null, @@ -69,7 +68,6 @@ public function getPOSTRedirectURL( /** - * @return string */ public function getTempDir(): string { @@ -105,7 +103,6 @@ public function setBlacklistedAlgorithms(?array $algos): void * Set the system clock * * @param \Psr\Clock\ClockInterface $clock - * @return void */ public function setClock(ClockInterface $clock): void { diff --git a/src/Configuration/ArrayAdapter.php b/src/Configuration/ArrayAdapter.php index 0f6a98777..4d85dee82 100644 --- a/src/Configuration/ArrayAdapter.php +++ b/src/Configuration/ArrayAdapter.php @@ -21,7 +21,6 @@ public function __construct( /** - * @param string $key * @param mixed|null $defaultValue * @return mixed */ @@ -36,8 +35,6 @@ public function get(string $key, $defaultValue = null) /** - * @param string $key - * @return bool */ public function has(string $key): bool { diff --git a/src/Configuration/CertificateProvider.php b/src/Configuration/CertificateProvider.php index e90f69623..f1149c5da 100644 --- a/src/Configuration/CertificateProvider.php +++ b/src/Configuration/CertificateProvider.php @@ -22,16 +22,12 @@ public function getKeys(); /** * Returns the contents of an X509 pem certificate, without the '-----BEGIN CERTIFICATE-----' and * '-----END CERTIFICATE-----'. - * - * @return null|string */ public function getCertificateData(): ?string; /** * Returns the full path to the (local) file that contains the X509 pem certificate. - * - * @return null|string */ public function getCertificateFile(): ?string; } diff --git a/src/Configuration/DecryptionProvider.php b/src/Configuration/DecryptionProvider.php index 628bcfa9e..275caf16a 100644 --- a/src/Configuration/DecryptionProvider.php +++ b/src/Configuration/DecryptionProvider.php @@ -7,13 +7,11 @@ interface DecryptionProvider { /** - * @return null|bool */ public function isAssertionEncryptionRequired(): ?bool; /** - * @return null|string */ public function getSharedKey(): ?string; diff --git a/src/Configuration/Destination.php b/src/Configuration/Destination.php index 3f1d41e57..75770dcc4 100644 --- a/src/Configuration/Destination.php +++ b/src/Configuration/Destination.php @@ -12,7 +12,6 @@ class Destination implements Stringable { /** - * @param string $destination */ public function __construct( private string $destination, @@ -22,8 +21,6 @@ public function __construct( /** * @param \SimpleSAML\SAML2\Configuration\Destination $otherDestination - * - * @return bool */ public function equals(Destination $otherDestination): bool { @@ -32,7 +29,6 @@ public function equals(Destination $otherDestination): bool /** - * @return string */ public function __toString(): string { diff --git a/src/Configuration/EntityIdProvider.php b/src/Configuration/EntityIdProvider.php index 537b5dd1e..4880985c6 100644 --- a/src/Configuration/EntityIdProvider.php +++ b/src/Configuration/EntityIdProvider.php @@ -10,7 +10,6 @@ interface EntityIdProvider { /** - * @return null|string */ public function getEntityId(): ?string; } diff --git a/src/Configuration/IdentityProvider.php b/src/Configuration/IdentityProvider.php index 2918995f0..7c8dd4a3d 100644 --- a/src/Configuration/IdentityProvider.php +++ b/src/Configuration/IdentityProvider.php @@ -27,7 +27,6 @@ public function getKeys() /** - * @return string|null */ public function getCertificateData(): ?string { @@ -36,7 +35,6 @@ public function getCertificateData(): ?string /** - * @return string|null */ public function getCertificateFile(): ?string { @@ -54,7 +52,6 @@ public function getCertificateFingerprints() /** - * @return bool|null */ public function isAssertionEncryptionRequired(): ?bool { @@ -63,7 +60,6 @@ public function isAssertionEncryptionRequired(): ?bool /** - * @return string|null */ public function getSharedKey(): ?string { @@ -72,8 +68,6 @@ public function getSharedKey(): ?string /** - * @param string $name - * @param bool $required * @return mixed|null */ public function getPrivateKey(string $name, ?bool $required = null) @@ -114,7 +108,6 @@ public function getBlacklistedAlgorithms(): ?array /** - * @return string|null */ public function getEntityId(): ?string { diff --git a/src/Configuration/PrivateKey.php b/src/Configuration/PrivateKey.php index 1707bbe01..01e2f73f5 100644 --- a/src/Configuration/PrivateKey.php +++ b/src/Configuration/PrivateKey.php @@ -11,20 +11,13 @@ */ class PrivateKey extends ArrayAdapter { - /** @var string */ - public const NAME_NEW = 'new'; + public const string NAME_NEW = 'new'; - /** @var string */ - public const NAME_DEFAULT = 'default'; + public const string NAME_DEFAULT = 'default'; /** * Constructor for PrivateKey. - * - * @param string $filePathOrContents - * @param string $name - * @param string $passphrase - * @param bool $isFile */ public function __construct( private string $filePathOrContents, @@ -36,8 +29,6 @@ public function __construct( /** - * @return string - * * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false */ public function getFilePath(): string @@ -49,7 +40,6 @@ public function getFilePath(): string /** - * @return bool */ public function hasPassPhrase(): bool { @@ -58,7 +48,6 @@ public function hasPassPhrase(): bool /** - * @return string */ public function getPassPhrase(): string { @@ -67,7 +56,6 @@ public function getPassPhrase(): string /** - * @return string */ public function getName(): string { @@ -76,8 +64,6 @@ public function getName(): string /** - * @return string - * * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false */ public function getContents(): string @@ -89,7 +75,6 @@ public function getContents(): string /** - * @return bool */ public function isFile(): bool { diff --git a/src/Configuration/Queryable.php b/src/Configuration/Queryable.php index a63e4d64b..94ad5dd1f 100644 --- a/src/Configuration/Queryable.php +++ b/src/Configuration/Queryable.php @@ -11,9 +11,6 @@ interface Queryable { /** * Query for whether or not the configuration has a value for the key - * - * @param string $key - * @return bool */ public function has(string $key): bool; @@ -22,7 +19,6 @@ public function has(string $key): bool; * Query to get the value in the configuration for the given key. If no value is present the default value is * returned * - * @param string $key * @param null|mixed $defaultValue * * @return mixed diff --git a/src/Configuration/ServiceProvider.php b/src/Configuration/ServiceProvider.php index 352562e22..ab4e2e255 100644 --- a/src/Configuration/ServiceProvider.php +++ b/src/Configuration/ServiceProvider.php @@ -27,7 +27,6 @@ public function getKeys() /** - * @return null|string */ public function getCertificateData(): ?string { @@ -36,7 +35,6 @@ public function getCertificateData(): ?string /** - * @return null|string */ public function getCertificateFile(): ?string { @@ -54,7 +52,6 @@ public function getCertificateFingerprints() /** - * @return string|null */ public function getEntityId(): ?string { @@ -63,7 +60,6 @@ public function getEntityId(): ?string /** - * @return null|bool */ public function isAssertionEncryptionRequired(): ?bool { @@ -72,7 +68,6 @@ public function isAssertionEncryptionRequired(): ?bool /** - * @return null|string */ public function getSharedKey(): ?string { @@ -81,8 +76,6 @@ public function getSharedKey(): ?string /** - * @param string $name - * @param bool $required * @return mixed|null */ public function getPrivateKey(string $name, ?bool $required = null) diff --git a/src/Constants.php b/src/Constants.php index c55b419ec..d20fe8a22 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -14,98 +14,99 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants /** * Password authentication context. */ - public const AC_PASSWORD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password'; + public const string AC_PASSWORD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password'; /** * PasswordProtectedTransport authentication context. */ - public const AC_PASSWORD_PROTECTED_TRANSPORT = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'; + public const string AC_PASSWORD_PROTECTED_TRANSPORT = + 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'; /** * Unspecified authentication context. */ - public const AC_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified'; + public const string AC_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified'; /** * Pairwise identifier attribute */ - public const ATTR_PAIRWISE_ID = 'urn:oasis:names:tc:SAML:attribute:pairwise-id'; + public const string ATTR_PAIRWISE_ID = 'urn:oasis:names:tc:SAML:attribute:pairwise-id'; /** * Subject identifier attribute */ - public const ATTR_SUBJECT_ID = 'urn:oasis:names:tc:SAML:attribute:subject-id'; + public const string ATTR_SUBJECT_ID = 'urn:oasis:names:tc:SAML:attribute:subject-id'; /** * Subject signal attribute */ - public const PROFILE_SUBJECT_ID_REQ = 'urn:oasis:names:tc:SAML:profiles:subject-id:req'; + public const string PROFILE_SUBJECT_ID_REQ = 'urn:oasis:names:tc:SAML:profiles:subject-id:req'; /** * The URN for the Holder-of-Key Web Browser SSO Profile binding */ - public const BINDING_HOK_SSO = 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'; + public const string BINDING_HOK_SSO = 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'; /** * The URN for the HTTP-ARTIFACT binding. */ - public const BINDING_HTTP_ARTIFACT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'; + public const string BINDING_HTTP_ARTIFACT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'; /** * The URN for the HTTP-POST binding. */ - public const BINDING_HTTP_POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'; + public const string BINDING_HTTP_POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'; /** * The URN for the HTTP-Redirect binding. */ - public const BINDING_HTTP_REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'; + public const string BINDING_HTTP_REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'; /** * The URN for the DEFLATE url encoding */ - public const BINDING_HTTP_REDIRECT_DEFLATE = 'urn:oasis:names:tc:SAML:2.0:bindings:URL-Encoding:DEFLATE'; + public const string BINDING_HTTP_REDIRECT_DEFLATE = 'urn:oasis:names:tc:SAML:2.0:bindings:URL-Encoding:DEFLATE'; /* * The URN for the IdP Discovery Protocol binding */ - public const BINDING_IDPDISC = 'urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol'; + public const string BINDING_IDPDISC = 'urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol'; /** * The URN for the PAOS binding. */ - public const BINDING_PAOS = 'urn:oasis:names:tc:SAML:2.0:bindings:PAOS'; + public const string BINDING_PAOS = 'urn:oasis:names:tc:SAML:2.0:bindings:PAOS'; /** * The URN for the SOAP binding. */ - public const BINDING_SOAP = 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'; + public const string BINDING_SOAP = 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'; /** * The URN for the URI binding. */ - public const BINDING_URI = 'urn:oasis:names:tc:SAML:2.0:bindings:URI'; + public const string BINDING_URI = 'urn:oasis:names:tc:SAML:2.0:bindings:URI'; /** * Bearer subject confirmation method. */ - public const CM_BEARER = 'urn:oasis:names:tc:SAML:2.0:cm:bearer'; + public const string CM_BEARER = 'urn:oasis:names:tc:SAML:2.0:cm:bearer'; /** * Holder-of-Key subject confirmation method. */ - public const CM_HOK = 'urn:oasis:names:tc:SAML:2.0:cm:holder-of-key'; + public const string CM_HOK = 'urn:oasis:names:tc:SAML:2.0:cm:holder-of-key'; /** * Vouches subject confirmation method. */ - public const CM_VOUCHES = 'urn:oasis:names:tc:SAML:2.0:cm:sender-vouches'; + public const string CM_VOUCHES = 'urn:oasis:names:tc:SAML:2.0:cm:sender-vouches'; /** * Indicates that a principal’s consent has been explicitly obtained by the issuer of the message during the * action that initiated the message. */ - public const CONSENT_EXPLICIT = 'urn:oasis:names:tc:SAML:2.0:consent:current-explicit'; + public const string CONSENT_EXPLICIT = 'urn:oasis:names:tc:SAML:2.0:consent:current-explicit'; /** * Indicates that a principal’s consent has been implicitly obtained by the issuer of the message during the @@ -113,205 +114,205 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * Implicit consent is typically more proximal to the action in time and presentation than prior consent, * such as part of a session of activities. */ - public const CONSENT_IMPLICIT = 'urn:oasis:names:tc:SAML:2.0:consent:current-implicit'; + public const string CONSENT_IMPLICIT = 'urn:oasis:names:tc:SAML:2.0:consent:current-implicit'; /** * Indicates that the issuer of the message does not believe that they need to obtain or report consent. */ - public const CONSENT_INAPPLICABLE = 'urn:oasis:names:tc:SAML:2.0:consent:inapplicable'; + public const string CONSENT_INAPPLICABLE = 'urn:oasis:names:tc:SAML:2.0:consent:inapplicable'; /** * Indicates that a principal’s consent has been obtained by the issuer of the message. */ - public const CONSENT_OBTAINED = 'urn:oasis:names:tc:SAML:2.0:consent:obtained'; + public const string CONSENT_OBTAINED = 'urn:oasis:names:tc:SAML:2.0:consent:obtained'; /** * Indicates that a principal’s consent has been obtained by the issuer of the message at some point prior to * the action that initiated the message. */ - public const CONSENT_PRIOR = 'urn:oasis:names:tc:SAML:2.0:consent:prior'; + public const string CONSENT_PRIOR = 'urn:oasis:names:tc:SAML:2.0:consent:prior'; /** * Indicates that the issuer of the message did not obtain consent. */ - public const CONSENT_UNAVAILABLE = 'urn:oasis:names:tc:SAML:2.0:consent:unavailable'; + public const string CONSENT_UNAVAILABLE = 'urn:oasis:names:tc:SAML:2.0:consent:unavailable'; /** * No claim as to principal consent is being made. */ - public const CONSENT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:consent:unspecified'; + public const string CONSENT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:consent:unspecified'; - public const EPTI_URN_MACE = 'urn:mace:dir:attribute-def:eduPersonTargetedID'; + public const string EPTI_URN_MACE = 'urn:mace:dir:attribute-def:eduPersonTargetedID'; - public const EPTI_URN_OID = 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10'; + public const string EPTI_URN_OID = 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10'; /** * LogoutRequest Reason - admin wishes to terminate the session */ - public const LOGOUT_REASON_ADMIN = 'urn:oasis:names:tc:SAML:2.0:logout:admin'; + public const string LOGOUT_REASON_ADMIN = 'urn:oasis:names:tc:SAML:2.0:logout:admin'; /** * LogoutRequest Reason - user wishes to terminate the session */ - public const LOGOUT_REASON_USER = 'urn:oasis:names:tc:SAML:2.0:logout:user'; + public const string LOGOUT_REASON_USER = 'urn:oasis:names:tc:SAML:2.0:logout:user'; /** * The class of strings acceptable as the attribute name MUST be drawn from the set of values belonging to * the primitive type xs:Name as defined in [Schema2] Section 3.3.6. See [SAMLProf] for attribute profiles * that make use of this identifier. */ - public const NAMEFORMAT_BASIC = 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic'; + public const string NAMEFORMAT_BASIC = 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic'; /** * The interpretation of the attribute name is left to individual implementations. */ - public const NAMEFORMAT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified'; + public const string NAMEFORMAT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified'; /** * The attribute name follows the convention for URI references [RFC 2396], for example as used in XACML * [XACML] attribute identifiers. The interpretation of the URI content or naming scheme is application- * specific. See [SAMLProf] for attribute profiles that make use of this identifier. */ - public const NAMEFORMAT_URI = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri'; + public const string NAMEFORMAT_URI = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri'; /** * Email address NameID format. */ - public const NAMEID_EMAIL_ADDRESS = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'; + public const string NAMEID_EMAIL_ADDRESS = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'; /** * Encrypted NameID format. */ - public const NAMEID_ENCRYPTED = 'urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted'; + public const string NAMEID_ENCRYPTED = 'urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted'; /** * Entity NameID format. */ - public const NAMEID_ENTITY = 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity'; + public const string NAMEID_ENTITY = 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity'; /** * Kerberos Principal Name NameID format. */ - public const NAMEID_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos'; + public const string NAMEID_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos'; /** * Persistent NameID format. */ - public const NAMEID_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'; + public const string NAMEID_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'; /** * Transient NameID format. */ - public const NAMEID_TRANSIENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'; + public const string NAMEID_TRANSIENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'; /** * Unspecified NameID format. */ - public const NAMEID_UNSPECIFIED = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'; + public const string NAMEID_UNSPECIFIED = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'; /** * Windows Domain Qualifier Name NameID format. */ - public const NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME = + public const string NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName'; /** * X509 Subject Name NameID format. */ - public const NAMEID_X509_SUBJECT_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName'; + public const string NAMEID_X509_SUBJECT_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName'; /** * The namespace for the SAML 2 metadata Algorithm Support profile */ - public const NS_ALG = 'urn:oasis:names:tc:SAML:metadata:algsupport'; + public const string NS_ALG = 'urn:oasis:names:tc:SAML:metadata:algsupport'; /** * The namespace for the ECP protocol. */ - public const NS_ECP = 'urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp'; + public const string NS_ECP = 'urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp'; /** * The namespace for the EduID metadata protocol. */ - public const NS_EMD = 'http://eduid.cz/schema/metadata/1.0'; + public const string NS_EMD = 'http://eduid.cz/schema/metadata/1.0'; /** * The namespace for the SAML 2 HoK Web Browser SSO Profile. */ - public const NS_HOK = 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'; + public const string NS_HOK = 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'; /** * The namespace for the SAML 2 metadata. */ - public const NS_MD = 'urn:oasis:names:tc:SAML:2.0:metadata'; + public const string NS_MD = 'urn:oasis:names:tc:SAML:2.0:metadata'; /** * The namespace for the SAML 2 Metadata Extensions for Registration and Publication Information. */ - public const NS_MDRPI = 'urn:oasis:names:tc:SAML:metadata:rpi'; + public const string NS_MDRPI = 'urn:oasis:names:tc:SAML:metadata:rpi'; /** * The namespace for the SAML 2 Metadata Extensions for Login and Discovery User Interface Version. */ - public const NS_MDUI = 'urn:oasis:names:tc:SAML:metadata:ui'; + public const string NS_MDUI = 'urn:oasis:names:tc:SAML:metadata:ui'; /** * The namespace for the SAML 2 metadata attributes. */ - public const NS_MDATTR = 'urn:oasis:names:tc:SAML:metadata:attribute'; + public const string NS_MDATTR = 'urn:oasis:names:tc:SAML:metadata:attribute'; /** * The namespace for the Shibboleth Metadata profile. */ - public const NS_SHIBMD = 'urn:mace:shibboleth:metadata:1.0'; + public const string NS_SHIBMD = 'urn:mace:shibboleth:metadata:1.0'; /** * The namespace for the SAML 2 assertions. */ - public const NS_SAML = 'urn:oasis:names:tc:SAML:2.0:assertion'; + public const string NS_SAML = 'urn:oasis:names:tc:SAML:2.0:assertion'; /** * The namespace for the SAML 2 protocol. */ - public const NS_SAMLP = 'urn:oasis:names:tc:SAML:2.0:protocol'; + public const string NS_SAMLP = 'urn:oasis:names:tc:SAML:2.0:protocol'; /** * The namespace for the SOAP protocol. */ - public const NS_SOAP = 'http://schemas.xmlsoap.org/soap/envelope/'; + public const string NS_SOAP = 'http://schemas.xmlsoap.org/soap/envelope/'; /** * The namespace for the IDP Discovery protocol */ - public const NS_IDPDISC = 'urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol'; + public const string NS_IDPDISC = 'urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol'; /** * The responding provider was unable to successfully authenticate the principal. * * Second-level status code. */ - public const STATUS_AUTHN_FAILED = 'urn:oasis:names:tc:SAML:2.0:status:AuthnFailed'; + public const string STATUS_AUTHN_FAILED = 'urn:oasis:names:tc:SAML:2.0:status:AuthnFailed'; /** * Unexpected or invalid content was encountered within a or element. * * Second-level status code. */ - public const STATUS_INVALID_ATTR = 'urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue'; + public const string STATUS_INVALID_ATTR = 'urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue'; /** * The responding provider cannot or will not support the requested name identifier policy. * * Second-level status code. */ - public const STATUS_INVALID_NAMEID_POLICY = 'urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy'; + public const string STATUS_INVALID_NAMEID_POLICY = 'urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy'; /** * The specified authentication context requirements cannot be met by the responder. * * Second-level status code. */ - public const STATUS_NO_AUTHN_CONTEXT = 'urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext'; + public const string STATUS_NO_AUTHN_CONTEXT = 'urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext'; /** * Used by an intermediary to indicate that none of the supported identity provider elements in an @@ -319,14 +320,14 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_NO_AVAILABLE_IDP = 'urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP'; + public const string STATUS_NO_AVAILABLE_IDP = 'urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP'; /** * Indicates the responding provider cannot authenticate the principal passively, as has been requested. * * Second-level status code. */ - public const STATUS_NO_PASSIVE = 'urn:oasis:names:tc:SAML:2.0:status:NoPassive'; + public const string STATUS_NO_PASSIVE = 'urn:oasis:names:tc:SAML:2.0:status:NoPassive'; /** * Used by an intermediary to indicate that none of the identity providers in an are @@ -334,7 +335,7 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_NO_SUPPORTED_IDP = 'urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP'; + public const string STATUS_NO_SUPPORTED_IDP = 'urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP'; /** * Used by a session authority to indicate to a session participant that it was not able to propagate logout @@ -342,12 +343,12 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_PARTIAL_LOGOUT = 'urn:oasis:names:tc:SAML:2.0:status:PartialLogout'; + public const string STATUS_PARTIAL_LOGOUT = 'urn:oasis:names:tc:SAML:2.0:status:PartialLogout'; /** * The status namespace */ - public const STATUS_PREFIX = 'urn:oasis:names:tc:SAML:2.0:status:'; + public const string STATUS_PREFIX = 'urn:oasis:names:tc:SAML:2.0:status:'; /** * Indicates that a responding provider cannot authenticate the principal directly and is not permitted @@ -355,7 +356,7 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_PROXY_COUNT_EXCEEDED = 'urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded'; + public const string STATUS_PROXY_COUNT_EXCEEDED = 'urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded'; /** * The SAML responder or SAML authority is able to process the request but has chosen not to respond. @@ -364,21 +365,22 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_REQUEST_DENIED = 'urn:oasis:names:tc:SAML:2.0:status:RequestDenied'; + public const string STATUS_REQUEST_DENIED = 'urn:oasis:names:tc:SAML:2.0:status:RequestDenied'; /** * The SAML responder or SAML authority does not support the request. * * Second-level status code. */ - public const STATUS_REQUEST_UNSUPPORTED = 'urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported'; + public const string STATUS_REQUEST_UNSUPPORTED = 'urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported'; /** * The SAML responder cannot process any requests with the protocol version specified in the request. * * Second-level status code. */ - public const STATUS_REQUEST_VERSION_DEPRECATED = 'urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated'; + public const string STATUS_REQUEST_VERSION_DEPRECATED = + 'urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated'; /** * The SAML responder cannot process the request because the protocol version specified in the request message @@ -386,7 +388,7 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_REQUEST_VERSION_TOO_HIGH = 'urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh'; + public const string STATUS_REQUEST_VERSION_TOO_HIGH = 'urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh'; /** * The SAML responder cannot process the request because the protocol version specified in the request message @@ -394,28 +396,28 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_REQUEST_VERSION_TOO_LOW = 'urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow'; + public const string STATUS_REQUEST_VERSION_TOO_LOW = 'urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow'; /** * The request could not be performed due to an error on the part of the requester. * * Top-level status code. */ - public const STATUS_REQUESTER = 'urn:oasis:names:tc:SAML:2.0:status:Requester'; + public const string STATUS_REQUESTER = 'urn:oasis:names:tc:SAML:2.0:status:Requester'; /** * The resource value provided in the request message is invalid or unrecognized. * * Second-level status code. */ - public const STATUS_RESOURCE_NOT_RECOGNIZED = 'urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized'; + public const string STATUS_RESOURCE_NOT_RECOGNIZED = 'urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized'; /** * The request could not be performed due to an error on the part of the SAML responder or SAML authority. * * Top-level status code. */ - public const STATUS_RESPONDER = 'urn:oasis:names:tc:SAML:2.0:status:Responder'; + public const string STATUS_RESPONDER = 'urn:oasis:names:tc:SAML:2.0:status:Responder'; /** * Top-level status code indicating successful processing of the request. @@ -424,14 +426,14 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Top-level status code. */ - public const STATUS_SUCCESS = 'urn:oasis:names:tc:SAML:2.0:status:Success'; + public const string STATUS_SUCCESS = 'urn:oasis:names:tc:SAML:2.0:status:Success'; /** * The response message would contain more elements than the SAML responder is able to return. * * Second-level status code. */ - public const STATUS_TOO_MANY_RESPONSES = 'urn:oasis:names:tc:SAML:2.0:status:TooManyResponses'; + public const string STATUS_TOO_MANY_RESPONSES = 'urn:oasis:names:tc:SAML:2.0:status:TooManyResponses'; /** * An entity that has no knowledge of a particular attribute profile has been presented with an attribute @@ -439,46 +441,46 @@ class Constants extends \SimpleSAML\XMLSecurity\Constants * * Second-level status code. */ - public const STATUS_UNKNOWN_ATTR_PROFILE = 'urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile'; + public const string STATUS_UNKNOWN_ATTR_PROFILE = 'urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile'; /** * The responding provider does not recognize the principal specified or implied by the request. * * Second-level status code. */ - public const STATUS_UNKNOWN_PRINCIPAL = 'urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal'; + public const string STATUS_UNKNOWN_PRINCIPAL = 'urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal'; /** * The SAML responder cannot properly fulfill the request using the protocol binding specified in the request. * * Second-level status code. */ - public const STATUS_UNSUPPORTED_BINDING = 'urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding'; + public const string STATUS_UNSUPPORTED_BINDING = 'urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding'; /** * The SAML responder could not process the request because the version of the request message was incorrect. * * Top-level status code. */ - public const STATUS_VERSION_MISMATCH = 'urn:oasis:names:tc:SAML:2.0:status:VersionMismatch'; + public const string STATUS_VERSION_MISMATCH = 'urn:oasis:names:tc:SAML:2.0:status:VersionMismatch'; /** * The maximum size for any entityid as per specification */ - public const ENTITYID_MAX_LENGTH = 1024; + public const int ENTITYID_MAX_LENGTH = 1024; /** * The maximum size in bytes for any RelayState as per specification */ - public const MAX_RELAY_STATE_LENGTH = 80; + public const int MAX_RELAY_STATE_LENGTH = 80; /** * The maximum size for any entityid as per SAML2INT-specification */ - public const SAML2INT_ENTITYID_MAX_LENGTH = 256; + public const int SAML2INT_ENTITYID_MAX_LENGTH = 256; /** * The format to express a timestamp in SAML2 */ - public const DATETIME_FORMAT = 'Y-m-d\\TH:i:sp'; + public const string DATETIME_FORMAT = 'Y-m-d\\TH:i:sp'; } diff --git a/src/Exception/Protocol/AuthnFailedException.php b/src/Exception/Protocol/AuthnFailedException.php index 8dd02308f..73ef38076 100644 --- a/src/Exception/Protocol/AuthnFailedException.php +++ b/src/Exception/Protocol/AuthnFailedException.php @@ -13,5 +13,5 @@ */ class AuthnFailedException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Authentication failed.'; + public const string DEFAULT_MESSAGE = 'Authentication failed.'; } diff --git a/src/Exception/Protocol/InvalidAttrNameOrValueException.php b/src/Exception/Protocol/InvalidAttrNameOrValueException.php index 1f63997b9..7356b84ff 100644 --- a/src/Exception/Protocol/InvalidAttrNameOrValueException.php +++ b/src/Exception/Protocol/InvalidAttrNameOrValueException.php @@ -14,5 +14,5 @@ */ class InvalidAttrNameOrValueException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Invalid attribute name or value.'; + public const string DEFAULT_MESSAGE = 'Invalid attribute name or value.'; } diff --git a/src/Exception/Protocol/InvalidNameIDPolicyException.php b/src/Exception/Protocol/InvalidNameIDPolicyException.php index bd16148f6..b1532694f 100644 --- a/src/Exception/Protocol/InvalidNameIDPolicyException.php +++ b/src/Exception/Protocol/InvalidNameIDPolicyException.php @@ -13,5 +13,5 @@ */ class InvalidNameIDPolicyException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Invalid NameID policy.'; + public const string DEFAULT_MESSAGE = 'Invalid NameID policy.'; } diff --git a/src/Exception/Protocol/NoAuthnContextException.php b/src/Exception/Protocol/NoAuthnContextException.php index 3a5889ceb..0e6dc5ad5 100644 --- a/src/Exception/Protocol/NoAuthnContextException.php +++ b/src/Exception/Protocol/NoAuthnContextException.php @@ -13,5 +13,5 @@ */ class NoAuthnContextException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'None of the requested AuthnContexts can be used.'; + public const string DEFAULT_MESSAGE = 'None of the requested AuthnContexts can be used.'; } diff --git a/src/Exception/Protocol/NoAvailableIDPException.php b/src/Exception/Protocol/NoAvailableIDPException.php index c20718a15..5c80cb414 100644 --- a/src/Exception/Protocol/NoAvailableIDPException.php +++ b/src/Exception/Protocol/NoAvailableIDPException.php @@ -14,5 +14,5 @@ */ class NoAvailableIDPException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'No IdP available.'; + public const string DEFAULT_MESSAGE = 'No IdP available.'; } diff --git a/src/Exception/Protocol/NoPassiveException.php b/src/Exception/Protocol/NoPassiveException.php index 8a4f4e4a9..fc5c4179d 100644 --- a/src/Exception/Protocol/NoPassiveException.php +++ b/src/Exception/Protocol/NoPassiveException.php @@ -14,5 +14,5 @@ */ class NoPassiveException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Cannot perform passive authentication.'; + public const string DEFAULT_MESSAGE = 'Cannot perform passive authentication.'; } diff --git a/src/Exception/Protocol/NoSupportedIDPException.php b/src/Exception/Protocol/NoSupportedIDPException.php index 663fd2af9..93cc440d5 100644 --- a/src/Exception/Protocol/NoSupportedIDPException.php +++ b/src/Exception/Protocol/NoSupportedIDPException.php @@ -14,5 +14,5 @@ */ class NoSupportedIDPException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'No supported IdP.'; + public const string DEFAULT_MESSAGE = 'No supported IdP.'; } diff --git a/src/Exception/Protocol/PartialLogoutException.php b/src/Exception/Protocol/PartialLogoutException.php index 5744a146e..5ddaedae9 100644 --- a/src/Exception/Protocol/PartialLogoutException.php +++ b/src/Exception/Protocol/PartialLogoutException.php @@ -14,5 +14,5 @@ */ class PartialLogoutException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Unable to propagate logout to all other session participants.'; + public const string DEFAULT_MESSAGE = 'Unable to propagate logout to all other session participants.'; } diff --git a/src/Exception/Protocol/ProxyCountExceededException.php b/src/Exception/Protocol/ProxyCountExceededException.php index 4277ff816..a4c9055ff 100644 --- a/src/Exception/Protocol/ProxyCountExceededException.php +++ b/src/Exception/Protocol/ProxyCountExceededException.php @@ -14,5 +14,5 @@ */ class ProxyCountExceededException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Proxy count exceeded.'; + public const string DEFAULT_MESSAGE = 'Proxy count exceeded.'; } diff --git a/src/Exception/Protocol/RequestDeniedException.php b/src/Exception/Protocol/RequestDeniedException.php index f558f03bd..23c29c8eb 100644 --- a/src/Exception/Protocol/RequestDeniedException.php +++ b/src/Exception/Protocol/RequestDeniedException.php @@ -14,5 +14,5 @@ */ class RequestDeniedException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Request denied.'; + public const string DEFAULT_MESSAGE = 'Request denied.'; } diff --git a/src/Exception/Protocol/RequestUnsupportedException.php b/src/Exception/Protocol/RequestUnsupportedException.php index 6f9f57a45..556fe97f4 100644 --- a/src/Exception/Protocol/RequestUnsupportedException.php +++ b/src/Exception/Protocol/RequestUnsupportedException.php @@ -13,5 +13,5 @@ */ class RequestUnsupportedException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Unsupported request.'; + public const string DEFAULT_MESSAGE = 'Unsupported request.'; } diff --git a/src/Exception/Protocol/RequestVersionDeprecatedException.php b/src/Exception/Protocol/RequestVersionDeprecatedException.php index c37c9d482..8f049f05f 100644 --- a/src/Exception/Protocol/RequestVersionDeprecatedException.php +++ b/src/Exception/Protocol/RequestVersionDeprecatedException.php @@ -14,5 +14,5 @@ */ class RequestVersionDeprecatedException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Deprecated version used.'; + public const string DEFAULT_MESSAGE = 'Deprecated version used.'; } diff --git a/src/Exception/Protocol/RequestVersionTooHighException.php b/src/Exception/Protocol/RequestVersionTooHighException.php index c5567f84d..40aa7b992 100644 --- a/src/Exception/Protocol/RequestVersionTooHighException.php +++ b/src/Exception/Protocol/RequestVersionTooHighException.php @@ -14,5 +14,5 @@ */ class RequestVersionTooHighException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Protocol version too high.'; + public const string DEFAULT_MESSAGE = 'Protocol version too high.'; } diff --git a/src/Exception/Protocol/RequestVersionTooLowException.php b/src/Exception/Protocol/RequestVersionTooLowException.php index f1da23810..342ff322f 100644 --- a/src/Exception/Protocol/RequestVersionTooLowException.php +++ b/src/Exception/Protocol/RequestVersionTooLowException.php @@ -14,5 +14,5 @@ */ class RequestVersionTooLowException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Protocol version too low.'; + public const string DEFAULT_MESSAGE = 'Protocol version too low.'; } diff --git a/src/Exception/Protocol/ResourceNotRecognizedException.php b/src/Exception/Protocol/ResourceNotRecognizedException.php index 15f6abb94..56d9250eb 100644 --- a/src/Exception/Protocol/ResourceNotRecognizedException.php +++ b/src/Exception/Protocol/ResourceNotRecognizedException.php @@ -14,5 +14,5 @@ */ class ResourceNotRecognizedException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Resource not recognized.'; + public const string DEFAULT_MESSAGE = 'Resource not recognized.'; } diff --git a/src/Exception/Protocol/TooManyResponsesException.php b/src/Exception/Protocol/TooManyResponsesException.php index 10690bff0..2ae127e61 100644 --- a/src/Exception/Protocol/TooManyResponsesException.php +++ b/src/Exception/Protocol/TooManyResponsesException.php @@ -14,5 +14,5 @@ */ class TooManyResponsesException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Too many responses.'; + public const string DEFAULT_MESSAGE = 'Too many responses.'; } diff --git a/src/Exception/Protocol/UnknownAttrProfileException.php b/src/Exception/Protocol/UnknownAttrProfileException.php index 0ed751f16..f00ebf481 100644 --- a/src/Exception/Protocol/UnknownAttrProfileException.php +++ b/src/Exception/Protocol/UnknownAttrProfileException.php @@ -14,5 +14,5 @@ */ class UnknownAttrProfileException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Unknown attribute profile.'; + public const string DEFAULT_MESSAGE = 'Unknown attribute profile.'; } diff --git a/src/Exception/Protocol/UnknownPrincipalException.php b/src/Exception/Protocol/UnknownPrincipalException.php index c868ad720..91b69b101 100644 --- a/src/Exception/Protocol/UnknownPrincipalException.php +++ b/src/Exception/Protocol/UnknownPrincipalException.php @@ -14,5 +14,5 @@ */ class UnknownPrincipalException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Unknown principal.'; + public const string DEFAULT_MESSAGE = 'Unknown principal.'; } diff --git a/src/Exception/Protocol/UnsupportedBindingException.php b/src/Exception/Protocol/UnsupportedBindingException.php index d2d6a0da0..62a1b2df8 100644 --- a/src/Exception/Protocol/UnsupportedBindingException.php +++ b/src/Exception/Protocol/UnsupportedBindingException.php @@ -14,5 +14,5 @@ */ class UnsupportedBindingException extends ProtocolViolationException { - public const DEFAULT_MESSAGE = 'Unsupported binding.'; + public const string DEFAULT_MESSAGE = 'Unsupported binding.'; } diff --git a/src/Exception/ProtocolViolationException.php b/src/Exception/ProtocolViolationException.php index 0b29fd4d2..6abdc2b57 100644 --- a/src/Exception/ProtocolViolationException.php +++ b/src/Exception/ProtocolViolationException.php @@ -12,7 +12,6 @@ class ProtocolViolationException extends RuntimeException { /** - * @param string|null $message */ public function __construct(?string $message = null) { diff --git a/src/Response/Processor.php b/src/Response/Processor.php index da370d7e2..ae6f7a36a 100644 --- a/src/Response/Processor.php +++ b/src/Response/Processor.php @@ -40,8 +40,6 @@ class Processor /** * Indicates whether or not the response was signed. This is required in order to be able to check whether either * the reponse or one of its assertions was signed - * - * @var bool */ private bool $responseIsSigned = false; @@ -90,6 +88,7 @@ public function process( * Checks the preconditions that must be valid in order for the response to be processed. * * @param \SimpleSAML\SAML2\XML\samlp\Response $response + * * @throws \SimpleSAML\SAML2\Response\Exception\PreconditionNotMetException */ private function enforcePreconditions(Response $response): void @@ -105,6 +104,7 @@ private function enforcePreconditions(Response $response): void /** * @param \SimpleSAML\SAML2\XML\samlp\Response $response * @param \SimpleSAML\SAML2\Configuration\IdentityProvider $identityProviderConfiguration + * * @throws \SimpleSAML\SAML2\Response\Exception\InvalidResponseException */ private function verifySignature(Response $response, IdentityProvider $identityProviderConfiguration): void @@ -136,9 +136,10 @@ private function verifySignature(Response $response, IdentityProvider $identityP /** * @param \SimpleSAML\SAML2\XML\samlp\Response $response + * @return \SimpleSAML\SAML2\Utilities\ArrayCollection + * * @throws \SimpleSAML\SAML2\Response\Exception\UnsignedResponseException * @throws \SimpleSAML\SAML2\Response\Exception\NoAssertionsFoundException - * @return \SimpleSAML\SAML2\Utilities\ArrayCollection */ private function processAssertions(Response $response): ArrayCollection { diff --git a/src/Response/Validation/ConstraintValidator/IsSuccessful.php b/src/Response/Validation/ConstraintValidator/IsSuccessful.php index ec95529ec..81851b0ca 100644 --- a/src/Response/Validation/ConstraintValidator/IsSuccessful.php +++ b/src/Response/Validation/ConstraintValidator/IsSuccessful.php @@ -33,8 +33,6 @@ public function validate( /** * @param \SimpleSAML\SAML2\XML\samlp\Status $responseStatus - * - * @return string */ private function buildMessage(Status $responseStatus): string { @@ -61,8 +59,6 @@ private function buildMessage(Status $responseStatus): string /** * Truncate the status if it is prefixed by its urn. * @param string $status - * - * @return string */ private function truncateStatus(string $status): string { diff --git a/src/Response/Validation/Result.php b/src/Response/Validation/Result.php index 0415a7190..020eaa38e 100644 --- a/src/Response/Validation/Result.php +++ b/src/Response/Validation/Result.php @@ -14,7 +14,6 @@ class Result /** - * @param string $message */ public function addError(string $message): void { @@ -23,7 +22,6 @@ public function addError(string $message): void /** - * @return bool */ public function isValid(): bool { diff --git a/src/Signature/AbstractChainedValidator.php b/src/Signature/AbstractChainedValidator.php index 4e5be4fb1..e24dfb5cc 100644 --- a/src/Signature/AbstractChainedValidator.php +++ b/src/Signature/AbstractChainedValidator.php @@ -34,8 +34,6 @@ public function __construct( * @param \SimpleSAML\SAML2\Utilities\ArrayCollection $pemCandidates * * @throws \Exception - * - * @return bool */ protected function validateElementWithKeys( SignedElementInterface $element, diff --git a/src/Signature/ChainedValidator.php b/src/Signature/ChainedValidator.php index 3a59d9788..d55df4c18 100644 --- a/src/Signature/ChainedValidator.php +++ b/src/Signature/ChainedValidator.php @@ -19,8 +19,6 @@ interface ChainedValidator extends ValidatorInterface * * @param \SimpleSAML\XMLSecurity\XML\SignedElementInterface $signedElement * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $configuration - * - * @return bool */ public function canValidate( SignedElementInterface $signedElement, diff --git a/src/Signature/PublicKeyValidator.php b/src/Signature/PublicKeyValidator.php index 2bc949c99..8bb9a82cd 100644 --- a/src/Signature/PublicKeyValidator.php +++ b/src/Signature/PublicKeyValidator.php @@ -41,8 +41,6 @@ public function __construct( /** * @param \SimpleSAML\XMLSecurity\XML\SignedElementInterface $signedElement * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $configuration - * - * @return bool */ public function canValidate( SignedElementInterface $signedElement, @@ -58,8 +56,6 @@ public function canValidate( * @param \SimpleSAML\XMLSecurity\XML\SignedElementInterface $signedElement * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $configuration * - * @return bool - * * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false */ public function hasValidSignature( diff --git a/src/Signature/Validator.php b/src/Signature/Validator.php index 419fb0c5f..f82b3ef8f 100644 --- a/src/Signature/Validator.php +++ b/src/Signature/Validator.php @@ -28,8 +28,6 @@ public function __construct( /** * @param \SimpleSAML\XMLSecurity\XML\SignedElementInterface $signedElement * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $configuration - * - * @return bool */ public function hasValidSignature( SignedElementInterface $signedElement, diff --git a/src/Signature/ValidatorChain.php b/src/Signature/ValidatorChain.php index 134eee59c..4db2e8fcf 100644 --- a/src/Signature/ValidatorChain.php +++ b/src/Signature/ValidatorChain.php @@ -50,8 +50,6 @@ public function appendValidator(ChainedValidator $validator): void /** * @param \SimpleSAML\XMLSecurity\XML\SignedElementInterface $signedElement * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $configuration - * - * @return bool */ public function hasValidSignature( SignedElementInterface $signedElement, diff --git a/src/Signature/ValidatorInterface.php b/src/Signature/ValidatorInterface.php index 125e1c421..538b4d9a7 100644 --- a/src/Signature/ValidatorInterface.php +++ b/src/Signature/ValidatorInterface.php @@ -14,8 +14,6 @@ interface ValidatorInterface * * @param \SimpleSAML\XMLSecurity\XML\SignedElementInterface $signedElement * @param \SimpleSAML\SAML2\Configuration\CertificateProvider $configuration - * - * @return bool */ public function hasValidSignature( SignedElementInterface $signedElement, diff --git a/src/Type/AuthnContextComparisonTypeValue.php b/src/Type/AuthnContextComparisonTypeValue.php index 9b450d8ef..e283f114c 100644 --- a/src/Type/AuthnContextComparisonTypeValue.php +++ b/src/Type/AuthnContextComparisonTypeValue.php @@ -16,16 +16,13 @@ */ class AuthnContextComparisonTypeValue extends StringValue { - /** @var string */ - public const SCHEMA_TYPE = 'authnContextComparisonType'; + public const string SCHEMA_TYPE = 'authnContextComparisonType'; /** * Validate the value. * - * @param string $value The value * @throws \Exception on failure - * @return void */ protected function validateValue(string $value): void { @@ -39,7 +36,6 @@ protected function validateValue(string $value): void /** * @param \SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum $value - * @return static */ public static function fromEnum(AuthnContextComparisonTypeEnum $value): static { diff --git a/src/Type/CIDRValue.php b/src/Type/CIDRValue.php index 687462ce7..959a6e9c7 100644 --- a/src/Type/CIDRValue.php +++ b/src/Type/CIDRValue.php @@ -14,9 +14,7 @@ class CIDRValue extends SAMLStringValue /** * Sanitize the content of the element. * - * @param string $value The unsanitized value * @throws \Exception on failure - * @return string */ protected function sanitizeValue(string $value): string { @@ -27,9 +25,7 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. * - * @param string $value The value to go in the XML textContent * @throws \Exception on failure - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/DecisionTypeValue.php b/src/Type/DecisionTypeValue.php index 3ec6a0376..218b361cf 100644 --- a/src/Type/DecisionTypeValue.php +++ b/src/Type/DecisionTypeValue.php @@ -16,16 +16,13 @@ */ class DecisionTypeValue extends StringValue { - /** @var string */ - public const SCHEMA_TYPE = 'decisionType'; + public const string SCHEMA_TYPE = 'decisionType'; /** * Validate the value. * - * @param string $value The value * @throws \Exception on failure - * @return void */ protected function validateValue(string $value): void { @@ -39,7 +36,6 @@ protected function validateValue(string $value): void /** * @param \SimpleSAML\SAML2\XML\saml\DecisionTypeEnum $value - * @return static */ public static function fromEnum(DecisionTypeEnum $value): static { diff --git a/src/Type/DomainValue.php b/src/Type/DomainValue.php index a6f4182fa..73f7225c6 100644 --- a/src/Type/DomainValue.php +++ b/src/Type/DomainValue.php @@ -16,9 +16,7 @@ class DomainValue extends SAMLStringValue /** * Sanitize the content of the element. * - * @param string $value The unsanitized value * @throws \Exception on failure - * @return string */ protected function sanitizeValue(string $value): string { @@ -32,9 +30,7 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. * - * @param string $value The value to go in the XML textContent * @throws \Exception on failure - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/EmailAddressValue.php b/src/Type/EmailAddressValue.php index 833f27e31..3a256e151 100644 --- a/src/Type/EmailAddressValue.php +++ b/src/Type/EmailAddressValue.php @@ -16,9 +16,7 @@ class EmailAddressValue extends SAMLStringValue /** * Sanitize the content of the element. * - * @param string $value The unsanitized value * @throws \Exception on failure - * @return string */ protected function sanitizeValue(string $value): string { @@ -32,9 +30,7 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. * - * @param string $value The value to go in the XML textContent * @throws \Exception on failure - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/EntityIDValue.php b/src/Type/EntityIDValue.php index 33f96e1a9..94a4298e5 100644 --- a/src/Type/EntityIDValue.php +++ b/src/Type/EntityIDValue.php @@ -14,21 +14,15 @@ */ class EntityIDValue extends SAMLAnyURIValue { - /** @var string */ - public const SCHEMA_TYPE = 'entityIDType'; + public const string SCHEMA_TYPE = 'entityIDType'; - /** @var string */ - public const SCHEMA_NAMESPACEURI = C::NS_MD; + public const string SCHEMA_NAMESPACEURI = C::NS_MD; - /** @var string */ - public const SCHEMA_NAMESPACE_PREFIX = AbstractMdElement::NS_PREFIX; + public const string SCHEMA_NAMESPACE_PREFIX = AbstractMdElement::NS_PREFIX; /** * Validate the value. - * - * @param string $value - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/GeolocationValue.php b/src/Type/GeolocationValue.php index cc4bd929c..83e83423e 100644 --- a/src/Type/GeolocationValue.php +++ b/src/Type/GeolocationValue.php @@ -14,9 +14,7 @@ class GeolocationValue extends SAMLAnyURIValue /** * Sanitize the content of the element. * - * @param string $value The unsanitized value * @throws \Exception on failure - * @return string */ protected function sanitizeValue(string $value): string { @@ -29,9 +27,6 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. - * - * @param string $value The value to go in the XML textContent - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/KeyTypesValue.php b/src/Type/KeyTypesValue.php index e800e4be8..9ad00bd99 100644 --- a/src/Type/KeyTypesValue.php +++ b/src/Type/KeyTypesValue.php @@ -18,9 +18,7 @@ class KeyTypesValue extends SAMLStringValue /** * Validate the content of the element. * - * @param string $content The value to go in the XML textContent * @throws \Exception on failure - * @return void */ protected function validateValue(string $content): void { diff --git a/src/Type/ListOfStringsValue.php b/src/Type/ListOfStringsValue.php index 40d90c301..50c400531 100644 --- a/src/Type/ListOfStringsValue.php +++ b/src/Type/ListOfStringsValue.php @@ -20,22 +20,17 @@ */ class ListOfStringsValue extends SAMLStringValue implements ListTypeInterface { - /** @var string */ - public const SCHEMA_TYPE = 'ListOfStrings'; + public const string SCHEMA_TYPE = 'ListOfStrings'; - /** @var string */ - public const SCHEMA_NAMESPACEURI = C::NS_MDUI; + public const string SCHEMA_NAMESPACEURI = C::NS_MDUI; - /** @var string */ - public const SCHEMA_NAMESPACE_PREFIX = 'mdui'; + public const string SCHEMA_NAMESPACE_PREFIX = 'mdui'; /** * Validate the value. * - * @param string $value * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure - * @return void */ protected function validateValue(string $value): void { @@ -49,7 +44,6 @@ protected function validateValue(string $value): void * Convert an array of xs:string items into a mdui:ListOfStrings * * @param string[] $keywords - * @return static */ public static function fromArray(array $keywords): static { @@ -67,7 +61,7 @@ public static function fromArray(array $keywords): static /** * Convert this mdui:ListOfStrings to an array of xs:string items * - * @return array<\SimpleSAML\SAML2\Type\SAMLStringValue> + * @return \SimpleSAML\SAML2\Type\SAMLStringValue[] */ public function toArray(): array { diff --git a/src/Type/SAMLAnyURIListValue.php b/src/Type/SAMLAnyURIListValue.php index a3f9b2368..1b139e3b1 100644 --- a/src/Type/SAMLAnyURIListValue.php +++ b/src/Type/SAMLAnyURIListValue.php @@ -19,16 +19,13 @@ */ class SAMLAnyURIListValue extends AnyURIListValue { - /** @var string */ - public const SCHEMA_TYPE = 'AnyURIList'; + public const string SCHEMA_TYPE = 'AnyURIList'; /** * Validate the value. * - * @param string $value * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure - * @return void */ protected function validateValue(string $value): void { @@ -43,7 +40,7 @@ protected function validateValue(string $value): void /** * Convert this saml:AnyURIList to an array of xs:anyURI items * - * @return array<\SimpleSAML\SAML2\Type\SAMLAnyURIValue> + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue[] */ public function toArray(): array { diff --git a/src/Type/SAMLAnyURIValue.php b/src/Type/SAMLAnyURIValue.php index a43e42500..8bc51470a 100644 --- a/src/Type/SAMLAnyURIValue.php +++ b/src/Type/SAMLAnyURIValue.php @@ -14,9 +14,6 @@ class SAMLAnyURIValue extends AnyURIValue { /** * Validate the value. - * - * @param string $value - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/SAMLDateTimeValue.php b/src/Type/SAMLDateTimeValue.php index 3c01cf70b..20e36f90b 100644 --- a/src/Type/SAMLDateTimeValue.php +++ b/src/Type/SAMLDateTimeValue.php @@ -14,14 +14,11 @@ class SAMLDateTimeValue extends DateTimeValue { // Lowercase p as opposed to the base-class to covert the timestamp to UTC as demanded by the SAML specifications - public const DATETIME_FORMAT = 'Y-m-d\\TH:i:sp'; + public const string DATETIME_FORMAT = 'Y-m-d\\TH:i:sp'; /** * Validate the value. - * - * @param string $value - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Type/SAMLStringValue.php b/src/Type/SAMLStringValue.php index 8754257e8..de6ae048a 100644 --- a/src/Type/SAMLStringValue.php +++ b/src/Type/SAMLStringValue.php @@ -14,9 +14,6 @@ class SAMLStringValue extends StringValue { /** * Validate the value. - * - * @param string $value - * @return void */ protected function validateValue(string $value): void { diff --git a/src/Utilities/ArrayCollection.php b/src/Utilities/ArrayCollection.php index 63a36fbbd..ed372fdbf 100644 --- a/src/Utilities/ArrayCollection.php +++ b/src/Utilities/ArrayCollection.php @@ -54,8 +54,6 @@ public function get($key) /** - * @param \Closure $filterFunction - * * @return \SimpleSAML\SAML2\Utilities\ArrayCollection */ public function filter(Closure $filterFunction): Collection @@ -76,7 +74,6 @@ public function set($key, $value): void /** * @param mixed $element - * */ public function remove($element): void { @@ -89,8 +86,9 @@ public function remove($element): void /** - * @throws \SimpleSAML\SAML2\Exception\RuntimeException * @return bool|mixed + * + * @throws \SimpleSAML\SAML2\Exception\RuntimeException */ public function getOnlyElement() { @@ -136,7 +134,6 @@ public function map(Closure $function): ArrayCollection /** - * @return int */ public function count(): int { @@ -155,8 +152,6 @@ public function getIterator(): ArrayIterator /** * @param mixed $offset - * - * @return bool */ public function offsetExists($offset): bool { diff --git a/src/Utilities/Collection.php b/src/Utilities/Collection.php index 4b3f0affb..a69929a6f 100644 --- a/src/Utilities/Collection.php +++ b/src/Utilities/Collection.php @@ -15,7 +15,6 @@ interface Collection extends ArrayAccess, Countable, IteratorAggregate * Add an element to the collection * * @param mixed $element - * */ public function add($element): void; diff --git a/src/Utilities/File.php b/src/Utilities/File.php index cab36471d..a9a6bc4dd 100644 --- a/src/Utilities/File.php +++ b/src/Utilities/File.php @@ -17,8 +17,6 @@ class File { /** * @param string $file full absolute path to the file - * - * @return string */ public static function getFileContents(string $file): string { diff --git a/src/Utils/Random.php b/src/Utils/Random.php index d1f77b52a..e9b4f2f93 100644 --- a/src/Utils/Random.php +++ b/src/Utils/Random.php @@ -2,10 +2,7 @@ declare(strict_types=1); -namespace SimpleSAML\XML\Utils; - -use function bin2hex; -use function random_bytes; +namespace SimpleSAML\SAML2\Utils; /** * @package simplesamlphp/saml2 diff --git a/src/XML/EncryptableElementTrait.php b/src/XML/EncryptableElementTrait.php index 7efbbba42..03f200532 100644 --- a/src/XML/EncryptableElementTrait.php +++ b/src/XML/EncryptableElementTrait.php @@ -17,6 +17,9 @@ trait EncryptableElementTrait use ParentEncryptableElementTrait; + /** + * @return array|null + */ public function getBlacklistedAlgorithms(): ?array { $container = ContainerSingleton::getInstance(); diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index edddeefb2..a6b4f51b8 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -60,6 +60,9 @@ final public function __construct( } + /** + * @return array|null + */ public function getBlacklistedAlgorithms(): ?array { $container = ContainerSingleton::getInstance(); @@ -67,6 +70,9 @@ public function getBlacklistedAlgorithms(): ?array } + /** + * @return \SimpleSAML\XMLSecurity\Backend\EncryptionBackend|null + */ public function getEncryptionBackend(): ?EncryptionBackend { // return the encryption backend you want to use, diff --git a/src/XML/ExtensionsTrait.php b/src/XML/ExtensionsTrait.php index 42c07ab99..5368e8460 100644 --- a/src/XML/ExtensionsTrait.php +++ b/src/XML/ExtensionsTrait.php @@ -68,7 +68,6 @@ public function getList(): array /** - * @return bool */ public function isEmptyElement(): bool { @@ -109,8 +108,6 @@ public function toXML(?DOMElement $parent = null): DOMElement /** - * @param \DOMElement|null $parent - * @return \DOMElement */ abstract public function instantiateParentElement(?DOMElement $parent = null): DOMElement; } diff --git a/src/XML/IdentifierTrait.php b/src/XML/IdentifierTrait.php index 51f6a90b6..ab5d94292 100644 --- a/src/XML/IdentifierTrait.php +++ b/src/XML/IdentifierTrait.php @@ -54,7 +54,6 @@ protected function setIdentifier(?IdentifierInterface $identifier): void /** * Retrieve an identifier of any type from XML * - * @param \DOMElement $xml * @return \SimpleSAML\SAML2\XML\saml\IdentifierInterface|null * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified diff --git a/src/XML/SignableElementTrait.php b/src/XML/SignableElementTrait.php index 0d52cac2c..bf3dcdd7b 100644 --- a/src/XML/SignableElementTrait.php +++ b/src/XML/SignableElementTrait.php @@ -134,6 +134,9 @@ protected function doSign(DOMElement $xml): DOMElement } + /** + * @return array|null + */ public function getBlacklistedAlgorithms(): ?array { $container = ContainerSingleton::getInstance(); diff --git a/src/XML/SignedElementTrait.php b/src/XML/SignedElementTrait.php index ed80fbe3f..641fd77cf 100644 --- a/src/XML/SignedElementTrait.php +++ b/src/XML/SignedElementTrait.php @@ -62,6 +62,9 @@ protected function setSignature(Signature $signature): void } + /** + * @return array|null + */ public function getBlacklistedAlgorithms(): ?array { $container = ContainerSingleton::getInstance(); diff --git a/src/XML/alg/AbstractAlgElement.php b/src/XML/alg/AbstractAlgElement.php index 0017d729e..d9ba78f41 100644 --- a/src/XML/alg/AbstractAlgElement.php +++ b/src/XML/alg/AbstractAlgElement.php @@ -15,12 +15,9 @@ */ abstract class AbstractAlgElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_ALG; + public const string NS = C::NS_ALG; - /** @var string */ - public const NS_PREFIX = 'alg'; + public const string NS_PREFIX = 'alg'; - /** @var string */ - public const SCHEMA = 'resources/schemas/sstc-saml-metadata-algsupport-v1.0.xsd'; + public const string SCHEMA = 'resources/schemas/sstc-saml-metadata-algsupport-v1.0.xsd'; } diff --git a/src/XML/alg/DigestMethod.php b/src/XML/alg/DigestMethod.php index 9b49c262a..7f78b85b5 100644 --- a/src/XML/alg/DigestMethod.php +++ b/src/XML/alg/DigestMethod.php @@ -17,6 +17,7 @@ * Class for handling the alg:DigestMethod element. * * @link http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-algsupport.pdf + * * @package simplesamlphp/saml2 */ final class DigestMethod extends AbstractAlgElement implements SchemaValidatableElementInterface @@ -26,7 +27,7 @@ final class DigestMethod extends AbstractAlgElement implements SchemaValidatable /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const string XS_ANY_ELT_NAMESPACE = NS::ANY; /** @@ -58,7 +59,6 @@ public function getAlgorithm(): SAMLAnyURIValue * Convert XML into a DigestMethod * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -81,7 +81,6 @@ public static function fromXML(DOMElement $xml): static * Convert this element to XML. * * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/alg/SigningMethod.php b/src/XML/alg/SigningMethod.php index 84fa126ca..c1c806362 100644 --- a/src/XML/alg/SigningMethod.php +++ b/src/XML/alg/SigningMethod.php @@ -27,7 +27,7 @@ final class SigningMethod extends AbstractAlgElement implements SchemaValidatabl /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const string XS_ANY_ELT_NAMESPACE = NS::ANY; /** @@ -36,7 +36,7 @@ final class SigningMethod extends AbstractAlgElement implements SchemaValidatabl * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $algorithm * @param \SimpleSAML\XMLSchema\Type\PositiveIntegerValue|null $minKeySize * @param \SimpleSAML\XMLSchema\Type\PositiveIntegerValue|null $maxKeySize - * @param \SimpleSAML\XML\Chunk[] $elements + * @param \SimpleSAML\XML\SerializableElementInterface[] $elements */ public function __construct( protected SAMLAnyURIValue $algorithm, @@ -85,7 +85,6 @@ public function getMaxKeySize(): ?PositiveIntegerValue * Convert XML into a SigningMethod * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -110,7 +109,6 @@ public static function fromXML(DOMElement $xml): static * Convert this element to XML. * * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/ecp/AbstractEcpElement.php b/src/XML/ecp/AbstractEcpElement.php index e6c31f0ed..edcf280d7 100644 --- a/src/XML/ecp/AbstractEcpElement.php +++ b/src/XML/ecp/AbstractEcpElement.php @@ -16,12 +16,9 @@ */ abstract class AbstractEcpElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_ECP; + public const string NS = C::NS_ECP; - /** @var string */ - public const NS_PREFIX = 'ecp'; + public const string NS_PREFIX = 'ecp'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-schema-ecp-2.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-schema-ecp-2.0.xsd'; } diff --git a/src/XML/ecp/RelayState.php b/src/XML/ecp/RelayState.php index 7f04c5894..ac17f8317 100644 --- a/src/XML/ecp/RelayState.php +++ b/src/XML/ecp/RelayState.php @@ -27,15 +27,13 @@ final class RelayState extends AbstractEcpElement implements SchemaValidatableEl use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; /** * Convert XML into a RelayState * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -78,7 +76,6 @@ public static function fromXML(DOMElement $xml): static * Convert this ECP RelayState to XML. * * @param \DOMElement|null $parent The element we should append this element to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/ecp/Request.php b/src/XML/ecp/Request.php index e43130243..4f5f3b6ed 100644 --- a/src/XML/ecp/Request.php +++ b/src/XML/ecp/Request.php @@ -97,7 +97,6 @@ public function getIDPList(): ?IDPList * Convert XML into a Request * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -153,7 +152,6 @@ public static function fromXML(DOMElement $xml): static * Convert this ECP SubjectConfirmation to XML. * * @param \DOMElement|null $parent The element we should append this element to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/ecp/RequestAuthenticated.php b/src/XML/ecp/RequestAuthenticated.php index a066dc89a..0f8b07d95 100644 --- a/src/XML/ecp/RequestAuthenticated.php +++ b/src/XML/ecp/RequestAuthenticated.php @@ -50,7 +50,6 @@ public function getMustUnderstand(): ?MustUnderstandValue * Convert XML into a RequestAuthenticated * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -89,7 +88,6 @@ public static function fromXML(DOMElement $xml): static * Convert this ECP RequestAuthentication to XML. * * @param \DOMElement|null $parent The element we should append this element to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/ecp/Response.php b/src/XML/ecp/Response.php index 1e272697b..5d96484de 100644 --- a/src/XML/ecp/Response.php +++ b/src/XML/ecp/Response.php @@ -51,7 +51,6 @@ public function getAssertionConsumerServiceURL(): SAMLAnyURIValue * Convert XML into a Response * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -97,7 +96,6 @@ public static function fromXML(DOMElement $xml): static * Convert this ECP Response to XML. * * @param \DOMElement|null $parent The element we should append this element to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/ecp/SubjectConfirmation.php b/src/XML/ecp/SubjectConfirmation.php index 32ab09f9f..a5d6c3d9c 100644 --- a/src/XML/ecp/SubjectConfirmation.php +++ b/src/XML/ecp/SubjectConfirmation.php @@ -66,7 +66,6 @@ public function getSubjectConfirmationData(): ?SubjectConfirmationData * Convert XML into a SubjectConfirmation * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -123,7 +122,6 @@ public static function fromXML(DOMElement $xml): static * Convert this ECP SubjectConfirmation to XML. * * @param \DOMElement|null $parent The element we should append this element to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/emd/AbstractEmdElement.php b/src/XML/emd/AbstractEmdElement.php index 068b77a9e..1899b7c04 100644 --- a/src/XML/emd/AbstractEmdElement.php +++ b/src/XML/emd/AbstractEmdElement.php @@ -14,12 +14,9 @@ */ abstract class AbstractEmdElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_EMD; + public const string NS = C::NS_EMD; - /** @var string */ - public const NS_PREFIX = 'emd'; + public const string NS_PREFIX = 'emd'; - /** @var string */ - public const SCHEMA = 'resources/schemas/eduidmd.xsd'; + public const string SCHEMA = 'resources/schemas/eduidmd.xsd'; } diff --git a/src/XML/emd/RepublishRequest.php b/src/XML/emd/RepublishRequest.php index 10cfbf8dd..d11fb87f1 100644 --- a/src/XML/emd/RepublishRequest.php +++ b/src/XML/emd/RepublishRequest.php @@ -52,7 +52,6 @@ public function getRepublishTarget(): RepublishTarget * Convert XML into a RepublishRequest * * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -80,7 +79,6 @@ public static function fromXML(DOMElement $xml): static * Convert this element to XML. * * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -95,8 +93,7 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{'RepublishTarget': string} $data */ public static function fromArray(array $data): static { @@ -114,7 +111,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array{'RepublishTarget': string} */ public function toArray(): array { diff --git a/src/XML/emd/RepublishTarget.php b/src/XML/emd/RepublishTarget.php index 2e1483d8b..ad280a253 100644 --- a/src/XML/emd/RepublishTarget.php +++ b/src/XML/emd/RepublishTarget.php @@ -18,8 +18,7 @@ final class RepublishTarget extends AbstractEmdElement use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; /** diff --git a/src/XML/idpdisc/DiscoveryResponse.php b/src/XML/idpdisc/DiscoveryResponse.php index 75dc661d5..5e07980a6 100644 --- a/src/XML/idpdisc/DiscoveryResponse.php +++ b/src/XML/idpdisc/DiscoveryResponse.php @@ -26,14 +26,11 @@ final class DiscoveryResponse extends AbstractIndexedEndpointType implements Sch use SchemaValidatableElementTrait; - /** @var string */ - public const NS = C::NS_IDPDISC; + public const string NS = C::NS_IDPDISC; - /** @var string */ - public const NS_PREFIX = 'idpdisc'; + public const string NS_PREFIX = 'idpdisc'; - /** @var string */ - public const SCHEMA = 'resources/schemas/sstc-saml-idp-discovery.xsd'; + public const string SCHEMA = 'resources/schemas/sstc-saml-idp-discovery.xsd'; /** diff --git a/src/XML/init/RequestInitiator.php b/src/XML/init/RequestInitiator.php index 005414b8e..60caf9d70 100644 --- a/src/XML/init/RequestInitiator.php +++ b/src/XML/init/RequestInitiator.php @@ -25,14 +25,11 @@ final class RequestInitiator extends AbstractEndpointType implements SchemaValid use SchemaValidatableElementTrait; - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:profiles:SSO:request-init'; + public const string NS = 'urn:oasis:names:tc:SAML:profiles:SSO:request-init'; - /** @var string */ - public const NS_PREFIX = 'init'; + public const string NS_PREFIX = 'init'; - /** @var string */ - public const SCHEMA = 'resources/schemas/sstc-request-initiation.xsd'; + public const string SCHEMA = 'resources/schemas/sstc-request-initiation.xsd'; /** @@ -67,7 +64,7 @@ public function __construct( * Note: this method cannot be used when extending this class, if the constructor has a different signature. * * @param \DOMElement $xml The XML element we should load. - * @return static + * * @throws \InvalidArgumentException if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AbstractEndpointType.php b/src/XML/md/AbstractEndpointType.php index 25fe5d477..ad2f98533 100644 --- a/src/XML/md/AbstractEndpointType.php +++ b/src/XML/md/AbstractEndpointType.php @@ -43,10 +43,10 @@ abstract class AbstractEndpointType extends AbstractMdElement implements Arrayiz /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const string XS_ANY_ELT_NAMESPACE = NS::OTHER; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -111,7 +111,6 @@ public function getResponseLocation(): ?SAMLAnyURIValue * Note: this method cannot be used when extending this class, if the constructor has a different signature. * * @param \DOMElement $xml The XML element we should load. - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -142,7 +141,6 @@ public static function fromXML(DOMElement $xml): static * Add this endpoint to an XML element. * * @param \DOMElement $parent The element we should append this endpoint to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -173,8 +171,13 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'Binding': string, + * 'Location': string, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -194,8 +197,20 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'Binding': string, + * 'Location': string, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } $data + * @return array{ + * 'Binding': string, + * 'Location': string, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -251,7 +266,13 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'Binding': string, + * 'Location': string, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index 8a55c2b88..c7992298f 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -98,7 +98,6 @@ public static function fromXML(DOMElement $xml): static * Add this endpoint to an XML element. * * @param \DOMElement $parent The element we should append this endpoint to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -134,8 +133,15 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'index': int, + * 'Binding': string, + * 'Location': string, + * 'isDefault'?: bool, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -157,8 +163,24 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'index': int, + * 'Binding': string, + * 'Location': string, + * 'isDefault'?: bool, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } $data + * @return array{ + * 'index': int, + * 'Binding': string, + * 'Location': string, + * 'isDefault'?: bool, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -222,7 +244,15 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'index': int, + * 'Binding': string, + * 'Location': string, + * 'isDefault'?: bool, + * 'ResponseLocation'?: string, + * 'children'?: array, + * 'attributes'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/md/AbstractLocalizedName.php b/src/XML/md/AbstractLocalizedName.php index ae6aed9f5..9eabf4a10 100644 --- a/src/XML/md/AbstractLocalizedName.php +++ b/src/XML/md/AbstractLocalizedName.php @@ -27,8 +27,7 @@ abstract class AbstractLocalizedName extends AbstractMdElement implements Arrayi use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; /** @@ -59,9 +58,6 @@ public function getLanguage(): LanguageValue /** * Create an instance of this object from its XML representation. * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -83,8 +79,6 @@ public static function fromXML(DOMElement $xml): static /** - * @param \DOMElement|null $parent - * @return \DOMElement */ final public function toXML(?DOMElement $parent = null): DOMElement { @@ -99,8 +93,7 @@ final public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { @@ -116,7 +109,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array */ public function toArray(): array { diff --git a/src/XML/md/AbstractLocalizedURI.php b/src/XML/md/AbstractLocalizedURI.php index 88331a5dc..83c263fd0 100644 --- a/src/XML/md/AbstractLocalizedURI.php +++ b/src/XML/md/AbstractLocalizedURI.php @@ -22,8 +22,7 @@ */ abstract class AbstractLocalizedURI extends AbstractLocalizedName { - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; /** @@ -45,9 +44,6 @@ final public function __construct( /** * Create an instance of this object from its XML representation. * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -71,8 +67,7 @@ public static function fromXML(DOMElement $xml): static /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { diff --git a/src/XML/md/AbstractMdElement.php b/src/XML/md/AbstractMdElement.php index 34b973326..4522ebe94 100644 --- a/src/XML/md/AbstractMdElement.php +++ b/src/XML/md/AbstractMdElement.php @@ -14,12 +14,9 @@ */ abstract class AbstractMdElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_MD; + public const string NS = C::NS_MD; - /** @var string */ - public const NS_PREFIX = 'md'; + public const string NS_PREFIX = 'md'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-schema-metadata-2.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-schema-metadata-2.0.xsd'; } diff --git a/src/XML/md/AbstractMetadataDocument.php b/src/XML/md/AbstractMetadataDocument.php index 5beadee15..418c706e3 100644 --- a/src/XML/md/AbstractMetadataDocument.php +++ b/src/XML/md/AbstractMetadataDocument.php @@ -126,7 +126,6 @@ public function getCacheDuration(): ?DurationValue /** - * @return \DOMElement */ protected function getOriginalXML(): DOMElement { @@ -135,9 +134,6 @@ protected function getOriginalXML(): DOMElement /** - * @param \DOMElement|null $parent - * - * @return \DOMElement */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/AbstractRoleDescriptor.php b/src/XML/md/AbstractRoleDescriptor.php index 4800eddb9..231ee1bb8 100644 --- a/src/XML/md/AbstractRoleDescriptor.php +++ b/src/XML/md/AbstractRoleDescriptor.php @@ -39,8 +39,7 @@ abstract class AbstractRoleDescriptor extends AbstractRoleDescriptorType impleme use SchemaValidatableElementTrait; - /** @var string */ - public const LOCALNAME = 'RoleDescriptor'; + public const string LOCALNAME = 'RoleDescriptor'; /** @@ -106,8 +105,6 @@ public function getXsiType(): QNameValue /** * Convert XML into an RoleDescriptor - * @param \DOMElement $xml The XML element we should load - * @return static * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index e5e7bd4c9..5d3d78710 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -26,7 +26,7 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -138,9 +138,6 @@ public function getKeyDescriptor(): array /** * Add this RoleDescriptor to an EntityDescriptor. - * - * @param \DOMElement $parent The EntityDescriptor we should append this endpoint to. - * @return \DOMElement */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/AbstractSSODescriptor.php b/src/XML/md/AbstractSSODescriptor.php index 6b3ef11a8..d922efc50 100644 --- a/src/XML/md/AbstractSSODescriptor.php +++ b/src/XML/md/AbstractSSODescriptor.php @@ -145,9 +145,6 @@ public function getNameIDFormat(): array /** * Add this SSODescriptorType to an EntityDescriptor. - * - * @param \DOMElement|null $parent The EntityDescriptor we should append this SSODescriptorType to. - * @return \DOMElement The generated SSODescriptor DOMElement. */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/AbstractSignedMdElement.php b/src/XML/md/AbstractSignedMdElement.php index 17e699f4f..c44c61cfd 100644 --- a/src/XML/md/AbstractSignedMdElement.php +++ b/src/XML/md/AbstractSignedMdElement.php @@ -29,16 +29,12 @@ abstract class AbstractSignedMdElement extends AbstractMdElement implements /** * The original signed XML - * - * @var \DOMElement */ protected DOMElement $xml; /** * Get the XML element. - * - * @return \DOMElement */ public function getXML(): DOMElement { @@ -48,8 +44,6 @@ public function getXML(): DOMElement /** * Set the XML element. - * - * @param \DOMElement $xml */ protected function setXML(DOMElement $xml): void { @@ -58,8 +52,6 @@ protected function setXML(DOMElement $xml): void /** - * @param \DOMElement|null $parent The EntityDescriptor we should append this SPSSODescriptor to. - * @return \DOMElement * @throws \Exception */ public function toXML(?DOMElement $parent = null): DOMElement @@ -99,8 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement /** - * @param \DOMElement|null $parent - * @return \DOMElement */ abstract public function toUnsignedXML(?DOMElement $parent = null): DOMElement; } diff --git a/src/XML/md/AdditionalMetadataLocation.php b/src/XML/md/AdditionalMetadataLocation.php index 502600809..e2a10ca7b 100644 --- a/src/XML/md/AdditionalMetadataLocation.php +++ b/src/XML/md/AdditionalMetadataLocation.php @@ -59,9 +59,6 @@ public function getLocation(): SAMLAnyURIValue /** * Initialize an AdditionalMetadataLocation element. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -81,9 +78,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AdditionalMetadataLocation to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement This AdditionalMetadataLocation-element. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/AffiliateMember.php b/src/XML/md/AffiliateMember.php index e8e6be83f..f09682735 100644 --- a/src/XML/md/AffiliateMember.php +++ b/src/XML/md/AffiliateMember.php @@ -20,6 +20,5 @@ final class AffiliateMember extends AbstractMdElement implements SchemaValidatab use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = EntityIDValue::class; + public const string TEXTCONTENT_TYPE = EntityIDValue::class; } diff --git a/src/XML/md/AffiliationDescriptor.php b/src/XML/md/AffiliationDescriptor.php index 9ab7f5eb1..9bbd29ae1 100644 --- a/src/XML/md/AffiliationDescriptor.php +++ b/src/XML/md/AffiliationDescriptor.php @@ -31,7 +31,7 @@ final class AffiliationDescriptor extends AbstractMetadataDocument implements Sc /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -108,9 +108,6 @@ public function getKeyDescriptor(): array /** * Initialize a AffiliationDescriptor. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -174,8 +171,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/ArtifactResolutionService.php b/src/XML/md/ArtifactResolutionService.php index a4417d0d8..aa7d16207 100644 --- a/src/XML/md/ArtifactResolutionService.php +++ b/src/XML/md/ArtifactResolutionService.php @@ -32,7 +32,7 @@ final class ArtifactResolutionService extends AbstractIndexedEndpointType implem * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $unused * @param list<\SimpleSAML\XML\Attribute> $attributes - * @param array $children + * @param \SimpleSAML\XML\SerializableElementInterface[] $children * * @throws \SimpleSAML\Assert\AssertionFailedException */ diff --git a/src/XML/md/AttributeAuthorityDescriptor.php b/src/XML/md/AttributeAuthorityDescriptor.php index 6938b2211..b9c5dd5a5 100644 --- a/src/XML/md/AttributeAuthorityDescriptor.php +++ b/src/XML/md/AttributeAuthorityDescriptor.php @@ -162,9 +162,6 @@ public function getAttributes(): array /** * Initialize an IDPSSODescriptor. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -244,8 +241,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/AttributeConsumingService.php b/src/XML/md/AttributeConsumingService.php index 549da9f17..a3ed4860d 100644 --- a/src/XML/md/AttributeConsumingService.php +++ b/src/XML/md/AttributeConsumingService.php @@ -80,10 +80,40 @@ public function __construct( /** - * Initialize / parse an AttributeConsumingService. + * Get the localized names of this service. + * + * @return \SimpleSAML\SAML2\XML\md\ServiceName[] + */ + public function getServiceName(): array + { + return $this->serviceName; + } + + + /** + * Collect the value of the ServiceDescription-property + * + * @return \SimpleSAML\SAML2\XML\md\ServiceDescription[] + */ + public function getServiceDescription(): array + { + return $this->serviceDescription; + } + + + /** + * Collect the value of the RequestedAttribute-property * - * @param \DOMElement $xml The XML element we should load. - * @return static + * @return \SimpleSAML\SAML2\XML\md\RequestedAttribute[] + */ + public function getRequestedAttribute(): array + { + return $this->requestedAttribute; + } + + + /** + * Initialize / parse an AttributeConsumingService. * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -117,44 +147,8 @@ public static function fromXML(DOMElement $xml): static } - /** - * Get the localized names of this service. - * - * @return \SimpleSAML\SAML2\XML\md\ServiceName[] - */ - public function getServiceName(): array - { - return $this->serviceName; - } - - - /** - * Collect the value of the ServiceDescription-property - * - * @return \SimpleSAML\SAML2\XML\md\ServiceDescription[] - */ - public function getServiceDescription(): array - { - return $this->serviceDescription; - } - - - /** - * Collect the value of the RequestedAttribute-property - * - * @return \SimpleSAML\SAML2\XML\md\RequestedAttribute[] - */ - public function getRequestedAttribute(): array - { - return $this->requestedAttribute; - } - - /** * Convert to \DOMElement. - * - * @param \DOMElement $parent The element we should append this AttributeConsumingService to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/AttributeProfile.php b/src/XML/md/AttributeProfile.php index d78326cc4..197381a47 100644 --- a/src/XML/md/AttributeProfile.php +++ b/src/XML/md/AttributeProfile.php @@ -20,6 +20,5 @@ final class AttributeProfile extends AbstractMdElement implements SchemaValidata use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/md/AuthnAuthorityDescriptor.php b/src/XML/md/AuthnAuthorityDescriptor.php index 95c12f6ce..f78877aa2 100644 --- a/src/XML/md/AuthnAuthorityDescriptor.php +++ b/src/XML/md/AuthnAuthorityDescriptor.php @@ -41,8 +41,8 @@ final class AuthnAuthorityDescriptor extends AbstractRoleDescriptorType implemen * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization - * @param array $keyDescriptor - * @param array $contact + * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor + * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contact * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( @@ -127,9 +127,6 @@ public function getNameIDFormat(): array /** * Initialize an IDPSSODescriptor from an existing XML document. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -198,9 +195,6 @@ public static function fromXML(DOMElement $xml): static /** * Add this IDPSSODescriptor to an EntityDescriptor. * - * @param \DOMElement|null $parent The EntityDescriptor we should append this AuthnAuthorityDescriptor to. - * - * @return \DOMElement * @throws \Exception */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement diff --git a/src/XML/md/Company.php b/src/XML/md/Company.php index 45cad9ad3..a2513c4b4 100644 --- a/src/XML/md/Company.php +++ b/src/XML/md/Company.php @@ -20,6 +20,5 @@ final class Company extends AbstractMdElement implements SchemaValidatableElemen use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index 94abc5ba4..ee2e02f7f 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -42,12 +42,14 @@ final class ContactPerson extends AbstractMdElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** * The several different contact types as defined per specification + * + * @var string[] */ - public const CONTACT_TYPES = [ + public const array CONTACT_TYPES = [ 'technical', 'support', 'administrative', @@ -66,7 +68,7 @@ final class ContactPerson extends AbstractMdElement implements * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\XML\md\EmailAddress[] $emailAddress * @param \SimpleSAML\SAML2\XML\md\TelephoneNumber[] $telephoneNumber - * @param list<\SimpleSAML\XML\Attribute> $namespacedAttribute + * @param \SimpleSAML\XML\Attribute[] $namespacedAttribute */ public function __construct( protected SAMLStringValue $contactType, @@ -158,9 +160,6 @@ public function getTelephoneNumber(): array /** * Initialize a ContactPerson element. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -205,10 +204,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this ContactPerson to XML. - * - * @param \DOMElement|null $parent The element we should add this contact to. - * - * @return \DOMElement The new ContactPerson-element. */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -240,8 +235,16 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'contactType': string, + * 'Company'?: string, + * 'GivenName'?: string, + * 'SurName'?: string, + * 'Extensions'?: array, + * 'EmailAddress'?: array, + * 'TelephoneNumber'?: array, + * 'attributes'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -268,8 +271,26 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'contactType': string, + * 'Company'?: string, + * 'GivenName'?: string, + * 'SurName'?: string, + * 'Extensions'?: array, + * 'EmailAddress'?: array, + * 'TelephoneNumber'?: array, + * 'attributes'?: array, + * } $data + * @return array{ + * 'contactType': string, + * 'Company'?: string, + * 'GivenName'?: string, + * 'SurName'?: string, + * 'Extensions'?: array, + * 'EmailAddress'?: array, + * 'TelephoneNumber'?: array, + * 'attributes'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -347,7 +368,16 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'contactType': string, + * 'Company'?: string, + * 'GivenName'?: string, + * 'SurName'?: string, + * 'Extensions'?: array, + * 'EmailAddress'?: array, + * 'TelephoneNumber'?: array, + * 'attributes'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/md/EmailAddress.php b/src/XML/md/EmailAddress.php index c09cda195..562449f86 100644 --- a/src/XML/md/EmailAddress.php +++ b/src/XML/md/EmailAddress.php @@ -25,29 +25,27 @@ final class EmailAddress extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use TypedTextContentTrait; + use TypedTextContentTrait { + TypedTextContentTrait::getContent as getRawContent; + } - /** @var string */ - public const TEXTCONTENT_TYPE = EmailAddressValue::class; + public const string TEXTCONTENT_TYPE = EmailAddressValue::class; /** * Get the content of the element. - * - * @return string */ public function getContent(): string { - return preg_filter('/^/', 'mailto:', $this->content->getValue()); + return preg_filter('/^/', 'mailto:', $this->getRawContent()->getValue()); } /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { @@ -63,7 +61,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array */ public function toArray(): array { diff --git a/src/XML/md/EncryptionMethod.php b/src/XML/md/EncryptionMethod.php index 6116d02bd..a477a78e0 100644 --- a/src/XML/md/EncryptionMethod.php +++ b/src/XML/md/EncryptionMethod.php @@ -18,12 +18,9 @@ class EncryptionMethod extends AbstractEncryptionMethod implements SchemaValidat use SchemaValidatableElementTrait; - /** @var string */ - public const NS = AbstractMdElement::NS; + public const string NS = AbstractMdElement::NS; - /** @var string */ - public const NS_PREFIX = AbstractMdElement::NS_PREFIX; + public const string NS_PREFIX = AbstractMdElement::NS_PREFIX; - /** @var string */ - public const SCHEMA = AbstractMdElement::SCHEMA; + public const string SCHEMA = AbstractMdElement::SCHEMA; } diff --git a/src/XML/md/EntitiesDescriptor.php b/src/XML/md/EntitiesDescriptor.php index 415927093..9b24fe3d7 100644 --- a/src/XML/md/EntitiesDescriptor.php +++ b/src/XML/md/EntitiesDescriptor.php @@ -206,9 +206,6 @@ public function getName(): ?SAMLStringValue /** * Initialize an EntitiesDescriptor from an existing XML document. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException @@ -265,8 +262,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/EntityDescriptor.php b/src/XML/md/EntityDescriptor.php index 5f9a982c1..c5dd2a97a 100644 --- a/src/XML/md/EntityDescriptor.php +++ b/src/XML/md/EntityDescriptor.php @@ -34,7 +34,7 @@ final class EntityDescriptor extends AbstractMetadataDocument implements SchemaV /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -104,9 +104,6 @@ public function __construct( /** * Convert an existing XML into an EntityDescriptor object * - * @param \DOMElement $xml An existing EntityDescriptor XML document. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -282,8 +279,6 @@ public function getAdditionalMetadataLocation(): array /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/Extensions.php b/src/XML/md/Extensions.php index 01481d80e..9f05c414d 100644 --- a/src/XML/md/Extensions.php +++ b/src/XML/md/Extensions.php @@ -47,9 +47,6 @@ final class Extensions extends AbstractMdElement implements SchemaValidatableEle * For those supported extensions, an object of the corresponding class will be created. * The rest will be added as a \SimpleSAML\XML\Chunk object. * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ diff --git a/src/XML/md/GivenName.php b/src/XML/md/GivenName.php index 83b7a52aa..f222531ce 100644 --- a/src/XML/md/GivenName.php +++ b/src/XML/md/GivenName.php @@ -20,6 +20,5 @@ final class GivenName extends AbstractMdElement implements SchemaValidatableElem use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/IDPSSODescriptor.php b/src/XML/md/IDPSSODescriptor.php index 7f0db4af1..f6819784f 100644 --- a/src/XML/md/IDPSSODescriptor.php +++ b/src/XML/md/IDPSSODescriptor.php @@ -191,9 +191,6 @@ public function getSupportedAttribute(): array /** * Initialize an IDPSSODescriptor. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -263,8 +260,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/KeyDescriptor.php b/src/XML/md/KeyDescriptor.php index d5f68060d..4404d7b72 100644 --- a/src/XML/md/KeyDescriptor.php +++ b/src/XML/md/KeyDescriptor.php @@ -80,9 +80,6 @@ public function getEncryptionMethod(): array /** * Initialize an KeyDescriptor. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -109,9 +106,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this KeyDescriptor to XML. - * - * @param \DOMElement|null $parent The element we should append this KeyDescriptor to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/NameIDFormat.php b/src/XML/md/NameIDFormat.php index 10d98aa9b..16bd7e4b1 100644 --- a/src/XML/md/NameIDFormat.php +++ b/src/XML/md/NameIDFormat.php @@ -20,6 +20,5 @@ final class NameIDFormat extends AbstractMdElement implements SchemaValidatableE use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/md/NameIDMappingService.php b/src/XML/md/NameIDMappingService.php index 0b7d6c034..401ea04f2 100644 --- a/src/XML/md/NameIDMappingService.php +++ b/src/XML/md/NameIDMappingService.php @@ -26,18 +26,19 @@ final class NameIDMappingService extends AbstractEndpointType implements SchemaV * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location - * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $unused - * @param array $attributes + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation + * @param \SimpleSAML\XML\Attribute[] $attributes + * * @throws \SimpleSAML\Assert\AssertionFailedException */ public function __construct( SAMLAnyURIValue $binding, SAMLAnyURIValue $location, - ?SAMLAnyURIValue $unused = null, + ?SAMLAnyURIValue $responseLocation = null, array $attributes = [], ) { Assert::null( - $unused, + $responseLocation, 'The \'ResponseLocation\' attribute must be omitted for md:NameIDMappingService.', ); diff --git a/src/XML/md/Organization.php b/src/XML/md/Organization.php index a72195e95..cf3aa4bad 100644 --- a/src/XML/md/Organization.php +++ b/src/XML/md/Organization.php @@ -41,7 +41,7 @@ final class Organization extends AbstractMdElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -114,9 +114,6 @@ public function getOrganizationURL(): array /** * Initialize an Organization element. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -161,9 +158,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Organization to XML. - * - * @param \DOMElement|null $parent The element we should add this organization to. - * @return \DOMElement This Organization-element. */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -194,8 +188,13 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'OrganizationName': string, + * 'OrganizationDisplayName': string, + * 'OrganizationURL': string, + * 'Extensions'?: array, + * 'attributes'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -215,8 +214,20 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'OrganizationName': string, + * 'OrganizationDisplayName': string, + * 'OrganizationURL': string, + * 'Extensions'?: array, + * 'attributes'?: array, + * } $data + * @return array{ + * 'OrganizationName': string, + * 'OrganizationDisplayName': string, + * 'OrganizationURL': string, + * 'Extensions'?: array, + * 'attributes'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -282,7 +293,13 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'OrganizationName': string, + * 'OrganizationDisplayName': string, + * 'OrganizationURL': string, + * 'Extensions'?: array, + * 'attributes'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/md/PDPDescriptor.php b/src/XML/md/PDPDescriptor.php index 61351728c..1d1199b90 100644 --- a/src/XML/md/PDPDescriptor.php +++ b/src/XML/md/PDPDescriptor.php @@ -127,9 +127,6 @@ public function getNameIDFormat(): array /** * Initialize an IDPSSODescriptor from a given XML document. * - * @param \DOMElement $xml The XML element we should load. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -189,8 +186,6 @@ public static function fromXML(DOMElement $xml): static /** * Add this PDPDescriptor to an EntityDescriptor. * - * @param \DOMElement $parent The EntityDescriptor we should append this IDPSSODescriptor to. - * @return \DOMElement * @throws \Exception */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement diff --git a/src/XML/md/RequestedAttribute.php b/src/XML/md/RequestedAttribute.php index d8a715b3c..590ebf6d5 100644 --- a/src/XML/md/RequestedAttribute.php +++ b/src/XML/md/RequestedAttribute.php @@ -20,14 +20,11 @@ */ final class RequestedAttribute extends Attribute { - /** @var string */ - public const NS = AbstractMdElement::NS; + public const string NS = AbstractMdElement::NS; - /** @var string */ - public const NS_PREFIX = AbstractMdElement::NS_PREFIX; + public const string NS_PREFIX = AbstractMdElement::NS_PREFIX; - /** @var string */ - public const SCHEMA = AbstractMdElement::SCHEMA; + public const string SCHEMA = AbstractMdElement::SCHEMA; /** @@ -64,9 +61,6 @@ public function getIsRequired(): ?BooleanValue /** * Convert XML into a RequestedAttribute * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -89,9 +83,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this RequestedAttribute to XML. - * - * @param \DOMElement|null $parent The element we should append this RequestedAttribute to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/SPSSODescriptor.php b/src/XML/md/SPSSODescriptor.php index 2f035227c..edb3ea244 100644 --- a/src/XML/md/SPSSODescriptor.php +++ b/src/XML/md/SPSSODescriptor.php @@ -165,9 +165,6 @@ public function getAttributeConsumingService(): array /** * Convert XML into a SPSSODescriptor * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -236,8 +233,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/md/SurName.php b/src/XML/md/SurName.php index 6b57a2df7..79bc61e8d 100644 --- a/src/XML/md/SurName.php +++ b/src/XML/md/SurName.php @@ -20,6 +20,5 @@ final class SurName extends AbstractMdElement implements SchemaValidatableElemen use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/TelephoneNumber.php b/src/XML/md/TelephoneNumber.php index ca19021cb..5cd870749 100644 --- a/src/XML/md/TelephoneNumber.php +++ b/src/XML/md/TelephoneNumber.php @@ -27,15 +27,13 @@ final class TelephoneNumber extends AbstractMdElement implements use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { @@ -51,7 +49,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array */ public function toArray(): array { diff --git a/src/XML/md/UnknownRoleDescriptor.php b/src/XML/md/UnknownRoleDescriptor.php index 7ff51ee60..d2d3fe6e8 100644 --- a/src/XML/md/UnknownRoleDescriptor.php +++ b/src/XML/md/UnknownRoleDescriptor.php @@ -41,7 +41,7 @@ final class UnknownRoleDescriptor extends AbstractRoleDescriptor * The organization running this entity. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contacts * An array of contacts for this entity. Defaults to an empty array. - * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes + * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ protected function __construct( protected Chunk $chunk, @@ -86,9 +86,6 @@ public function getRawRoleDescriptor(): Chunk /** * Convert this RoleDescriptor to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this unknown RoleDescriptor. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/mdattr/AbstractMdattrElement.php b/src/XML/mdattr/AbstractMdattrElement.php index 9217dd54b..d968be564 100644 --- a/src/XML/mdattr/AbstractMdattrElement.php +++ b/src/XML/mdattr/AbstractMdattrElement.php @@ -14,12 +14,9 @@ */ abstract class AbstractMdattrElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_MDATTR; + public const string NS = C::NS_MDATTR; - /** @var string */ - public const NS_PREFIX = 'mdattr'; + public const string NS_PREFIX = 'mdattr'; - /** @var string */ - public const SCHEMA = 'resources/schemas/sstc-metadata-attr.xsd'; + public const string SCHEMA = 'resources/schemas/sstc-metadata-attr.xsd'; } diff --git a/src/XML/mdattr/EntityAttributes.php b/src/XML/mdattr/EntityAttributes.php index c7fa26c58..ed8ecf4c1 100644 --- a/src/XML/mdattr/EntityAttributes.php +++ b/src/XML/mdattr/EntityAttributes.php @@ -24,6 +24,7 @@ * Class for handling the EntityAttributes metadata extension. * * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-metadata-attr-cs-01.pdf + * * @package simplesamlphp/saml2 */ final class EntityAttributes extends AbstractMdattrElement implements SchemaValidatableElementInterface @@ -118,7 +119,7 @@ public function getChildren(): array * Add the value to the children-property * * @param \SimpleSAML\SAML2\XML\saml\Assertion|\SimpleSAML\SAML2\XML\saml\Attribute $child - * @return void + * * @throws \SimpleSAML\Assert\AssertionFailedException */ public function addChild($child): void @@ -130,9 +131,6 @@ public function addChild($child): void /** * Convert XML into a EntityAttributes * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -163,9 +161,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this EntityAttributes to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/mdrpi/AbstractMdrpiElement.php b/src/XML/mdrpi/AbstractMdrpiElement.php index acf42808b..4e17de5ea 100644 --- a/src/XML/mdrpi/AbstractMdrpiElement.php +++ b/src/XML/mdrpi/AbstractMdrpiElement.php @@ -16,12 +16,9 @@ */ abstract class AbstractMdrpiElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_MDRPI; + public const string NS = C::NS_MDRPI; - /** @var string */ - public const NS_PREFIX = 'mdrpi'; + public const string NS_PREFIX = 'mdrpi'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-metadata-rpi-v1.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-metadata-rpi-v1.0.xsd'; } diff --git a/src/XML/mdrpi/Publication.php b/src/XML/mdrpi/Publication.php index c5aeff245..2a0cfef4b 100644 --- a/src/XML/mdrpi/Publication.php +++ b/src/XML/mdrpi/Publication.php @@ -78,9 +78,6 @@ public function getPublicationId(): ?SAMLStringValue /** * Convert XML into a Publication * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -101,9 +98,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -125,8 +119,11 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * } $data */ public static function fromArray(array $data): static { @@ -144,8 +141,16 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * } $data + * @return array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * } */ private static function processArrayContents(array $data): array { @@ -179,7 +184,11 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * } */ public function toArray(): array { diff --git a/src/XML/mdrpi/PublicationInfo.php b/src/XML/mdrpi/PublicationInfo.php index dc85068ec..8038ed958 100644 --- a/src/XML/mdrpi/PublicationInfo.php +++ b/src/XML/mdrpi/PublicationInfo.php @@ -115,9 +115,6 @@ public function getUsagePolicy(): array /** * Convert XML into a PublicationInfo * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -139,9 +136,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -167,8 +161,12 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * 'UsagePolicy'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -187,8 +185,18 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * 'UsagePolicy'?: array, + * } $data + * @return array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * 'UsagePolicy'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -229,7 +237,12 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'publisher': string, + * 'creationInstant'?: string, + * 'publicationId'?: string, + * 'UsagePolicy'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/mdrpi/PublicationPath.php b/src/XML/mdrpi/PublicationPath.php index 96eccda8e..9b0070d69 100644 --- a/src/XML/mdrpi/PublicationPath.php +++ b/src/XML/mdrpi/PublicationPath.php @@ -17,6 +17,7 @@ * Class for handling the mdrpi:PublicationPath element. * * @link: http://docs.oasis-open.org/security/saml/Post2.0/saml-metadata-rpi/v1.0/saml-metadata-rpi-v1.0.pdf + * * @package simplesamlphp/saml2 */ final class PublicationPath extends AbstractMdrpiElement implements @@ -52,8 +53,6 @@ public function getPublication(): array /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -85,9 +84,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -104,8 +100,7 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{array} $data */ public static function fromArray(array $data): static { @@ -123,7 +118,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array{array} */ public function toArray(): array { diff --git a/src/XML/mdrpi/RegistrationInfo.php b/src/XML/mdrpi/RegistrationInfo.php index 6b6e44433..9c1a0a06b 100644 --- a/src/XML/mdrpi/RegistrationInfo.php +++ b/src/XML/mdrpi/RegistrationInfo.php @@ -20,6 +20,7 @@ * Class for handling the mdrpi:RegistrationInfo element. * * @link: http://docs.oasis-open.org/security/saml/Post2.0/saml-metadata-rpi/v1.0/saml-metadata-rpi-v1.0.pdf + * * @package simplesamlphp/saml2 */ final class RegistrationInfo extends AbstractMdrpiElement implements @@ -99,9 +100,6 @@ public function getRegistrationPolicy(): array /** * Convert XML into a RegistrationInfo * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -122,9 +120,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -146,8 +141,11 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'registrationAuthority': string, + * 'registrationInstant'?: string, + * 'RegistrationPolicy'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -165,8 +163,16 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'registrationAuthority': string, + * 'registrationInstant'?: string, + * 'RegistrationPolicy'?: array, + * } $data + * @return array{ + * 'registrationAuthority': string, + * 'registrationInstant'?: string, + * 'RegistrationPolicy'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -202,7 +208,11 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'registrationAuthority': string, + * 'registrationInstant'?: string, + * 'RegistrationPolicy'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/mdrpi/RegistrationPolicy.php b/src/XML/mdrpi/RegistrationPolicy.php index e75dbbab8..f6a8db80f 100644 --- a/src/XML/mdrpi/RegistrationPolicy.php +++ b/src/XML/mdrpi/RegistrationPolicy.php @@ -15,9 +15,7 @@ */ final class RegistrationPolicy extends AbstractLocalizedURI { - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:metadata:rpi'; + public const string NS = 'urn:oasis:names:tc:SAML:metadata:rpi'; - /** @var string */ - public const NS_PREFIX = 'mdrpi'; + public const string NS_PREFIX = 'mdrpi'; } diff --git a/src/XML/mdrpi/UsagePolicy.php b/src/XML/mdrpi/UsagePolicy.php index 4e138cede..9deba99cc 100644 --- a/src/XML/mdrpi/UsagePolicy.php +++ b/src/XML/mdrpi/UsagePolicy.php @@ -15,9 +15,7 @@ */ final class UsagePolicy extends AbstractLocalizedURI { - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:metadata:rpi'; + public const string NS = 'urn:oasis:names:tc:SAML:metadata:rpi'; - /** @var string */ - public const NS_PREFIX = 'mdrpi'; + public const string NS_PREFIX = 'mdrpi'; } diff --git a/src/XML/mdui/AbstractMduiElement.php b/src/XML/mdui/AbstractMduiElement.php index 39e54adf3..9c93e11b2 100644 --- a/src/XML/mdui/AbstractMduiElement.php +++ b/src/XML/mdui/AbstractMduiElement.php @@ -16,12 +16,9 @@ */ abstract class AbstractMduiElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_MDUI; + public const string NS = C::NS_MDUI; - /** @var string */ - public const NS_PREFIX = 'mdui'; + public const string NS_PREFIX = 'mdui'; - /** @var string */ - public const SCHEMA = 'resources/schemas/sstc-saml-metadata-ui-v1.0.xsd'; + public const string SCHEMA = 'resources/schemas/sstc-saml-metadata-ui-v1.0.xsd'; } diff --git a/src/XML/mdui/Description.php b/src/XML/mdui/Description.php index 8becfbccf..1d5591f56 100644 --- a/src/XML/mdui/Description.php +++ b/src/XML/mdui/Description.php @@ -13,9 +13,7 @@ */ final class Description extends AbstractLocalizedName { - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:metadata:ui'; + public const string NS = 'urn:oasis:names:tc:SAML:metadata:ui'; - /** @var string */ - public const NS_PREFIX = 'mdui'; + public const string NS_PREFIX = 'mdui'; } diff --git a/src/XML/mdui/DiscoHints.php b/src/XML/mdui/DiscoHints.php index f644bc8b1..20deac33e 100644 --- a/src/XML/mdui/DiscoHints.php +++ b/src/XML/mdui/DiscoHints.php @@ -11,7 +11,6 @@ use SimpleSAML\SAML2\Type\DomainValue; use SimpleSAML\SAML2\Type\GeolocationValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -28,6 +27,7 @@ * Class for handling the metadata extensions for login and discovery user interface * * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf + * * @package simplesamlphp/saml2 */ final class DiscoHints extends AbstractMduiElement implements @@ -39,13 +39,13 @@ final class DiscoHints extends AbstractMduiElement implements /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const string XS_ANY_ELT_NAMESPACE = NS::OTHER; /** * Create a DiscoHints element. * - * @param \SimpleSAML\XML\Chunk[] $children + * @param \SimpleSAML\XML\SerializableElementInterface[] $children * @param \SimpleSAML\SAML2\XML\mdui\IPHint[] $ipHint * @param \SimpleSAML\SAML2\XML\mdui\DomainHint[] $domainHint * @param \SimpleSAML\SAML2\XML\mdui\GeolocationHint[] $geolocationHint @@ -103,9 +103,9 @@ public function getGeolocationHint(): array /** * Add the value to the elements-property * - * @param \SimpleSAML\XML\Chunk $child + * @param \SimpleSAML\XML\SerializableElementInterface $child */ - public function addChild(Chunk $child): void + public function addChild(SerializableElementInterface $child): void { $this->elements[] = $child; } @@ -113,8 +113,6 @@ public function addChild(Chunk $child): void /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -128,9 +126,6 @@ public function isEmptyElement(): bool /** * Convert XML into a DiscoHints * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -150,9 +145,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this DiscoHints to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -182,8 +174,12 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'children'?: array, + * 'IPHint'?: array, + * 'DomainHint'?: array, + * 'GeolocationHint'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -202,8 +198,18 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'children'?: array, + * 'IPHint'?: array, + * 'DomainHint'?: array, + * 'GeolocationHint'?: array, + * } $data + * @return array{ + * 'children'?: array, + * 'IPHint'?: array, + * 'DomainHint'?: array, + * 'GeolocationHint'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -270,7 +276,12 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'children'?: array, + * 'IPHint'?: array, + * 'DomainHint'?: array, + * 'GeolocationHint'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/mdui/DisplayName.php b/src/XML/mdui/DisplayName.php index 31cf65322..9d1877d03 100644 --- a/src/XML/mdui/DisplayName.php +++ b/src/XML/mdui/DisplayName.php @@ -13,9 +13,7 @@ */ final class DisplayName extends AbstractLocalizedName { - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:metadata:ui'; + public const string NS = 'urn:oasis:names:tc:SAML:metadata:ui'; - /** @var string */ - public const NS_PREFIX = 'mdui'; + public const string NS_PREFIX = 'mdui'; } diff --git a/src/XML/mdui/DomainHint.php b/src/XML/mdui/DomainHint.php index 266e2dbc0..e4735865a 100644 --- a/src/XML/mdui/DomainHint.php +++ b/src/XML/mdui/DomainHint.php @@ -20,6 +20,5 @@ final class DomainHint extends AbstractMduiElement implements SchemaValidatableE use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = DomainValue::class; + public const string TEXTCONTENT_TYPE = DomainValue::class; } diff --git a/src/XML/mdui/GeolocationHint.php b/src/XML/mdui/GeolocationHint.php index abf21f978..eb56d4308 100644 --- a/src/XML/mdui/GeolocationHint.php +++ b/src/XML/mdui/GeolocationHint.php @@ -20,6 +20,5 @@ final class GeolocationHint extends AbstractMduiElement implements SchemaValidat use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = GeolocationValue::class; + public const string TEXTCONTENT_TYPE = GeolocationValue::class; } diff --git a/src/XML/mdui/IPHint.php b/src/XML/mdui/IPHint.php index 5e2af9119..041626c39 100644 --- a/src/XML/mdui/IPHint.php +++ b/src/XML/mdui/IPHint.php @@ -20,6 +20,5 @@ final class IPHint extends AbstractMduiElement implements SchemaValidatableEleme use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = CIDRValue::class; + public const string TEXTCONTENT_TYPE = CIDRValue::class; } diff --git a/src/XML/mdui/InformationURL.php b/src/XML/mdui/InformationURL.php index 42e19045e..56fe4899b 100644 --- a/src/XML/mdui/InformationURL.php +++ b/src/XML/mdui/InformationURL.php @@ -13,9 +13,7 @@ */ final class InformationURL extends AbstractLocalizedURI { - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:metadata:ui'; + public const string NS = 'urn:oasis:names:tc:SAML:metadata:ui'; - /** @var string */ - public const NS_PREFIX = 'mdui'; + public const string NS_PREFIX = 'mdui'; } diff --git a/src/XML/mdui/Keywords.php b/src/XML/mdui/Keywords.php index 0e94f3a7e..dce5e1b7a 100644 --- a/src/XML/mdui/Keywords.php +++ b/src/XML/mdui/Keywords.php @@ -32,8 +32,7 @@ final class Keywords extends AbstractMduiElement implements use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = ListOfStringsValue::class; + public const string TEXTCONTENT_TYPE = ListOfStringsValue::class; /** @@ -64,9 +63,6 @@ public function getLanguage(): LanguageValue /** * Convert XML into a Keywords * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -88,9 +84,7 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Keywords to XML. * - * @param \DOMElement|null $parent The element we should append this Keywords to. * @throws \Exception - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -105,8 +99,7 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { @@ -125,7 +118,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array */ public function toArray(): array { diff --git a/src/XML/mdui/Logo.php b/src/XML/mdui/Logo.php index 7573c5f81..e3ea4befa 100644 --- a/src/XML/mdui/Logo.php +++ b/src/XML/mdui/Logo.php @@ -32,11 +32,9 @@ final class Logo extends AbstractMduiElement implements use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; - /** @var string */ private static string $scheme_regex = '/^(data|http[s]?[:])/i'; @@ -62,8 +60,8 @@ public function __construct( * Validate the content of the element. * * @param string $content The value to go in the XML textContent + * * @throws \InvalidArgumentException on failure - * @return void */ protected function validateContent(string $content): void { @@ -108,9 +106,6 @@ public function getWidth(): PositiveIntegerValue /** * Convert XML into a Logo * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -133,9 +128,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Logo to XML. - * - * @param \DOMElement|null $parent The element we should append this Logo to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -155,8 +147,12 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'url': string, + * 'height'?: int, + * 'width'?: int, + * 'lang'?: string, + * } $data */ public static function fromArray(array $data): static { @@ -175,8 +171,18 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'url': string, + * 'height'?: int, + * 'width'?: int, + * 'lang'?: string, + * } $data + * @return array{ + * 'url': string, + * 'height'?: int, + * 'width'?: int, + * 'lang'?: string, + * } */ private static function processArrayContents(array $data): array { @@ -219,7 +225,12 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'url': string, + * 'height'?: int, + * 'width'?: int, + * 'lang'?: string, + * } */ public function toArray(): array { diff --git a/src/XML/mdui/PrivacyStatementURL.php b/src/XML/mdui/PrivacyStatementURL.php index 7e66f7be1..f1054af64 100644 --- a/src/XML/mdui/PrivacyStatementURL.php +++ b/src/XML/mdui/PrivacyStatementURL.php @@ -13,9 +13,7 @@ */ final class PrivacyStatementURL extends AbstractLocalizedURI { - /** @var string */ - public const NS = 'urn:oasis:names:tc:SAML:metadata:ui'; + public const string NS = 'urn:oasis:names:tc:SAML:metadata:ui'; - /** @var string */ - public const NS_PREFIX = 'mdui'; + public const string NS_PREFIX = 'mdui'; } diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index 0f2e7002f..4043eb7b0 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -9,7 +9,6 @@ use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SchemaValidatableElementInterface; @@ -29,6 +28,7 @@ * Class for handling the metadata extensions for login and discovery user interface * * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf + * * @package simplesamlphp/saml2 */ final class UIInfo extends AbstractMduiElement implements @@ -40,7 +40,7 @@ final class UIInfo extends AbstractMduiElement implements /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const string XS_ANY_ELT_NAMESPACE = NS::OTHER; /** @@ -52,7 +52,7 @@ final class UIInfo extends AbstractMduiElement implements * @param \SimpleSAML\SAML2\XML\mdui\PrivacyStatementURL[] $privacyStatementURL * @param \SimpleSAML\SAML2\XML\mdui\Keywords[] $keywords * @param \SimpleSAML\SAML2\XML\mdui\Logo[] $logo - * @param \SimpleSAML\XML\Chunk[] $children + * @param \SimpleSAML\XML\SerializableElementInterface[] $children */ public function __construct( protected array $displayName = [], @@ -206,9 +206,9 @@ public function addLogo(Logo $logo): void /** * Add the value to the elements-property * - * @param \SimpleSAML\XML\Chunk $child + * @param \SimpleSAML\XML\SerializableElementInterface $child */ - public function addChild(Chunk $child): void + public function addChild(SerializableElementInterface $child): void { $this->elements[] = $child; } @@ -234,10 +234,11 @@ public function isEmptyElement(): bool /** * Test localized elements for multiple items with the same language * - * @param (\SimpleSAML\SAML2\XML\md\AbstractLocalizedURI| - * \SimpleSAML\SAML2\XML\md\AbstractLocalizedName| - * \SimpleSAML\SAML2\XML\mdui\Keywords)[] $elements - * @return void + * @param ( + * \SimpleSAML\SAML2\XML\md\AbstractLocalizedURI| + * \SimpleSAML\SAML2\XML\md\AbstractLocalizedName| + * \SimpleSAML\SAML2\XML\mdui\Keywords + * )[] $elements */ private function testLocalizedElements(array $elements) { @@ -264,9 +265,6 @@ function ($elt) { /** * Convert XML into a UIInfo * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -297,9 +295,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this UIInfo to XML. - * - * @param \DOMElement|null $parent The element we should append to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -341,10 +336,15 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * NOTE: this method does not support passing additional child-objects - * - * @param array $data - * @return static + * @param array{ + * 'DisplayName'?: array, + * 'Description'?: array, + * 'InformationURL'?: array, + * 'PrivacyStatementURL'?: array, + * 'Keywords'?: array, + * 'Logo'?: array, + * 'children'?: array, + * } $data */ public static function fromArray(array $data): static { @@ -366,8 +366,24 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'DisplayName'?: array, + * 'Description'?: array, + * 'InformationURL'?: array, + * 'PrivacyStatementURL'?: array, + * 'Keywords'?: array, + * 'Logo'?: array, + * 'children'?: array, + * } $data + * @return array{ + * 'DisplayName'?: array, + * 'Description'?: array, + * 'InformationURL'?: array, + * 'PrivacyStatementURL'?: array, + * 'Keywords'?: array, + * 'Logo'?: array, + * 'children'?: array, + * } */ private static function processArrayContents(array $data): array { @@ -443,9 +459,15 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * NOTE: this method does not support passing additional child-objects - * - * @return array + * @return array{ + * 'DisplayName'?: array, + * 'Description'?: array, + * 'InformationURL'?: array, + * 'PrivacyStatementURL'?: array, + * 'Keywords'?: array, + * 'Logo'?: array, + * 'children'?: array, + * } */ public function toArray(): array { diff --git a/src/XML/saml/AbstractBaseID.php b/src/XML/saml/AbstractBaseID.php index 96585e77e..4399b3037 100644 --- a/src/XML/saml/AbstractBaseID.php +++ b/src/XML/saml/AbstractBaseID.php @@ -38,8 +38,7 @@ abstract class AbstractBaseID extends AbstractBaseIDType implements use SchemaValidatableElementTrait; - /** @var string */ - public const LOCALNAME = 'BaseID'; + public const string LOCALNAME = 'BaseID'; /** @@ -70,9 +69,6 @@ public function getXsiType(): QNameValue /** * Convert XML into an BaseID * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -111,9 +107,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this BaseID to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this BaseID. */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -139,6 +132,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } + /** + * @return \SimpleSAML\XMLSecurity\Backend\EncryptionBackend|null + */ public function getEncryptionBackend(): ?EncryptionBackend { // return the encryption backend you want to use, diff --git a/src/XML/saml/AbstractBaseIDType.php b/src/XML/saml/AbstractBaseIDType.php index d6c11c696..5ddecaf62 100644 --- a/src/XML/saml/AbstractBaseIDType.php +++ b/src/XML/saml/AbstractBaseIDType.php @@ -39,9 +39,6 @@ protected function __construct( /** * Convert this BaseID to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this BaseID. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AbstractCondition.php b/src/XML/saml/AbstractCondition.php index a7bc84b89..49c9e35a0 100644 --- a/src/XML/saml/AbstractCondition.php +++ b/src/XML/saml/AbstractCondition.php @@ -32,8 +32,7 @@ abstract class AbstractCondition extends AbstractConditionType implements use SchemaValidatableElementTrait; - /** @var string */ - public const LOCALNAME = 'Condition'; + public const string LOCALNAME = 'Condition'; /** @@ -59,9 +58,6 @@ public function getXsiType(): QNameValue /** * Convert an XML element into a Condition. * - * @param \DOMElement $xml The root XML element - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -95,9 +91,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Condition to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Condition. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AbstractSamlElement.php b/src/XML/saml/AbstractSamlElement.php index 11bb8aa84..701454455 100644 --- a/src/XML/saml/AbstractSamlElement.php +++ b/src/XML/saml/AbstractSamlElement.php @@ -14,12 +14,9 @@ */ abstract class AbstractSamlElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_SAML; + public const string NS = C::NS_SAML; - /** @var string */ - public const NS_PREFIX = 'saml'; + public const string NS_PREFIX = 'saml'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-schema-assertion-2.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-schema-assertion-2.0.xsd'; } diff --git a/src/XML/saml/AbstractStatement.php b/src/XML/saml/AbstractStatement.php index 683a8444c..5fb6c194b 100644 --- a/src/XML/saml/AbstractStatement.php +++ b/src/XML/saml/AbstractStatement.php @@ -32,8 +32,7 @@ abstract class AbstractStatement extends AbstractStatementType implements use SchemaValidatableElementTrait; - /** @var string */ - public const LOCALNAME = 'Statement'; + public const string LOCALNAME = 'Statement'; /** @@ -59,9 +58,6 @@ public function getXsiType(): QNameValue /** * Convert an XML element into a Statement. * - * @param \DOMElement $xml The root XML element - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -95,9 +91,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Statement to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Statement. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AbstractSubjectConfirmationData.php b/src/XML/saml/AbstractSubjectConfirmationData.php index 7bd0b7723..21c8de8ed 100644 --- a/src/XML/saml/AbstractSubjectConfirmationData.php +++ b/src/XML/saml/AbstractSubjectConfirmationData.php @@ -26,23 +26,24 @@ */ abstract class AbstractSubjectConfirmationData extends AbstractAnyType { - /** @var string */ - public const NS = C::NS_SAML; + public const string NS = C::NS_SAML; - /** @var string */ - public const NS_PREFIX = 'saml'; + public const string NS_PREFIX = 'saml'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-schema-assertion-2.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-schema-assertion-2.0.xsd'; /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const string XS_ANY_ELT_NAMESPACE = NS::ANY; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; - /** The exclusions for the xs:anyAttribute element */ - public const XS_ANY_ATTR_EXCLUSIONS = [ + /** + * The exclusions for the xs:anyAttribute element + * + * @var array> + */ + public const array XS_ANY_ATTR_EXCLUSIONS = [ ['urn:oasis:names:tc:SAML:2.0:assertion', '*'], ['urn:oasis:names:tc:SAML:2.0:protocol', '*'], ]; @@ -162,8 +163,6 @@ public function getAddress(): ?SAMLStringValue /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -179,9 +178,6 @@ public function isEmptyElement(): bool /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The parent element we should append this element to. - * @return \DOMElement This element, as XML. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Action.php b/src/XML/saml/Action.php index 1c8275d3c..e349793f0 100644 --- a/src/XML/saml/Action.php +++ b/src/XML/saml/Action.php @@ -23,15 +23,15 @@ final class Action extends AbstractSamlElement use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; /** * Initialize an Action. * + * NOTE: The namespace-attribute was marked REQUIRED in the 2012 SAML errata (E36) + * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $namespace - * NOTE: The namespace-attribute was marked REQUIRED in the 2012 SAML errata (E36) * @param \SimpleSAML\SAML2\Type\SAMLStringValue $content */ public function __construct( @@ -56,9 +56,6 @@ public function getNamespace(): SAMLAnyURIValue /** * Convert XML into a Action * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -76,9 +73,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Action to XML. - * - * @param \DOMElement|null $parent The element we should append this Action to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Advice.php b/src/XML/saml/Advice.php index 192176337..eff42e4b4 100644 --- a/src/XML/saml/Advice.php +++ b/src/XML/saml/Advice.php @@ -26,7 +26,7 @@ final class Advice extends AbstractSamlElement implements SchemaValidatableEleme /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const string XS_ANY_ELT_NAMESPACE = NS::OTHER; /** @@ -34,7 +34,7 @@ final class Advice extends AbstractSamlElement implements SchemaValidatableEleme * @param \SimpleSAML\SAML2\XML\saml\AssertionURIRef[] $assertionURIRef * @param \SimpleSAML\SAML2\XML\saml\Assertion[] $assertion * @param \SimpleSAML\SAML2\XML\saml\EncryptedAssertion[] $encryptedAssertion - * @param \SimpleSAML\XML\Chunk[] $elements + * @param \SimpleSAML\XML\SerializableElementInterface[] $elements */ public function __construct( protected array $assertionIDRef = [], @@ -58,8 +58,6 @@ public function __construct( /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -110,9 +108,6 @@ public function getEncryptedAssertion(): array /** * Convert XML into an Advice * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ @@ -143,9 +138,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Advince to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Condition. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Assertion.php b/src/XML/saml/Assertion.php index 64af86bab..ba39b8178 100644 --- a/src/XML/saml/Assertion.php +++ b/src/XML/saml/Assertion.php @@ -55,15 +55,10 @@ final class Assertion extends AbstractSamlElement implements use SignedElementTrait; - /** - * @var bool - */ protected bool $wasSignedAtConstruction = false; /** * The original signed XML - * - * @var \DOMElement */ protected DOMElement $xml; @@ -184,7 +179,6 @@ public function getIssuer(): Issuer /** - * @return bool */ public function wasSignedAtConstruction(): bool { @@ -194,8 +188,6 @@ public function wasSignedAtConstruction(): bool /** * Get the XML element. - * - * @return \DOMElement */ public function getXML(): DOMElement { @@ -205,8 +197,6 @@ public function getXML(): DOMElement /** * Set the XML element. - * - * @param \DOMElement $xml */ private function setXML(DOMElement $xml): void { @@ -215,7 +205,6 @@ private function setXML(DOMElement $xml): void /** - * @return \DOMElement */ protected function getOriginalXML(): DOMElement { @@ -223,6 +212,9 @@ protected function getOriginalXML(): DOMElement } + /** + * @return \SimpleSAML\XMLSecurity\Backend\EncryptionBackend|null + */ public function getEncryptionBackend(): ?EncryptionBackend { // return the encryption backend you want to use, @@ -234,9 +226,6 @@ public function getEncryptionBackend(): ?EncryptionBackend /** * Convert XML into an Assertion * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong @@ -306,8 +295,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this assertion to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { @@ -332,9 +319,6 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement /** * Convert this assertion to a signed XML element, if a signer was set. * - * @param \DOMElement|null $parent The DOM node the assertion should be created in. - * - * @return \DOMElement This assertion. * @throws \Exception */ public function toXML(?DOMElement $parent = null): DOMElement diff --git a/src/XML/saml/AssertionIDRef.php b/src/XML/saml/AssertionIDRef.php index 71d09e9bd..41b3085ea 100644 --- a/src/XML/saml/AssertionIDRef.php +++ b/src/XML/saml/AssertionIDRef.php @@ -20,6 +20,5 @@ final class AssertionIDRef extends AbstractSamlElement implements SchemaValidata use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = NCNameValue::class; + public const string TEXTCONTENT_TYPE = NCNameValue::class; } diff --git a/src/XML/saml/AssertionURIRef.php b/src/XML/saml/AssertionURIRef.php index b4d4e8a95..4d8315469 100644 --- a/src/XML/saml/AssertionURIRef.php +++ b/src/XML/saml/AssertionURIRef.php @@ -20,6 +20,5 @@ final class AssertionURIRef extends AbstractSamlElement implements SchemaValidat use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/Attribute.php b/src/XML/saml/Attribute.php index a0900bc7d..9e6cda6b0 100644 --- a/src/XML/saml/Attribute.php +++ b/src/XML/saml/Attribute.php @@ -35,7 +35,7 @@ class Attribute extends AbstractSamlElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -45,7 +45,7 @@ class Attribute extends AbstractSamlElement implements * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $nameFormat * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $friendlyName * @param \SimpleSAML\SAML2\XML\saml\AttributeValue[] $attributeValue - * @param list<\SimpleSAML\XML\Attribute> $namespacedAttribute + * @param \SimpleSAML\XML\Attribute[] $namespacedAttribute */ public function __construct( protected SAMLStringValue $name, @@ -120,6 +120,9 @@ public function getAttributeValues(): array } + /** + * @return \SimpleSAML\XMLSecurity\Backend\EncryptionBackend|null + */ public function getEncryptionBackend(): ?EncryptionBackend { // return the encryption backend you want to use, @@ -131,9 +134,6 @@ public function getEncryptionBackend(): ?EncryptionBackend /** * Convert XML into a Attribute * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -156,9 +156,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Attribute to XML. - * - * @param \DOMElement|null $parent The element we should append this Attribute to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AttributeStatement.php b/src/XML/saml/AttributeStatement.php index c1161fd5a..4c194adea 100644 --- a/src/XML/saml/AttributeStatement.php +++ b/src/XML/saml/AttributeStatement.php @@ -58,7 +58,6 @@ public function getEncryptedAttributes(): array /** - * @return bool */ public function hasEncryptedAttributes(): bool { @@ -67,9 +66,6 @@ public function hasEncryptedAttributes(): bool /** - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -87,9 +83,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Attribute to XML. - * - * @param \DOMElement|null $parent The element we should append this Attribute to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AttributeValue.php b/src/XML/saml/AttributeValue.php index 480c9fbe4..8da001068 100644 --- a/src/XML/saml/AttributeValue.php +++ b/src/XML/saml/AttributeValue.php @@ -35,13 +35,6 @@ class AttributeValue extends AbstractSamlElement implements SchemaValidatableEle /** * Create an AttributeValue. * - * The value of this element. Can be one of: - * - string - * - int - * - null - * - \DateTimeInterface - * - \SimpleSAML\XML\AbstractElement - * * @param string|int|null|\DateTimeInterface|\SimpleSAML\XML\AbstractElement $value * @throws \SimpleSAML\Assert\AssertionFailedException if the supplied value is neither a string or a DOMElement */ @@ -53,8 +46,6 @@ final public function __construct( /** * Get the XSI type of this attribute value. - * - * @return string */ public function getXsiType(): string { @@ -96,9 +87,6 @@ public function getValue() /** * Convert XML into a AttributeValue * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -158,10 +146,6 @@ public static function fromXML(DOMElement $xml): static /** * Append this attribute value to an element. - * - * @param \DOMElement|null $parent The element we should append this attribute value to. - * - * @return \DOMElement The generated AttributeValue element. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Audience.php b/src/XML/saml/Audience.php index b7d8f5176..887e9e670 100644 --- a/src/XML/saml/Audience.php +++ b/src/XML/saml/Audience.php @@ -20,6 +20,5 @@ final class Audience extends AbstractSamlElement implements SchemaValidatableEle use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AudienceRestriction.php b/src/XML/saml/AudienceRestriction.php index b3be527ee..f5d1d11fd 100644 --- a/src/XML/saml/AudienceRestriction.php +++ b/src/XML/saml/AudienceRestriction.php @@ -50,9 +50,6 @@ public function getAudience(): array /** * Convert XML into an AudienceRestriction * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -69,9 +66,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Audience to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this AudienceRestriction. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AuthenticatingAuthority.php b/src/XML/saml/AuthenticatingAuthority.php index 5b970104b..6a2e125a9 100644 --- a/src/XML/saml/AuthenticatingAuthority.php +++ b/src/XML/saml/AuthenticatingAuthority.php @@ -20,6 +20,5 @@ final class AuthenticatingAuthority extends AbstractSamlElement implements Schem use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = EntityIDValue::class; + public const string TEXTCONTENT_TYPE = EntityIDValue::class; } diff --git a/src/XML/saml/AuthnContext.php b/src/XML/saml/AuthnContext.php index c99d90182..53dd34ad3 100644 --- a/src/XML/saml/AuthnContext.php +++ b/src/XML/saml/AuthnContext.php @@ -107,9 +107,6 @@ public function getAuthenticatingAuthorities(): array /** * Convert XML into a AuthnContext * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -155,9 +152,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthContextDeclRef to XML. - * - * @param \DOMElement|null $parent The element we should append this AuthnContextDeclRef to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AuthnContextClassRef.php b/src/XML/saml/AuthnContextClassRef.php index a43118b47..493230785 100644 --- a/src/XML/saml/AuthnContextClassRef.php +++ b/src/XML/saml/AuthnContextClassRef.php @@ -20,6 +20,5 @@ final class AuthnContextClassRef extends AbstractSamlElement implements SchemaVa use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AuthnContextDecl.php b/src/XML/saml/AuthnContextDecl.php index 5dc0a1654..bd1cba469 100644 --- a/src/XML/saml/AuthnContextDecl.php +++ b/src/XML/saml/AuthnContextDecl.php @@ -26,10 +26,10 @@ final class AuthnContextDecl extends AbstractSamlElement implements SchemaValida /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const string XS_ANY_ELT_NAMESPACE = NS::ANY; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::ANY; + public const string XS_ANY_ATTR_NAMESPACE = NS::ANY; /** @@ -47,8 +47,6 @@ public function __construct(array $elements = [], array $attributes = []) /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -60,9 +58,6 @@ public function isEmptyElement(): bool /** * Convert XML into a AuthnContextDecl * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -80,9 +75,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthContextDecl to XML. - * - * @param \DOMElement|null $parent The element we should append this AuthnContextDecl to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AuthnContextDeclRef.php b/src/XML/saml/AuthnContextDeclRef.php index 2d1d748fe..306771b3c 100644 --- a/src/XML/saml/AuthnContextDeclRef.php +++ b/src/XML/saml/AuthnContextDeclRef.php @@ -20,6 +20,5 @@ final class AuthnContextDeclRef extends AbstractSamlElement implements SchemaVal use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AuthnStatement.php b/src/XML/saml/AuthnStatement.php index fc4b4b39a..7d6f2ceaa 100644 --- a/src/XML/saml/AuthnStatement.php +++ b/src/XML/saml/AuthnStatement.php @@ -104,9 +104,6 @@ public function getSubjectLocality(): ?SubjectLocality /** * Convert XML into an AuthnStatement * - * @param \DOMElement $xml The XML element we should load - * - * @return static * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -146,9 +143,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthnStatement to XML. - * - * @param \DOMElement|null $parent The element we should append this AuthnStatement to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/AuthzDecisionStatement.php b/src/XML/saml/AuthzDecisionStatement.php index 3d8a1cfcc..2bf2b9409 100644 --- a/src/XML/saml/AuthzDecisionStatement.php +++ b/src/XML/saml/AuthzDecisionStatement.php @@ -96,9 +96,6 @@ public function getEvidence(): ?Evidence /** * Convert XML into an AuthzDecisionStatement * - * @param \DOMElement $xml The XML element we should load - * - * @return static * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -138,9 +135,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AuthzDecisionStatement to XML. - * - * @param \DOMElement|null $parent The element we should append this AuthzDecisionStatement to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Conditions.php b/src/XML/saml/Conditions.php index b704bb71f..bdfdf9cc6 100644 --- a/src/XML/saml/Conditions.php +++ b/src/XML/saml/Conditions.php @@ -127,8 +127,6 @@ public function getProxyRestriction(): ?ProxyRestriction /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -144,9 +142,6 @@ public function isEmptyElement(): bool /** * Convert XML into a Conditions object * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -186,9 +181,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The parent element we should append this element to. - * @return \DOMElement This element, as XML. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Evidence.php b/src/XML/saml/Evidence.php index 446b08191..0abaf24bd 100644 --- a/src/XML/saml/Evidence.php +++ b/src/XML/saml/Evidence.php @@ -47,8 +47,6 @@ public function __construct( /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -98,9 +96,6 @@ public function getEncryptedAssertion(): array /** * Convert XML into an Evidence * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ @@ -130,9 +125,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Evidence to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Condition. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/NameID.php b/src/XML/saml/NameID.php index 8338cc269..9ab843e0f 100644 --- a/src/XML/saml/NameID.php +++ b/src/XML/saml/NameID.php @@ -89,6 +89,9 @@ public function __construct( } + /** + * @return \SimpleSAML\XMLSecurity\Backend\EncryptionBackend + */ public function getEncryptionBackend(): ?EncryptionBackend { // return the encryption backend you want to use, @@ -100,8 +103,13 @@ public function getEncryptionBackend(): ?EncryptionBackend /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'value': string, + * 'NameQualifier'?: string, + * 'SPNameQualifier'?: string, + * 'Format'?: string, + * 'SPProvidedID'?: string, + * } $data */ public static function fromArray(array $data): static { @@ -121,8 +129,20 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'value': string, + * 'NameQualifier'?: string, + * 'SPNameQualifier'?: string, + * 'Format'?: string, + * 'SPProvidedID'?: string, + * } $data + * @return array{ + * 'value': string, + * 'NameQualifier'?: string, + * 'SPNameQualifier'?: string, + * 'Format'?: string, + * 'SPProvidedID'?: string, + * } */ private static function processArrayContents(array $data): array { @@ -172,7 +192,13 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'value': string, + * 'NameQualifier'?: string, + * 'SPNameQualifier'?: string, + * 'Format'?: string, + * 'SPProvidedID'?: string, + * } */ public function toArray(): array { diff --git a/src/XML/saml/NameIDType.php b/src/XML/saml/NameIDType.php index 4f232ad96..a2f586567 100644 --- a/src/XML/saml/NameIDType.php +++ b/src/XML/saml/NameIDType.php @@ -25,8 +25,7 @@ abstract class NameIDType extends AbstractSamlElement implements IdentifierInter use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; /** @@ -74,9 +73,6 @@ public function getSPProvidedID(): ?SAMLStringValue /** * Convert XML into an NameID * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -97,9 +93,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this NameIDType to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this NameIDType. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/OneTimeUse.php b/src/XML/saml/OneTimeUse.php index 269fb283f..f4a8e5ecc 100644 --- a/src/XML/saml/OneTimeUse.php +++ b/src/XML/saml/OneTimeUse.php @@ -23,9 +23,6 @@ final class OneTimeUse extends AbstractConditionType implements SchemaValidatabl /** * Convert XML into an OneTimeUse * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ @@ -40,9 +37,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this OneTimeUse to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this OneTimeUse. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/ProxyRestriction.php b/src/XML/saml/ProxyRestriction.php index 5e3931e1a..20909ed20 100644 --- a/src/XML/saml/ProxyRestriction.php +++ b/src/XML/saml/ProxyRestriction.php @@ -58,9 +58,6 @@ public function getAudience(): array /** - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -78,9 +75,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Condition to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Condition. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/Subject.php b/src/XML/saml/Subject.php index cc07d13a0..aa8a95514 100644 --- a/src/XML/saml/Subject.php +++ b/src/XML/saml/Subject.php @@ -62,9 +62,6 @@ public function getSubjectConfirmation(): array /** * Convert XML into a Subject * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -94,9 +91,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The parent element we should append this element to. - * @return \DOMElement This element, as XML. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/SubjectConfirmation.php b/src/XML/saml/SubjectConfirmation.php index 0e8066037..42c418ca7 100644 --- a/src/XML/saml/SubjectConfirmation.php +++ b/src/XML/saml/SubjectConfirmation.php @@ -67,9 +67,6 @@ public function getSubjectConfirmationData(): ?SubjectConfirmationData /** * Convert XML into a SubjectConfirmation * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -100,9 +97,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this element to XML. - * - * @param \DOMElement|null $parent The parent element we should append this element to. - * @return \DOMElement This element, as XML. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/SubjectConfirmationData.php b/src/XML/saml/SubjectConfirmationData.php index ff7bd1dc0..9cc6a3824 100644 --- a/src/XML/saml/SubjectConfirmationData.php +++ b/src/XML/saml/SubjectConfirmationData.php @@ -27,9 +27,6 @@ final class SubjectConfirmationData extends AbstractSubjectConfirmationData impl /** * Convert XML into a SubjectConfirmationData * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException diff --git a/src/XML/saml/SubjectLocality.php b/src/XML/saml/SubjectLocality.php index 269513353..6d2a3de1d 100644 --- a/src/XML/saml/SubjectLocality.php +++ b/src/XML/saml/SubjectLocality.php @@ -60,8 +60,6 @@ public function getDnsName(): ?DomainValue /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -73,9 +71,6 @@ public function isEmptyElement(): bool /** * Convert XML into a SubjectLocality * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -93,9 +88,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this SubjectLocality to XML. - * - * @param \DOMElement|null $parent The element we should append this SubjectLocality to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/UnknownCondition.php b/src/XML/saml/UnknownCondition.php index cfa38df61..f2e119ad5 100644 --- a/src/XML/saml/UnknownCondition.php +++ b/src/XML/saml/UnknownCondition.php @@ -40,9 +40,6 @@ public function getRawCondition(): Chunk /** * Convert this unknown condition to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this unknown condition. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/UnknownID.php b/src/XML/saml/UnknownID.php index 9b4414661..9f6124279 100644 --- a/src/XML/saml/UnknownID.php +++ b/src/XML/saml/UnknownID.php @@ -45,9 +45,6 @@ public function getRawIdentifier(): Chunk /** * Convert this unknown ID to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this unknown ID. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/saml/UnknownStatement.php b/src/XML/saml/UnknownStatement.php index 1cd4ccd18..8720d90ed 100644 --- a/src/XML/saml/UnknownStatement.php +++ b/src/XML/saml/UnknownStatement.php @@ -40,9 +40,6 @@ public function getRawStatement(): Chunk /** * Convert this unknown statement to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this unknown statement. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AbstractMessage.php b/src/XML/samlp/AbstractMessage.php index c00f21e30..07bbf0fac 100644 --- a/src/XML/samlp/AbstractMessage.php +++ b/src/XML/samlp/AbstractMessage.php @@ -36,14 +36,10 @@ abstract class AbstractMessage extends AbstractSamlpElement implements SignableE } - /** @var bool */ protected bool $messageContainedSignatureUponConstruction = false; /** * The original signed XML - * - * @var \DOMElement - * @psalm-suppress PropertyNotSetInConstructor */ protected DOMElement $xml; @@ -132,8 +128,6 @@ public function getIssuer(): ?Issuer /** * Query whether or not the message contained a signature at the root level when the object was constructed. - * - * @return bool */ public function isMessageConstructedWithSignature(): bool { @@ -143,8 +137,6 @@ public function isMessageConstructedWithSignature(): bool /** * Get the XML element. - * - * @return \DOMElement */ public function getXML(): DOMElement { @@ -154,8 +146,6 @@ public function getXML(): DOMElement /** * Set the XML element. - * - * @param \DOMElement $xml */ protected function setXML(DOMElement $xml): void { @@ -164,7 +154,6 @@ protected function setXML(DOMElement $xml): void /** - * @return \DOMElement */ protected function getOriginalXML(): DOMElement { @@ -175,17 +164,11 @@ protected function getOriginalXML(): DOMElement /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { $root = $this->instantiateParentElement($parent); - /* Ugly hack to add another namespace declaration to the root element. */ -// $root->setAttributeNS(C::NS_SAML, 'saml:tmp', 'tmp'); -// $root->removeAttributeNS(C::NS_SAML, 'tmp'); - $root->setAttribute('Version', '2.0'); $root->setAttribute('ID', $this->getId()->getValue()); $root->setAttribute('IssueInstant', $this->getIssueInstant()->getValue()); @@ -211,9 +194,6 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement /** * Create XML from this class - * - * @param \DOMElement|null $parent - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AbstractSamlpElement.php b/src/XML/samlp/AbstractSamlpElement.php index 865faf66d..1ccfaa3f7 100644 --- a/src/XML/samlp/AbstractSamlpElement.php +++ b/src/XML/samlp/AbstractSamlpElement.php @@ -14,12 +14,9 @@ */ abstract class AbstractSamlpElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_SAMLP; + public const string NS = C::NS_SAMLP; - /** @var string */ - public const NS_PREFIX = 'samlp'; + public const string NS_PREFIX = 'samlp'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-schema-protocol-2.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-schema-protocol-2.0.xsd'; } diff --git a/src/XML/samlp/AbstractStatusResponse.php b/src/XML/samlp/AbstractStatusResponse.php index e4e05d324..f0ede126e 100644 --- a/src/XML/samlp/AbstractStatusResponse.php +++ b/src/XML/samlp/AbstractStatusResponse.php @@ -88,8 +88,6 @@ public function getStatus(): Status /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AbstractSubjectQuery.php b/src/XML/samlp/AbstractSubjectQuery.php index ff0bfbba3..49f41af49 100644 --- a/src/XML/samlp/AbstractSubjectQuery.php +++ b/src/XML/samlp/AbstractSubjectQuery.php @@ -63,8 +63,6 @@ public function getSubject(): Subject /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/Artifact.php b/src/XML/samlp/Artifact.php index 4d5a7cb71..e673688dd 100644 --- a/src/XML/samlp/Artifact.php +++ b/src/XML/samlp/Artifact.php @@ -20,6 +20,5 @@ final class Artifact extends AbstractSamlpElement implements SchemaValidatableEl use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = Base64BinaryValue::class; + public const string TEXTCONTENT_TYPE = Base64BinaryValue::class; } diff --git a/src/XML/samlp/ArtifactResolve.php b/src/XML/samlp/ArtifactResolve.php index 5106e0d5c..bd2a4115b 100644 --- a/src/XML/samlp/ArtifactResolve.php +++ b/src/XML/samlp/ArtifactResolve.php @@ -72,9 +72,6 @@ public function getArtifact(): Artifact /** * Create a class from XML * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -131,8 +128,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/ArtifactResponse.php b/src/XML/samlp/ArtifactResponse.php index af3b9eca4..02cfad626 100644 --- a/src/XML/samlp/ArtifactResponse.php +++ b/src/XML/samlp/ArtifactResponse.php @@ -86,9 +86,6 @@ public function getMessage(): ?AbstractMessage /** * Convert XML into an ArtifactResponse * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -163,8 +160,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AssertionIDRequest.php b/src/XML/samlp/AssertionIDRequest.php index e1bae46c6..3cfa5ca62 100644 --- a/src/XML/samlp/AssertionIDRequest.php +++ b/src/XML/samlp/AssertionIDRequest.php @@ -80,9 +80,6 @@ public function getAssertionIDRef(): array /** * Convert XML into a AssertionIDRequest element * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ @@ -144,9 +141,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this AssertionIDRequest element to XML. - * - * @param \DOMElement|null $parent The element we should append this AssertionIDRequest element to. - * @return \DOMElement */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AttributeQuery.php b/src/XML/samlp/AttributeQuery.php index d4681a05f..0b223457c 100644 --- a/src/XML/samlp/AttributeQuery.php +++ b/src/XML/samlp/AttributeQuery.php @@ -106,9 +106,6 @@ public function getAttributes(): array /** * Create a class from XML * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -173,8 +170,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AuthnQuery.php b/src/XML/samlp/AuthnQuery.php index 57a77fc0a..90e2a643a 100644 --- a/src/XML/samlp/AuthnQuery.php +++ b/src/XML/samlp/AuthnQuery.php @@ -88,9 +88,6 @@ public function getSessionIndex(): ?SAMLStringValue /** * Create a class from XML * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -158,8 +155,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AuthnRequest.php b/src/XML/samlp/AuthnRequest.php index 28d97f158..5a10d71d4 100644 --- a/src/XML/samlp/AuthnRequest.php +++ b/src/XML/samlp/AuthnRequest.php @@ -58,6 +58,7 @@ class AuthnRequest extends AbstractRequest implements SchemaValidatableElementIn * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions * @param \SimpleSAML\SAML2\XML\samlp\Scoping|null $scoping + * * @throws \Exception */ final public function __construct( @@ -228,9 +229,6 @@ public function getRequestedAuthnContext(): ?RequestedAuthnContext /** * Convert XML into an AuthnRequest * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -330,8 +328,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/AuthzDecisionQuery.php b/src/XML/samlp/AuthzDecisionQuery.php index b4e3da51c..411a1c28c 100644 --- a/src/XML/samlp/AuthzDecisionQuery.php +++ b/src/XML/samlp/AuthzDecisionQuery.php @@ -84,7 +84,7 @@ public function getResource(): SAMLAnyURIValue /** * Collect the value of the action-property * - * @return array + * @return \SimpleSAML\SAML2\XML\saml\Action[] */ public function getAction(): array { @@ -106,9 +106,6 @@ public function getEvidence(): ?Evidence /** * Convert XML into an AuthzDecisionQuery * - * @param \DOMElement $xml The XML element we should load - * - * @return static * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -188,8 +185,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/Extensions.php b/src/XML/samlp/Extensions.php index 69692479e..e052e190e 100644 --- a/src/XML/samlp/Extensions.php +++ b/src/XML/samlp/Extensions.php @@ -30,9 +30,6 @@ final class Extensions extends AbstractSamlpElement implements SchemaValidatable * For those supported extensions, an object of the corresponding class will be created. The rest will be added * as a \SimpleSAML\XML\Chunk object. * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ diff --git a/src/XML/samlp/GetComplete.php b/src/XML/samlp/GetComplete.php index ba9946c85..925e75d18 100644 --- a/src/XML/samlp/GetComplete.php +++ b/src/XML/samlp/GetComplete.php @@ -25,15 +25,13 @@ final class GetComplete extends AbstractSamlpElement implements SchemaValidatabl use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + public const string TEXTCONTENT_TYPE = SAMLAnyURIValue::class; /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { @@ -49,7 +47,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array */ public function toArray(): array { diff --git a/src/XML/samlp/IDPEntry.php b/src/XML/samlp/IDPEntry.php index 5a3ea9cec..29c3a0290 100644 --- a/src/XML/samlp/IDPEntry.php +++ b/src/XML/samlp/IDPEntry.php @@ -74,9 +74,6 @@ public function getLoc(): ?SAMLAnyURIValue /** * Convert XML into a IDPEntry-element * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -97,9 +94,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this IDPEntry to XML. - * - * @param \DOMElement|null $parent The element we should append this IDPEntry to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -121,8 +115,11 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'ProviderID': string, + * 'Name'?: string, + * 'Loc'?: string, + * } $data */ public static function fromArray(array $data): static { @@ -140,8 +137,16 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'ProviderID': string, + * 'Name'?: string, + * 'Loc'?: string, + * } $data + * @return array{ + * 'ProviderID': string, + * 'Name'?: string, + * 'Loc'?: string, + * } */ private static function processArrayContents(array $data): array { @@ -180,7 +185,11 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'ProviderID': string, + * 'Name'?: string, + * 'Loc'?: string, + * } */ public function toArray(): array { diff --git a/src/XML/samlp/IDPList.php b/src/XML/samlp/IDPList.php index 572959332..2ca484b4f 100644 --- a/src/XML/samlp/IDPList.php +++ b/src/XML/samlp/IDPList.php @@ -67,9 +67,6 @@ public function getGetComplete(): ?GetComplete /** * Convert XML into a IDPList-element * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException @@ -107,9 +104,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this IDPList to XML. - * - * @param \DOMElement|null $parent The element we should append this IDPList to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -128,8 +122,10 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'IDPEntry': string, + * 'GetComplete'?: string, + * } $data */ public static function fromArray(array $data): static { @@ -146,8 +142,14 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'IDPEntry': string, + * 'GetComplete'?: string, + * } $data + * @return array{ + * 'IDPEntry': string, + * 'GetComplete'?: string, + * } */ private static function processArrayContents(array $data): array { @@ -183,7 +185,10 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'IDPEntry': string, + * 'GetComplete'?: string, + * } */ public function toArray(): array { diff --git a/src/XML/samlp/LogoutRequest.php b/src/XML/samlp/LogoutRequest.php index 196b11d1e..305d6fccb 100644 --- a/src/XML/samlp/LogoutRequest.php +++ b/src/XML/samlp/LogoutRequest.php @@ -52,6 +52,7 @@ final class LogoutRequest extends AbstractRequest implements SchemaValidatableEl * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions + * * @throws \Exception */ public function __construct( @@ -112,9 +113,6 @@ public function getSessionIndexes(): array /** * Convert XML into a LogoutRequest * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -188,8 +186,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this message to an unsigned XML document. * This method does not sign the resulting XML document. - * - * @return \DOMElement The root element of the DOM tree */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/LogoutResponse.php b/src/XML/samlp/LogoutResponse.php index 52bf38ac9..0c1e39a3b 100644 --- a/src/XML/samlp/LogoutResponse.php +++ b/src/XML/samlp/LogoutResponse.php @@ -72,9 +72,6 @@ public function __construct( /** * Convert XML into an LogoutResponse * - * @param \DOMElement $xml - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException diff --git a/src/XML/samlp/MessageFactory.php b/src/XML/samlp/MessageFactory.php index 01f0586b4..0b0ed0df3 100644 --- a/src/XML/samlp/MessageFactory.php +++ b/src/XML/samlp/MessageFactory.php @@ -21,9 +21,6 @@ abstract class MessageFactory /** * Convert an XML element into a message. * - * @param \DOMElement $xml The root XML element - * @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The message - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ diff --git a/src/XML/samlp/NameIDPolicy.php b/src/XML/samlp/NameIDPolicy.php index e386ccc35..4308d1422 100644 --- a/src/XML/samlp/NameIDPolicy.php +++ b/src/XML/samlp/NameIDPolicy.php @@ -77,8 +77,6 @@ public function getAllowCreate(): ?BooleanValue /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -91,9 +89,6 @@ public function isEmptyElement(): bool /** * Convert XML into a NameIDPolicy * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -116,9 +111,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this NameIDPolicy to XML. - * - * @param \DOMElement|null $parent The element we should append this NameIDPolicy to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { @@ -143,8 +135,11 @@ public function toXML(?DOMElement $parent = null): DOMElement /** * Create a class from an array * - * @param array $data - * @return static + * @param array{ + * 'Format'?: string, + * 'SPNameQualifier'?: string, + * 'AllowCreate'?: string, + * } $data */ public static function fromArray(array $data): static { @@ -162,8 +157,16 @@ public static function fromArray(array $data): static * Validates an array representation of this object and returns the same array with * rationalized keys (casing) and parsed sub-elements. * - * @param array $data - * @return array $data + * @param array{ + * 'Format'?: string, + * 'SPNameQualifier'?: string, + * 'AllowCreate'?: string, + * } $data + * @return array{ + * 'Format'?: string, + * 'SPNameQualifier'?: string, + * 'AllowCreate'?: string, + * } */ private static function processArrayContents(array $data): array { @@ -201,7 +204,11 @@ private static function processArrayContents(array $data): array /** * Create an array from this class * - * @return array + * @return array{ + * 'Format'?: string, + * 'SPNameQualifier'?: string, + * 'AllowCreate'?: string, + * } */ public function toArray(): array { diff --git a/src/XML/samlp/NewEncryptedID.php b/src/XML/samlp/NewEncryptedID.php index 5e7c21653..81e951bca 100644 --- a/src/XML/samlp/NewEncryptedID.php +++ b/src/XML/samlp/NewEncryptedID.php @@ -30,14 +30,11 @@ final class NewEncryptedID extends AbstractEncryptedElement implements use SchemaValidatableElementTrait; - /** @var string */ - public const NS = C::NS_SAMLP; + public const string NS = C::NS_SAMLP; - /** @var string */ - public const NS_PREFIX = 'samlp'; + public const string NS_PREFIX = 'samlp'; - /** @var string */ - public const SCHEMA = 'resources/schemas/saml-schema-protocol-2.0.xsd'; + public const string SCHEMA = 'resources/schemas/saml-schema-protocol-2.0.xsd'; /** diff --git a/src/XML/samlp/NewID.php b/src/XML/samlp/NewID.php index f856f9a37..5342854ad 100644 --- a/src/XML/samlp/NewID.php +++ b/src/XML/samlp/NewID.php @@ -20,6 +20,5 @@ final class NewID extends AbstractSamlpElement implements SchemaValidatableEleme use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/samlp/RequestedAuthnContext.php b/src/XML/samlp/RequestedAuthnContext.php index 504b09a99..10c1eb189 100644 --- a/src/XML/samlp/RequestedAuthnContext.php +++ b/src/XML/samlp/RequestedAuthnContext.php @@ -93,9 +93,6 @@ public function getComparison(): ?AuthnContextComparisonTypeValue /** * Convert XML into a RequestedAuthnContext * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ diff --git a/src/XML/samlp/RequesterID.php b/src/XML/samlp/RequesterID.php index a28b0cf9c..cf578690e 100644 --- a/src/XML/samlp/RequesterID.php +++ b/src/XML/samlp/RequesterID.php @@ -24,15 +24,13 @@ final class RequesterID extends AbstractSamlpElement implements SchemaValidatabl use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = EntityIDValue::class; + public const string TEXTCONTENT_TYPE = EntityIDValue::class; /** * Create a class from an array * - * @param array $data - * @return static + * @param array $data */ public static function fromArray(array $data): static { @@ -48,7 +46,7 @@ public static function fromArray(array $data): static /** * Create an array from this class * - * @return array + * @return array */ public function toArray(): array { diff --git a/src/XML/samlp/Response.php b/src/XML/samlp/Response.php index 1f7afcc28..c529b8404 100644 --- a/src/XML/samlp/Response.php +++ b/src/XML/samlp/Response.php @@ -92,9 +92,6 @@ public function getAssertions(): array /** * Convert XML into a Response element. * - * @param \DOMElement $xml The input message. - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -153,8 +150,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert the response message to an XML element. - * - * @return \DOMElement This response. */ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/Scoping.php b/src/XML/samlp/Scoping.php index 3dfcd6d54..261128f34 100644 --- a/src/XML/samlp/Scoping.php +++ b/src/XML/samlp/Scoping.php @@ -71,8 +71,6 @@ public function getProxyCount(): ?NonNegativeIntegerValue /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -85,9 +83,6 @@ public function isEmptyElement(): bool /** * Convert XML into a Scoping-element * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -109,9 +104,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Scoping to XML. - * - * @param \DOMElement|null $parent The element we should append this Scoping to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/SessionIndex.php b/src/XML/samlp/SessionIndex.php index 747c254a1..319a35c9b 100644 --- a/src/XML/samlp/SessionIndex.php +++ b/src/XML/samlp/SessionIndex.php @@ -20,6 +20,5 @@ final class SessionIndex extends AbstractSamlpElement implements SchemaValidatab use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/samlp/Status.php b/src/XML/samlp/Status.php index 92fd1cc5c..1adc2dcad 100644 --- a/src/XML/samlp/Status.php +++ b/src/XML/samlp/Status.php @@ -91,9 +91,6 @@ public function getStatusDetails(): array /** * Convert XML into a Status * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException @@ -125,9 +122,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Status to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Status. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/StatusCode.php b/src/XML/samlp/StatusCode.php index 478df0255..e00487f76 100644 --- a/src/XML/samlp/StatusCode.php +++ b/src/XML/samlp/StatusCode.php @@ -64,9 +64,6 @@ public function getSubCodes(): array /** * Convert XML into a StatusCode * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException @@ -86,9 +83,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this StatusCode to XML. - * - * @param \DOMElement|null $parent The element we should append this StatusCode to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/StatusDetail.php b/src/XML/samlp/StatusDetail.php index fc88ac208..47d9b759c 100644 --- a/src/XML/samlp/StatusDetail.php +++ b/src/XML/samlp/StatusDetail.php @@ -24,13 +24,13 @@ final class StatusDetail extends AbstractSamlpElement implements SchemaValidatab /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const string XS_ANY_ELT_NAMESPACE = NS::ANY; /** * Initialize a samlp:StatusDetail * - * @param \SimpleSAML\XML\Chunk[] $details + * @param \SimpleSAML\XML\SerializableElementInterface[] $details */ public function __construct(array $details = []) { @@ -40,8 +40,6 @@ public function __construct(array $details = []) /** * Test if an object, at the state it's in, would produce an empty XML-element - * - * @return bool */ public function isEmptyElement(): bool { @@ -52,9 +50,6 @@ public function isEmptyElement(): bool /** * Convert XML into a StatusDetail * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -71,9 +66,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this StatusDetail to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this StatusDetail. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/samlp/StatusMessage.php b/src/XML/samlp/StatusMessage.php index 03c1e868e..07453ada5 100644 --- a/src/XML/samlp/StatusMessage.php +++ b/src/XML/samlp/StatusMessage.php @@ -20,6 +20,5 @@ final class StatusMessage extends AbstractSamlpElement implements SchemaValidata use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/samlp/Terminate.php b/src/XML/samlp/Terminate.php index 343321309..eb528281a 100644 --- a/src/XML/samlp/Terminate.php +++ b/src/XML/samlp/Terminate.php @@ -23,9 +23,6 @@ final class Terminate extends AbstractSamlpElement implements SchemaValidatableE /** * Convert XML into a Terminate * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -40,9 +37,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Terminate to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Terminate. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/shibmd/AbstractShibmdElement.php b/src/XML/shibmd/AbstractShibmdElement.php index c9d20a77c..1a83530c3 100644 --- a/src/XML/shibmd/AbstractShibmdElement.php +++ b/src/XML/shibmd/AbstractShibmdElement.php @@ -14,12 +14,9 @@ */ abstract class AbstractShibmdElement extends AbstractElement { - /** @var string */ - public const NS = C::NS_SHIBMD; + public const string NS = C::NS_SHIBMD; - /** @var string */ - public const NS_PREFIX = 'shibmd'; + public const string NS_PREFIX = 'shibmd'; - /** @var string */ - public const SCHEMA = 'resources/schemas/sstc-saml-metadata-shibmd-v1.0.xsd'; + public const string SCHEMA = 'resources/schemas/sstc-saml-metadata-shibmd-v1.0.xsd'; } diff --git a/src/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index fd39bfb52..ae841d546 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -30,7 +30,7 @@ final class KeyAuthority extends AbstractShibmdElement implements SchemaValidata /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const string XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** @@ -76,9 +76,6 @@ public function getKeys(): array /** * Convert XML into a KeyAuthority * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -98,9 +95,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this KeyAuthority to XML. - * - * @param \DOMElement|null $parent The element we should append this KeyAuthority to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/src/XML/shibmd/Scope.php b/src/XML/shibmd/Scope.php index 415170ec8..b9504c389 100644 --- a/src/XML/shibmd/Scope.php +++ b/src/XML/shibmd/Scope.php @@ -25,8 +25,7 @@ final class Scope extends AbstractShibmdElement implements SchemaValidatableElem use TypedTextContentTrait; - /** @var string */ - public const TEXTCONTENT_TYPE = SAMLStringValue::class; + public const string TEXTCONTENT_TYPE = SAMLStringValue::class; /** @@ -57,9 +56,6 @@ public function isRegexpScope(): ?BooleanValue /** * Convert XML into a Scope * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -77,9 +73,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Scope to XML. - * - * @param \DOMElement|null $parent The element we should append this Scope to. - * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php index 221894d47..651c6c1b0 100644 --- a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php +++ b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php @@ -77,8 +77,7 @@ final class NameIdDecryptionTransformerTest extends TestCase protected static Response $response; - /** @var string */ - private const FRAMEWORK = 'vendor/simplesamlphp/xml-security'; + private const string FRAMEWORK = 'vendor/simplesamlphp/xml-security'; /** diff --git a/tests/SAML2/Constants.php b/tests/SAML2/Constants.php index f117e1954..2271eb66d 100644 --- a/tests/SAML2/Constants.php +++ b/tests/SAML2/Constants.php @@ -11,33 +11,33 @@ */ class Constants extends \SimpleSAML\SAML2\Constants { - public const ENTITY_IDP = 'https://simplesamlphp.org/idp/metadata'; + public const string ENTITY_IDP = 'https://simplesamlphp.org/idp/metadata'; - public const ENTITY_SP = 'https://simplesamlphp.org/sp/metadata'; + public const string ENTITY_SP = 'https://simplesamlphp.org/sp/metadata'; - public const ENTITY_OTHER = 'https://example.org/metadata'; + public const string ENTITY_OTHER = 'https://example.org/metadata'; - public const ENTITY_URN = 'urn:x-simplesamlphp:phpunit:entity'; + public const string ENTITY_URN = 'urn:x-simplesamlphp:phpunit:entity'; - public const AUTHNCONTEXT_CLASS_REF_LOA1 = 'https://simplesamlphp.org/loa1'; + public const string AUTHNCONTEXT_CLASS_REF_LOA1 = 'https://simplesamlphp.org/loa1'; - public const AUTHNCONTEXT_CLASS_REF_LOA2 = 'https://simplesamlphp.org/loa2'; + public const string AUTHNCONTEXT_CLASS_REF_LOA2 = 'https://simplesamlphp.org/loa2'; - public const AUTHNCONTEXT_CLASS_REF_URN = 'urn:x-simplesamlphp:phpunit:loa3'; + public const string AUTHNCONTEXT_CLASS_REF_URN = 'urn:x-simplesamlphp:phpunit:loa3'; - public const ATTR_URN = 'urn:x-simplesamlphp:phpunit:attribute'; + public const string ATTR_URN = 'urn:x-simplesamlphp:phpunit:attribute'; - public const LOCATION_A = 'https://simplesamlphp.org/some/endpoint'; + public const string LOCATION_A = 'https://simplesamlphp.org/some/endpoint'; - public const LOCATION_B = 'https://simplesamlphp.org/other/endpoint'; + public const string LOCATION_B = 'https://simplesamlphp.org/other/endpoint'; - public const NAMESPACE = 'urn:x-simplesamlphp:namespace'; + public const string NAMESPACE = 'urn:x-simplesamlphp:namespace'; - public const PROFILE_1 = 'urn:x-simplesamlphp:profile:one'; + public const string PROFILE_1 = 'urn:x-simplesamlphp:profile:one'; - public const PROFILE_2 = 'urn:x-simplesamlphp:profile:two'; + public const string PROFILE_2 = 'urn:x-simplesamlphp:profile:two'; - public const PROTOCOL = 'urn:x-simplesamlphp:protocol'; + public const string PROTOCOL = 'urn:x-simplesamlphp:protocol'; - public const MSGID = '_s2a0da3504aff978b0f8c80f6a62c713c4a2f64c5b'; + public const string MSGID = '_s2a0da3504aff978b0f8c80f6a62c713c4a2f64c5b'; } diff --git a/tests/SAML2/CustomBaseID.php b/tests/SAML2/CustomBaseID.php index 94b1e4397..25bf79635 100644 --- a/tests/SAML2/CustomBaseID.php +++ b/tests/SAML2/CustomBaseID.php @@ -22,14 +22,11 @@ */ final class CustomBaseID extends AbstractBaseID { - /** @var string */ - protected const XSI_TYPE_NAME = 'CustomBaseIDType'; + protected const string XSI_TYPE_NAME = 'CustomBaseIDType'; - /** @var string */ - protected const XSI_TYPE_NAMESPACE = C::NAMESPACE; + protected const string XSI_TYPE_NAMESPACE = C::NAMESPACE; - /** @var string */ - protected const XSI_TYPE_PREFIX = 'ssp'; + protected const string XSI_TYPE_PREFIX = 'ssp'; /** @@ -94,9 +91,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this BaseID to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this BaseID. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/tests/SAML2/CustomCondition.php b/tests/SAML2/CustomCondition.php index 5c2b20152..f5fbeca47 100644 --- a/tests/SAML2/CustomCondition.php +++ b/tests/SAML2/CustomCondition.php @@ -20,14 +20,11 @@ */ final class CustomCondition extends AbstractCondition { - /** @var string */ - protected const XSI_TYPE_NAME = 'CustomConditionType'; + protected const string XSI_TYPE_NAME = 'CustomConditionType'; - /** @var string */ - protected const XSI_TYPE_NAMESPACE = C::NAMESPACE; + protected const string XSI_TYPE_NAMESPACE = C::NAMESPACE; - /** @var string */ - protected const XSI_TYPE_PREFIX = 'ssp'; + protected const string XSI_TYPE_PREFIX = 'ssp'; /** @@ -62,9 +59,6 @@ public function getAudience(): array /** * Convert XML into a Condition * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -90,9 +84,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Condition to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Condition. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index f803522c0..4713df233 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -37,17 +37,14 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor use ExtendableElementTrait; - /** @var string */ - protected const XSI_TYPE_NAME = 'CustomRoleDescriptorType'; + protected const string XSI_TYPE_NAME = 'CustomRoleDescriptorType'; - /** @var string */ - protected const XSI_TYPE_NAMESPACE = C::NAMESPACE; + protected const string XSI_TYPE_NAMESPACE = C::NAMESPACE; - /** @var string */ - protected const XSI_TYPE_PREFIX = 'ssp'; + protected const string XSI_TYPE_PREFIX = 'ssp'; /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const string XS_ANY_ELT_NAMESPACE = NS::OTHER; /** @@ -70,7 +67,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor * The organization running this entity. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contact * An array of contacts for this entity. Defaults to an empty array. - * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes + * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ public function __construct( protected array $chunk, @@ -120,9 +117,6 @@ public function getChunk(): array /** * Convert XML into a RoleDescriptor * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -174,9 +168,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this RoleDescriptor to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this RoleDescriptor. */ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { diff --git a/tests/SAML2/CustomStatement.php b/tests/SAML2/CustomStatement.php index 7c2847b0a..2a6313e92 100644 --- a/tests/SAML2/CustomStatement.php +++ b/tests/SAML2/CustomStatement.php @@ -20,14 +20,11 @@ */ final class CustomStatement extends AbstractStatement { - /** @var string */ - protected const XSI_TYPE_NAME = 'CustomStatementType'; + protected const string XSI_TYPE_NAME = 'CustomStatementType'; - /** @var string */ - protected const XSI_TYPE_NAMESPACE = C::NAMESPACE; + protected const string XSI_TYPE_NAMESPACE = C::NAMESPACE; - /** @var string */ - protected const XSI_TYPE_PREFIX = 'ssp'; + protected const string XSI_TYPE_PREFIX = 'ssp'; /** @@ -62,9 +59,6 @@ public function getAudience(): array /** * Convert XML into an Statement * - * @param \DOMElement $xml The XML element we should load - * @return static - * * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ @@ -90,9 +84,6 @@ public static function fromXML(DOMElement $xml): static /** * Convert this Statement to XML. - * - * @param \DOMElement $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this Statement. */ public function toXML(?DOMElement $parent = null): DOMElement { diff --git a/tests/SAML2/XML/md/ContactPersonTest.php b/tests/SAML2/XML/md/ContactPersonTest.php index b6f5de8d4..a1abd8983 100644 --- a/tests/SAML2/XML/md/ContactPersonTest.php +++ b/tests/SAML2/XML/md/ContactPersonTest.php @@ -47,7 +47,6 @@ final class ContactPersonTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument */ private static DOMDocument $ext; @@ -192,7 +191,6 @@ public function testUnmarshallingMultipleCompanies(): void $xmlRepresentation = clone self::$xmlRepresentation; $company = $xmlRepresentation->getElementsByTagNameNS(C::NS_MD, 'Company'); $newCompany = $xmlRepresentation->createElementNS(C::NS_MD, 'Company', 'Alt. Co.'); - /** @psalm-suppress PossiblyNullPropertyFetch */ $xmlRepresentation->documentElement->insertBefore($newCompany, $company->item(0)->nextSibling); $this->expectException(AssertionFailedException::class); @@ -210,7 +208,6 @@ public function testUnmarshallingMultipleGivenNames(): void $xmlRepresentation = clone self::$xmlRepresentation; $givenName = $xmlRepresentation->getElementsByTagNameNS(C::NS_MD, 'GivenName'); $newName = $xmlRepresentation->createElementNS(C::NS_MD, 'GivenName', 'New Name'); - /** @psalm-suppress PossiblyNullPropertyFetch */ $xmlRepresentation->documentElement->insertBefore($newName, $givenName->item(0)->nextSibling); $this->expectException(AssertionFailedException::class); @@ -228,7 +225,6 @@ public function testUnmarshallingMultipleSurNames(): void $xmlRepresentation = clone self::$xmlRepresentation; $surName = $xmlRepresentation->getElementsByTagNameNS(C::NS_MD, 'SurName'); $newName = $xmlRepresentation->createElementNS(C::NS_MD, 'SurName', 'New Name'); - /** @psalm-suppress PossiblyNullPropertyFetch */ $xmlRepresentation->documentElement->insertBefore($newName, $surName->item(0)->nextSibling); $this->expectException(AssertionFailedException::class); diff --git a/tests/SAML2/XML/md/EncryptionMethodTest.php b/tests/SAML2/XML/md/EncryptionMethodTest.php index 70558c3e4..abaa8f4b5 100644 --- a/tests/SAML2/XML/md/EncryptionMethodTest.php +++ b/tests/SAML2/XML/md/EncryptionMethodTest.php @@ -104,6 +104,8 @@ public function testMarshallingWithoutOptionalParameters(): void } + /** + */ public function testMarshallingElementOrdering(): void { $alg = C::KEY_TRANSPORT_OAEP_MGF1P; diff --git a/tests/SAML2/XML/md/EndpointTypeTest.php b/tests/SAML2/XML/md/EndpointTypeTest.php index 81053ebc4..7ca3cc973 100644 --- a/tests/SAML2/XML/md/EndpointTypeTest.php +++ b/tests/SAML2/XML/md/EndpointTypeTest.php @@ -43,7 +43,6 @@ final class EndpointTypeTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument */ private static DOMDocument $ext; diff --git a/tests/SAML2/XML/mdui/LogoTest.php b/tests/SAML2/XML/mdui/LogoTest.php index 6a91b8cbb..8d6beb3ad 100644 --- a/tests/SAML2/XML/mdui/LogoTest.php +++ b/tests/SAML2/XML/mdui/LogoTest.php @@ -38,13 +38,11 @@ final class LogoTest extends TestCase use SerializableElementTestTrait; - /** @var string */ - private const DATA = <<expectException(SignatureVerificationFailedException::class); $this->expectExceptionMessage('Failed to verify signature.'); - $assertion->verify($verifier); + // When PHP 8.5 becomes the minimum: + // (void)$assertion->verify($verifier); + $result = $assertion->verify($verifier); } @@ -819,7 +821,9 @@ public function testVerifySignedAssertionWrongAlgorithm(): void $this->expectException(Exception::class); $this->expectExceptionMessage('Algorithm provided in key does not match algorithm used in signature.'); - $assertion->verify($verifier); + // When PHP 8.5 becomes the minimum: + // (void)$assertion->verify($verifier); + $result = $assertion->verify($verifier); } @@ -840,7 +844,9 @@ public function testVerifySignedAssertionWrongKey(): void $this->expectException(SignatureVerificationFailedException::class); $this->expectExceptionMessage('Failed to verify signature.'); - $assertion->verify($verifier); + // When PHP 8.5 becomes the minimum: + // (void)$assertion->verify($verifier); + $result = $assertion->verify($verifier); } diff --git a/tests/Vulnerabilities/GoldenSAMLResponseTest.php b/tests/Vulnerabilities/GoldenSAMLResponseTest.php index 0bdb1237c..08ad1b500 100644 --- a/tests/Vulnerabilities/GoldenSAMLResponseTest.php +++ b/tests/Vulnerabilities/GoldenSAMLResponseTest.php @@ -33,18 +33,23 @@ public function testSignedResponseWithStrayXmlnsThrowsAnException(): void $response = Response::fromXML($doc->documentElement); $assertion = $response->getAssertions()[0]; + /** @var \SimpleSAML\XMLSecurity\XML\ds\X509Data $data */ + $data = $assertion->getSignature()->getKeyInfo()->getInfo()[0]; $verifier = (new SignatureAlgorithmFactory())->getAlgorithm( $assertion->getSignature()->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(), new PublicKey( new PEM( PEM::TYPE_PUBLIC_KEY, - $assertion->getSignature()->getKeyInfo()->getInfo()[0]->getData()[0]->getContent()->getValue(), + $data->getData()[0]->getContent()->getValue(), ), ), ); $this->expectException(CanonicalizationFailedException::class); + + // When PHP 8.5 becomes the minimum: + // (void)@$assertion->verify($verifier); @$assertion->verify($verifier); } }