diff --git a/ci/qa-config/rector.php b/ci/qa-config/rector.php index 95c60052a7..c4a4d9f570 100644 --- a/ci/qa-config/rector.php +++ b/ci/qa-config/rector.php @@ -33,4 +33,6 @@ \Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class, \Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class, \Rector\Php82\Rector\Class_\ReadOnlyClassRector::class, + \Rector\Php84\Rector\MethodCall\NewMethodCallWithoutParenthesesRector::class, + \Rector\Php84\Rector\Class_\DeprecatedAnnotationToDeprecatedAttributeRector::class, ]); diff --git a/library/EngineBlock/Application/FunctionalTestDiContainer.php b/library/EngineBlock/Application/FunctionalTestDiContainer.php index 7f8f06407b..4e7869c874 100644 --- a/library/EngineBlock/Application/FunctionalTestDiContainer.php +++ b/library/EngineBlock/Application/FunctionalTestDiContainer.php @@ -25,26 +25,31 @@ */ class EngineBlock_Application_FunctionalTestDiContainer extends EngineBlock_Application_DiContainer { + #[Override] public function getUserDirectory() { return new FakeUserDirectory(new Filesystem()); } + #[Override] public function getFeatureConfiguration() { return $this->getSymfonyContainer()->get('engineblock.functional_testing.fixture.features'); } + #[Override] public function getAuthenticationLoopGuard() { return $this->getSymfonyContainer()->get('engineblock.functional_testing.fixture.authentication_loop_guard'); } + #[Override] public function getPdpClient() { return $this->getFunctionalTestingPdpClient(); } + #[Override] public function getPdpClientId() { return 'Federation'; @@ -53,11 +58,13 @@ public function getPdpClientId() /** * @return \OpenConext\EngineBlockBundle\AttributeAggregation\AttributeAggregationClientInterface */ + #[Override] public function getAttributeAggregationClient() { return $this->getSymfonyContainer()->get('engineblock.functional_testing.fixture.attribute_aggregation_client'); } + #[Override] public function getAuthnContextClassRefBlacklistRegex() { return '/invalid-authn-context-class-ref/'; @@ -71,6 +78,7 @@ public function getAuthnContextClassRefBlacklistRegex() * * @return array */ + #[Override] public function getEncryptionKeysConfiguration() { $basePath = $this->container->getParameter('kernel.project_dir'); diff --git a/library/EngineBlock/Application/TestDiContainer.php b/library/EngineBlock/Application/TestDiContainer.php index 68d39f0c35..5097d199b2 100644 --- a/library/EngineBlock/Application/TestDiContainer.php +++ b/library/EngineBlock/Application/TestDiContainer.php @@ -28,21 +28,25 @@ class EngineBlock_Application_TestDiContainer extends EngineBlock_Application_Di */ private $pdpClient; + #[Override] public function getXmlConverter(): EngineBlock_Corto_XmlToArray { return Phake::mock('EngineBlock_Corto_XmlToArray'); } + #[Override] public function getFilterCommandFactory(): EngineBlock_Corto_Filter_Command_Factory { return Phake::mock('EngineBlock_Corto_Filter_Command_Factory'); } + #[Override] public function getDatabaseConnectionFactory(): EngineBlock_Database_ConnectionFactory { return Phake::mock('EngineBlock_Database_ConnectionFactory'); } + #[Override] public function getPdpClient() { return $this->pdpClient ?? parent::getPdpClient(); @@ -53,6 +57,7 @@ public function setPdpClient(?PdpClientInterface $pdpClient) $this->pdpClient = $pdpClient; } + #[Override] public function getConsentFactory(): EngineBlock_Corto_Model_Consent_Factory { $consentFactoryMock = Phake::mock('EngineBlock_Corto_Model_Consent_Factory'); @@ -67,6 +72,7 @@ public function getConsentFactory(): EngineBlock_Corto_Model_Consent_Factory /** * @return EngineBlock_Attributes_Metadata */ + #[Override] public function getAttributeMetadata() { // returns a realistic representation of the attribute metadata @@ -82,6 +88,7 @@ public function getAttributeMetadata() * * @return array */ + #[Override] public function getEncryptionKeysConfiguration() { $basePath = $this->container->getParameter('kernel.project_dir'); diff --git a/library/EngineBlock/Corto/Filter/Command/LogLogin.php b/library/EngineBlock/Corto/Filter/Command/LogLogin.php index ab08849484..0a34ed6bc6 100644 --- a/library/EngineBlock/Corto/Filter/Command/LogLogin.php +++ b/library/EngineBlock/Corto/Filter/Command/LogLogin.php @@ -57,7 +57,7 @@ public function execute() $logAttributes = []; if (!empty($this->configuredLogAttributes)) { foreach ($this->configuredLogAttributes as $attributeLabel => $responseAttributeKey) { - if (array_key_exists($responseAttributeKey, $this->_responseAttributes)) { + if (array_key_exists((string) $responseAttributeKey, $this->_responseAttributes)) { $attributeValues = implode(',', $this->_responseAttributes[$responseAttributeKey]); $logAttributes[$attributeLabel] = $attributeValues; } diff --git a/library/EngineBlock/Corto/Filter/Output.php b/library/EngineBlock/Corto/Filter/Output.php index 6f18f7cda8..88cb02970d 100644 --- a/library/EngineBlock/Corto/Filter/Output.php +++ b/library/EngineBlock/Corto/Filter/Output.php @@ -25,6 +25,7 @@ */ class EngineBlock_Corto_Filter_Output extends EngineBlock_Corto_Filter_Abstract { + #[Override] public function filter( EngineBlock_Saml2_ResponseAnnotationDecorator &$response, array &$responseAttributes, diff --git a/library/EngineBlock/Corto/Mapper/Metadata/Entity/IdpSsoDescriptor.php b/library/EngineBlock/Corto/Mapper/Metadata/Entity/IdpSsoDescriptor.php index fc76760e22..e340d8124f 100644 --- a/library/EngineBlock/Corto/Mapper/Metadata/Entity/IdpSsoDescriptor.php +++ b/library/EngineBlock/Corto/Mapper/Metadata/Entity/IdpSsoDescriptor.php @@ -24,6 +24,7 @@ class EngineBlock_Corto_Mapper_Metadata_Entity_IdpSsoDescriptor extends EngineBl /** * @var AbstractRole */ + #[Override] protected $_entity; public function __construct(AbstractRole $entity) diff --git a/library/EngineBlock/Corto/Mapper/Metadata/Entity/SpSsoDescriptor.php b/library/EngineBlock/Corto/Mapper/Metadata/Entity/SpSsoDescriptor.php index 589dacf479..d851315cb3 100644 --- a/library/EngineBlock/Corto/Mapper/Metadata/Entity/SpSsoDescriptor.php +++ b/library/EngineBlock/Corto/Mapper/Metadata/Entity/SpSsoDescriptor.php @@ -24,6 +24,7 @@ class EngineBlock_Corto_Mapper_Metadata_Entity_SpSsoDescriptor extends EngineBlo /** * @var AbstractRole */ + #[Override] protected $_entity; public function __construct(AbstractRole $entity) diff --git a/library/EngineBlock/Corto/Module/Bindings.php b/library/EngineBlock/Corto/Module/Bindings.php index 82d150bfa9..66780d6256 100644 --- a/library/EngineBlock/Corto/Module/Bindings.php +++ b/library/EngineBlock/Corto/Module/Bindings.php @@ -82,6 +82,7 @@ class EngineBlock_Corto_Module_Bindings extends EngineBlock_Corto_Module_Abstrac /** * @var EngineBlock_Corto_ProxyServer */ + #[Override] protected $_server; /** @@ -895,14 +896,7 @@ protected function getSaml2OwnMetadata($serviceEntityId, $requireEncryption = tr */ private function hasEncryptedAssertion(Response $sspResponse) { - $hasEncryptedAssertion = false; - foreach ($sspResponse->getAssertions() as $assertion) { - if ($assertion instanceof EncryptedAssertion) { - $hasEncryptedAssertion = true; - break; - } - } - return $hasEncryptedAssertion; + return array_any($sspResponse->getAssertions(), fn($assertion) => $assertion instanceof EncryptedAssertion); } /** diff --git a/library/EngineBlock/Saml2/AuthnRequestAnnotationDecorator.php b/library/EngineBlock/Saml2/AuthnRequestAnnotationDecorator.php index 847b4548db..7eacce8539 100644 --- a/library/EngineBlock/Saml2/AuthnRequestAnnotationDecorator.php +++ b/library/EngineBlock/Saml2/AuthnRequestAnnotationDecorator.php @@ -31,6 +31,7 @@ class EngineBlock_Saml2_AuthnRequestAnnotationDecorator extends EngineBlock_Saml /** * @var AuthnRequest */ + #[Override] protected $sspMessage; /** @@ -199,30 +200,45 @@ public function setForceAuthn(bool $isForceAuthn) /** * @return array */ - public function __sleep() + public function __serialize(): array { if ($this->sspMessage instanceof AuthnRequest) { $this->_serializableSspMessageXml = $this->sspMessage->toUnsignedXML()->ownerDocument->saveXML(); $this->_serializableRelayState = $this->sspMessage->getRelayState(); } - return ['keyId', 'wasSigned', 'debug', 'unsolicited', 'transparent', '_serializableSspMessageXml', '_serializableRelayState']; + return [ + 'keyId' => $this->keyId, + 'wasSigned' => $this->wasSigned, + 'debug' => $this->debug, + 'unsolicited' => $this->unsolicited, + 'transparent' => $this->transparent, + '_serializableSspMessageXml' => $this->_serializableSspMessageXml, + '_serializableRelayState' => $this->_serializableRelayState, + ]; } - public function __wakeup() + public function __unserialize(array $data): void { - if (isset($this->_serializableSspMessageXml)) { + foreach ($data as $property => $value) { + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + } + + if ($this->_serializableSspMessageXml !== null) { $document = DOMDocumentFactory::fromString($this->_serializableSspMessageXml); $messageDomElement = $document->getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:protocol', 'AuthnRequest')->item(0); if ($messageDomElement) { $this->sspMessage = AuthnRequest::fromXML($messageDomElement); - if (isset($this->_serializableRelayState) && $this->_serializableRelayState !== null) { + if ($this->_serializableRelayState !== null) { $this->sspMessage->setRelayState($this->_serializableRelayState); } } - unset($this->_serializableSspMessageXml, $this->_serializableRelayState); + $this->_serializableSspMessageXml = null; + $this->_serializableRelayState = null; } } } diff --git a/library/EngineBlock/Saml2/Container.php b/library/EngineBlock/Saml2/Container.php index 66ece2148a..055b814c41 100644 --- a/library/EngineBlock/Saml2/Container.php +++ b/library/EngineBlock/Saml2/Container.php @@ -24,7 +24,7 @@ final class EngineBlock_Saml2_Container extends AbstractContainer /** * The fixed length of random identifiers. */ - const ID_LENGTH = 43; + const int ID_LENGTH = 43; /** * @var LoggerInterface diff --git a/library/EngineBlock/Saml2/ResponseAnnotationDecorator.php b/library/EngineBlock/Saml2/ResponseAnnotationDecorator.php index 5025b84d7b..384ce25830 100644 --- a/library/EngineBlock/Saml2/ResponseAnnotationDecorator.php +++ b/library/EngineBlock/Saml2/ResponseAnnotationDecorator.php @@ -34,6 +34,7 @@ class EngineBlock_Saml2_ResponseAnnotationDecorator extends EngineBlock_Saml2_Me /** * @var Response */ + #[Override] protected $sspMessage; /** @@ -325,7 +326,7 @@ public function setIsTransparentErrorResponse(bool $isTransparentErrorResponse): /** * @return array */ - public function __sleep() + public function __serialize(): array { if ($this->sspMessage instanceof Response) { $this->_serializableSspMessageXml = $this->sspMessage->toUnsignedXML()->ownerDocument->saveXML(); @@ -333,28 +334,34 @@ public function __sleep() } return [ - 'return', - 'originalIssuer', - 'originalNameId', - 'originalBinding', - 'originalResponse', - 'collabPersonId', - 'customNameId', - 'intendedNameId', - 'pdpRequestedLoas', - 'isTransparentErrorResponse', - '_serializableSspMessageXml', - '_serializableRelayState', - 'SramInterruptNonce', + 'return' => $this->return, + 'originalIssuer' => $this->originalIssuer, + 'originalNameId' => $this->originalNameId, + 'originalBinding' => $this->originalBinding, + 'originalResponse' => $this->originalResponse, + 'collabPersonId' => $this->collabPersonId, + 'customNameId' => $this->customNameId, + 'intendedNameId' => $this->intendedNameId, + 'pdpRequestedLoas' => $this->pdpRequestedLoas, + 'isTransparentErrorResponse' => $this->isTransparentErrorResponse, + '_serializableSspMessageXml' => $this->_serializableSspMessageXml, + '_serializableRelayState' => $this->_serializableRelayState, + 'SramInterruptNonce' => $this->SramInterruptNonce, ]; } /** * Custom deserialization to recreate $sspMessage from XML string */ - public function __wakeup() + public function __unserialize(array $data): void { - if (isset($this->_serializableSspMessageXml)) { + foreach ($data as $property => $value) { + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + } + + if ($this->_serializableSspMessageXml !== null) { $document = DOMDocumentFactory::fromString($this->_serializableSspMessageXml); $messageDomElement = $document->getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:protocol', 'Response')->item(0); @@ -362,11 +369,11 @@ public function __wakeup() $this->sspMessage = \OpenConext\EngineBlockFunctionalTestingBundle\Saml2\Response::fromXML($messageDomElement); } - if (isset($this->_serializableRelayState) && $this->_serializableRelayState !== null) { + if ($this->_serializableRelayState !== null) { $this->sspMessage->setRelayState($this->_serializableRelayState); } - unset($this->_serializableSspMessageXml); + $this->_serializableSspMessageXml = null; } } diff --git a/src/Kernel.php b/src/Kernel.php index 35c0dccaf6..28d6ce7b3b 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -18,6 +18,7 @@ namespace App; +use Override; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -30,7 +31,7 @@ class Kernel extends BaseKernel { use MicroKernelTrait; - private const CONFIG_EXTS = '.{yaml,yml}'; + private const string CONFIG_EXTS = '.{yaml,yml}'; public function registerBundles(): iterable { @@ -42,6 +43,7 @@ public function registerBundles(): iterable } } + #[Override] public function getProjectDir(): string { return dirname(__DIR__); diff --git a/src/OpenConext/EngineBlock/Assert/Assertion.php b/src/OpenConext/EngineBlock/Assert/Assertion.php index 27b097671c..dcc2dacd7c 100644 --- a/src/OpenConext/EngineBlock/Assert/Assertion.php +++ b/src/OpenConext/EngineBlock/Assert/Assertion.php @@ -20,6 +20,7 @@ use Assert\Assertion as BaseAssertion; use OpenConext\EngineBlock\Exception\InvalidArgumentException; +use Override; /** * @method static void nullOrNonEmptyString($value, $message = null, $propertyPath = null) @@ -30,6 +31,7 @@ class Assertion extends BaseAssertion const INVALID_NON_EMPTY_STRING = 1001; const INVALID_HASHING_ALGORITHM = 1002; + #[Override] protected static $exceptionClass = InvalidArgumentException::class; /** diff --git a/src/OpenConext/EngineBlock/Authentication/Dto/Consent.php b/src/OpenConext/EngineBlock/Authentication/Dto/Consent.php index a41ab6bf70..d0dc8eaee1 100644 --- a/src/OpenConext/EngineBlock/Authentication/Dto/Consent.php +++ b/src/OpenConext/EngineBlock/Authentication/Dto/Consent.php @@ -25,7 +25,7 @@ final class Consent { - const CONTACT_TYPE_SUPPORT = 'support'; + const string CONTACT_TYPE_SUPPORT = 'support'; /** * @var ConsentEntity diff --git a/src/OpenConext/EngineBlock/Authentication/Value/CollabPersonId.php b/src/OpenConext/EngineBlock/Authentication/Value/CollabPersonId.php index d2e91440c9..71ad2d9ec3 100644 --- a/src/OpenConext/EngineBlock/Authentication/Value/CollabPersonId.php +++ b/src/OpenConext/EngineBlock/Authentication/Value/CollabPersonId.php @@ -26,12 +26,12 @@ final class CollabPersonId /** * Required namespace prefix */ - const URN_NAMESPACE = 'urn:collab:person'; + const string URN_NAMESPACE = 'urn:collab:person'; /** * Max length of the CollabPersonId. */ - const MAX_LENGTH = 255; + const int MAX_LENGTH = 255; private string $collabPersonId; diff --git a/src/OpenConext/EngineBlock/Authentication/Value/SchacHomeOrganization.php b/src/OpenConext/EngineBlock/Authentication/Value/SchacHomeOrganization.php index 985475fc64..6988b27a54 100644 --- a/src/OpenConext/EngineBlock/Authentication/Value/SchacHomeOrganization.php +++ b/src/OpenConext/EngineBlock/Authentication/Value/SchacHomeOrganization.php @@ -26,7 +26,7 @@ */ final class SchacHomeOrganization { - const URN_MACE = 'urn:mace:terena.org:attribute-def:schacHomeOrganization'; + const string URN_MACE = 'urn:mace:terena.org:attribute-def:schacHomeOrganization'; /** * @var string diff --git a/src/OpenConext/EngineBlock/Authentication/Value/Uid.php b/src/OpenConext/EngineBlock/Authentication/Value/Uid.php index 0d972c3d9f..7d8cc367ea 100644 --- a/src/OpenConext/EngineBlock/Authentication/Value/Uid.php +++ b/src/OpenConext/EngineBlock/Authentication/Value/Uid.php @@ -26,7 +26,7 @@ */ final class Uid { - const URN_MACE = 'urn:mace:dir:attribute-def:uid'; + const string URN_MACE = 'urn:mace:dir:attribute-def:uid'; /** * @var string diff --git a/src/OpenConext/EngineBlock/Metadata/Coins.php b/src/OpenConext/EngineBlock/Metadata/Coins.php index 124d0d355d..e6eca6709f 100644 --- a/src/OpenConext/EngineBlock/Metadata/Coins.php +++ b/src/OpenConext/EngineBlock/Metadata/Coins.php @@ -259,7 +259,7 @@ public function azureDomainHint(): ?string private function getValue($key, $default = null) { - if (!array_key_exists($key, $this->values)) { + if (!array_key_exists((string) $key, $this->values)) { return $default; } return $this->values[$key]; diff --git a/src/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssembler.php b/src/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssembler.php index cc0172d2f3..6fddacfbb8 100644 --- a/src/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssembler.php +++ b/src/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssembler.php @@ -64,7 +64,7 @@ class PushMetadataAssembler implements MetadataAssemblerInterface /** * Maximum length that will fit in certain string type fields. */ - private const FIELDS_MAX_LENGTH = 255; + private const int FIELDS_MAX_LENGTH = 255; public function __construct( ValidatorInterface $allowedAcsLocations, diff --git a/src/OpenConext/EngineBlock/Metadata/Entity/IdentityProvider.php b/src/OpenConext/EngineBlock/Metadata/Entity/IdentityProvider.php index 2c42be10b2..75d1846f4b 100644 --- a/src/OpenConext/EngineBlock/Metadata/Entity/IdentityProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Entity/IdentityProvider.php @@ -329,41 +329,41 @@ private function assertAllDiscoveries(array $discoveries): void * * @return array */ - public function __sleep() + public function __serialize(): array { return [ - 'enabledInWayf', - 'singleSignOnServices', - 'consentSettings', - 'shibMdScopes', - 'discoveries', - 'id', - 'entityId', - 'nameNl', - 'nameEn', - 'namePt', - 'descriptionNl', - 'descriptionEn', - 'descriptionPt', - 'displayNameNl', - 'displayNameEn', - 'displayNamePt', - 'logo', - 'organizationNl', - 'organizationEn', - 'organizationPt', - 'keywordsNl', - 'keywordsEn', - 'keywordsPt', - 'workflowState', - 'contactPersons', - 'nameIdFormat', - 'supportedNameIdFormats', - 'singleLogoutService', - 'requestsMustBeSigned', - 'manipulation', - 'coins', - 'mdui', + 'enabledInWayf' => $this->enabledInWayf, + 'singleSignOnServices' => $this->singleSignOnServices, + 'consentSettings' => $this->consentSettings, + 'shibMdScopes' => $this->shibMdScopes, + 'discoveries' => $this->discoveries, + 'id' => $this->id, + 'entityId' => $this->entityId, + 'nameNl' => $this->nameNl, + 'nameEn' => $this->nameEn, + 'namePt' => $this->namePt, + 'descriptionNl' => $this->descriptionNl, + 'descriptionEn' => $this->descriptionEn, + 'descriptionPt' => $this->descriptionPt, + 'displayNameNl' => $this->displayNameNl, + 'displayNameEn' => $this->displayNameEn, + 'displayNamePt' => $this->displayNamePt, + 'logo' => $this->logo, + 'organizationNl' => $this->organizationNl, + 'organizationEn' => $this->organizationEn, + 'organizationPt' => $this->organizationPt, + 'keywordsNl' => $this->keywordsNl, + 'keywordsEn' => $this->keywordsEn, + 'keywordsPt' => $this->keywordsPt, + 'workflowState' => $this->workflowState, + 'contactPersons' => $this->contactPersons, + 'nameIdFormat' => $this->nameIdFormat, + 'supportedNameIdFormats' => $this->supportedNameIdFormats, + 'singleLogoutService' => $this->singleLogoutService, + 'requestsMustBeSigned' => $this->requestsMustBeSigned, + 'manipulation' => $this->manipulation, + 'coins' => $this->coins, + 'mdui' => $this->mdui, ]; } } diff --git a/src/OpenConext/EngineBlock/Metadata/Entity/ServiceProvider.php b/src/OpenConext/EngineBlock/Metadata/Entity/ServiceProvider.php index 7e80a580d8..7d81229c2b 100644 --- a/src/OpenConext/EngineBlock/Metadata/Entity/ServiceProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Entity/ServiceProvider.php @@ -371,44 +371,44 @@ public function isAttributeAggregationRequired() * * @return array */ - public function __sleep() + public function __serialize(): array { return [ - 'attributeReleasePolicy', - 'assertionConsumerServices', - 'allowedIdpEntityIds', - 'allowAll', - 'requestedAttributes', - 'supportUrlEn', - 'supportUrlNl', - 'supportUrlPt', - 'id', - 'entityId', - 'nameNl', - 'nameEn', - 'namePt', - 'descriptionNl', - 'descriptionEn', - 'descriptionPt', - 'displayNameNl', - 'displayNameEn', - 'displayNamePt', - 'logo', - 'organizationNl', - 'organizationEn', - 'organizationPt', - 'keywordsNl', - 'keywordsEn', - 'keywordsPt', - 'workflowState', - 'contactPersons', - 'nameIdFormat', - 'supportedNameIdFormats', - 'singleLogoutService', - 'requestsMustBeSigned', - 'manipulation', - 'coins', - 'mdui', + 'attributeReleasePolicy' => $this->attributeReleasePolicy, + 'assertionConsumerServices' => $this->assertionConsumerServices, + 'allowedIdpEntityIds' => $this->allowedIdpEntityIds, + 'allowAll' => $this->allowAll, + 'requestedAttributes' => $this->requestedAttributes, + 'supportUrlEn' => $this->supportUrlEn, + 'supportUrlNl' => $this->supportUrlNl, + 'supportUrlPt' => $this->supportUrlPt, + 'id' => $this->id, + 'entityId' => $this->entityId, + 'nameNl' => $this->nameNl, + 'nameEn' => $this->nameEn, + 'namePt' => $this->namePt, + 'descriptionNl' => $this->descriptionNl, + 'descriptionEn' => $this->descriptionEn, + 'descriptionPt' => $this->descriptionPt, + 'displayNameNl' => $this->displayNameNl, + 'displayNameEn' => $this->displayNameEn, + 'displayNamePt' => $this->displayNamePt, + 'logo' => $this->logo, + 'organizationNl' => $this->organizationNl, + 'organizationEn' => $this->organizationEn, + 'organizationPt' => $this->organizationPt, + 'keywordsNl' => $this->keywordsNl, + 'keywordsEn' => $this->keywordsEn, + 'keywordsPt' => $this->keywordsPt, + 'workflowState' => $this->workflowState, + 'contactPersons' => $this->contactPersons, + 'nameIdFormat' => $this->nameIdFormat, + 'supportedNameIdFormats' => $this->supportedNameIdFormats, + 'singleLogoutService' => $this->singleLogoutService, + 'requestsMustBeSigned' => $this->requestsMustBeSigned, + 'manipulation' => $this->manipulation, + 'coins' => $this->coins, + 'mdui' => $this->mdui, ]; } } diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProvider.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProvider.php index b0aa14a032..21db5e91c4 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProvider.php @@ -21,6 +21,7 @@ use OpenConext\EngineBlock\Metadata\Service; use OpenConext\EngineBlock\Metadata\X509\X509KeyPair; use OpenConext\EngineBlockBundle\Url\UrlProvider; +use Override; use SAML2\Constants; /** @@ -56,6 +57,7 @@ public function __construct( $this->urlProvider = $urlProvider; } + #[Override] public function getCertificates(): array { $certificates = []; @@ -66,6 +68,7 @@ public function getCertificates(): array return $certificates; } + #[Override] public function getSupportedNameIdFormats(): array { return [ @@ -75,6 +78,7 @@ public function getSupportedNameIdFormats(): array ]; } + #[Override] public function getSingleLogoutService(): ?Service { if (is_null($this->entity->getSingleLogoutService())) { @@ -91,6 +95,7 @@ public function getSingleLogoutService(): ?Service * * @return Service[] */ + #[Override] public function getSingleSignOnServices(): array { $ssoLocation = $this->urlProvider->getUrl('authentication_idp_sso', false, $this->keyId, null); diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php index e315b00c08..d606a991ee 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php @@ -23,6 +23,7 @@ use OpenConext\EngineBlock\Metadata\Factory\ValueObject\EngineBlockConfiguration; use OpenConext\EngineBlock\Metadata\Logo; use OpenConext\EngineBlock\Metadata\Organization; +use Override; /** * This decoration is used to add non functional and strictly informational data to an entity @@ -40,26 +41,31 @@ public function __construct(IdentityProviderEntityInterface $entity, EngineBlock $this->engineBlockConfiguration = $engineBlockConfiguration; } + #[Override] public function getName($locale): string { return $this->engineBlockConfiguration->getName(); } + #[Override] public function getDisplayName($locale): string { return $this->engineBlockConfiguration->getName(); } + #[Override] public function getDescription($locale): string { return $this->engineBlockConfiguration->getDescription(); } + #[Override] public function getLogo(): ?Logo { return $this->engineBlockConfiguration->getLogo(); } + #[Override] public function getOrganization(string $locale): ?Organization { return $this->engineBlockConfiguration->getOrganization($locale); @@ -68,6 +74,7 @@ public function getOrganization(string $locale): ?Organization /** * @return ContactPerson[] */ + #[Override] public function getContactPersons(): array { return $this->engineBlockConfiguration->getContactPersons(); diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProvider.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProvider.php index 33e0280176..3c80fb7864 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProvider.php @@ -23,6 +23,7 @@ use OpenConext\EngineBlock\Metadata\RequestedAttribute; use OpenConext\EngineBlock\Metadata\X509\X509KeyPair; use OpenConext\EngineBlockBundle\Url\UrlProvider; +use Override; use SAML2\Constants; /** @@ -60,6 +61,7 @@ public function __construct( } + #[Override] public function getCertificates(): array { $certificates = []; @@ -73,6 +75,7 @@ public function getCertificates(): array /** * @return string[] */ + #[Override] public function getSupportedNameIdFormats(): array { return [ @@ -85,16 +88,19 @@ public function getSupportedNameIdFormats(): array /** * @return RequestedAttribute[]|null */ + #[Override] public function getRequestedAttributes(): ?array { return $this->attributes->getRequestedAttributes(); } + #[Override] public function isAllowAll(): bool { return true; } + #[Override] public function isAllowed(string $idpEntityId): bool { return true; @@ -103,6 +109,7 @@ public function isAllowed(string $idpEntityId): bool /** * @return IndexedService[] */ + #[Override] public function getAssertionConsumerServices(): array { $acsLocation = $this->urlProvider->getUrl('authentication_sp_consume_assertion', false, null, null); diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php index d969ac5711..eac4da34d3 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php @@ -23,6 +23,7 @@ use OpenConext\EngineBlock\Metadata\Factory\ValueObject\EngineBlockConfiguration; use OpenConext\EngineBlock\Metadata\Logo; use OpenConext\EngineBlock\Metadata\Organization; +use Override; /** * This decoration is used to add non functional and strictly informational data to an entity @@ -40,26 +41,31 @@ public function __construct(ServiceProviderEntityInterface $entity, EngineBlockC $this->engineBlockConfiguration = $engineBlockConfiguration; } + #[Override] public function getName($locale): string { return $this->engineBlockConfiguration->getName(); } + #[Override] public function getDisplayName(string $locale): string { return $this->engineBlockConfiguration->getName(); } + #[Override] public function getDescription(string $locale): string { return $this->engineBlockConfiguration->getDescription(); } + #[Override] public function getLogo(): ?Logo { return $this->engineBlockConfiguration->getLogo(); } + #[Override] public function getOrganization(string $locale): ?Organization { return $this->engineBlockConfiguration->getOrganization($locale); @@ -68,6 +74,7 @@ public function getOrganization(string $locale): ?Organization /** * @return ContactPerson[] */ + #[Override] public function getContactPersons(): array { return $this->engineBlockConfiguration->getContactPersons(); diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProvider.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProvider.php index c4a1e44a60..d80c78cb9b 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProvider.php @@ -23,6 +23,7 @@ use OpenConext\EngineBlock\Metadata\Service; use OpenConext\EngineBlock\Metadata\X509\X509KeyPair; use OpenConext\EngineBlockBundle\Url\UrlProvider; +use Override; use SAML2\Constants; /** @@ -66,6 +67,7 @@ public function __construct( $this->urlProvider = $urlProvider; } + #[Override] public function getSingleLogoutService(): ?Service { if (is_null($this->entity->getSingleLogoutService())) { @@ -75,6 +77,7 @@ public function getSingleLogoutService(): ?Service return new Service($sloService->location, $sloService->binding); } + #[Override] public function getCertificates(): array { return [ @@ -82,6 +85,7 @@ public function getCertificates(): array ]; } + #[Override] public function getSupportedNameIdFormats(): array { return [ @@ -95,11 +99,13 @@ public function getSupportedNameIdFormats(): array * The configured EB contact persons are displayed for IdP entities that EngineBlock proxies. * @return ContactPerson[] */ + #[Override] public function getContactPersons(): array { return $this->engineBlockConfiguration->getContactPersons(); } + #[Override] public function getSingleSignOnServices(): array { $ssoLocation = $this->urlProvider->getUrl( diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ServiceProviderStepup.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ServiceProviderStepup.php index 2940986896..70da8dda79 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ServiceProviderStepup.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/ServiceProviderStepup.php @@ -21,6 +21,7 @@ use OpenConext\EngineBlock\Metadata\IndexedService; use OpenConext\EngineBlock\Metadata\X509\X509KeyPair; use OpenConext\EngineBlockBundle\Url\UrlProvider; +use Override; use SAML2\Constants; /** @@ -49,6 +50,7 @@ public function __construct( $this->urlProvider = $urlProvider; } + #[Override] public function getCertificates(): array { return [$this->keyPair->getCertificate()]; @@ -57,6 +59,7 @@ public function getCertificates(): array /** * @return string[] */ + #[Override] public function getSupportedNameIdFormats(): array { return []; @@ -65,6 +68,7 @@ public function getSupportedNameIdFormats(): array /** * @return IndexedService[] */ + #[Override] public function getAssertionConsumerServices(): array { $acsLocation = $this->urlProvider->getUrl('authentication_stepup_consume_assertion', false, null, null); diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Helper/IdentityProviderNameFallbackHelper.php b/src/OpenConext/EngineBlock/Metadata/Factory/Helper/IdentityProviderNameFallbackHelper.php index d991c81a29..3d8c1b2502 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Helper/IdentityProviderNameFallbackHelper.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Helper/IdentityProviderNameFallbackHelper.php @@ -18,6 +18,7 @@ namespace OpenConext\EngineBlock\Metadata\Factory\Helper; use OpenConext\EngineBlock\Metadata\Factory\Decorator\AbstractIdentityProvider; +use Override; /** * Represents a a helper to facilitate name fallback rules. @@ -33,6 +34,7 @@ class IdentityProviderNameFallbackHelper extends AbstractIdentityProvider * @param $locale string * @return string */ + #[Override] public function getDisplayName($locale): string { if (empty($this->entity->getDisplayName($locale))) { diff --git a/src/OpenConext/EngineBlock/Metadata/LoaRepository.php b/src/OpenConext/EngineBlock/Metadata/LoaRepository.php index e222166951..e757217c8b 100644 --- a/src/OpenConext/EngineBlock/Metadata/LoaRepository.php +++ b/src/OpenConext/EngineBlock/Metadata/LoaRepository.php @@ -27,8 +27,8 @@ */ class LoaRepository { - private const EB = 'eb'; - private const GW = 'gw'; + private const string EB = 'eb'; + private const string GW = 'gw'; /** * @var array */ @@ -66,12 +66,12 @@ public function __construct(array $loaMapping) */ public function getByIdentifier($identifier) { - if (!array_key_exists($identifier, $this->store[self::EB]) && - !array_key_exists($identifier, $this->store[self::GW]) + if (!array_key_exists((string) $identifier, $this->store[self::EB]) && + !array_key_exists((string) $identifier, $this->store[self::GW]) ) { throw new LoaNotFoundException(sprintf('Unable to find LoA with identifier "%s"', $identifier)); } - if (array_key_exists($identifier, $this->store[self::EB])) { + if (array_key_exists((string) $identifier, $this->store[self::EB])) { return $this->store[self::EB][$identifier]; } return $this->store[self::GW][$identifier]; diff --git a/src/OpenConext/EngineBlock/Metadata/Mdui.php b/src/OpenConext/EngineBlock/Metadata/Mdui.php index 95569187bf..e12a18c063 100644 --- a/src/OpenConext/EngineBlock/Metadata/Mdui.php +++ b/src/OpenConext/EngineBlock/Metadata/Mdui.php @@ -43,7 +43,7 @@ */ class Mdui { - private const ALLOWED_ELEMENT_NAMES = [ + private const array ALLOWED_ELEMENT_NAMES = [ 'DisplayName', 'Description', 'Keywords', diff --git a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveDisallowedIdentityProvidersFilter.php b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveDisallowedIdentityProvidersFilter.php index 2586631887..7f2cf11a1d 100644 --- a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveDisallowedIdentityProvidersFilter.php +++ b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveDisallowedIdentityProvidersFilter.php @@ -21,6 +21,7 @@ use Doctrine\ORM\QueryBuilder; use OpenConext\EngineBlock\Metadata\Entity\AbstractRole; use OpenConext\EngineBlock\Metadata\Entity\IdentityProvider; +use Override; use Psr\Log\LoggerInterface; /** @@ -93,6 +94,7 @@ public function toQueryBuilder(QueryBuilder $queryBuilder, $repositoryClassName) /** * {@inheritdoc} */ + #[Override] public function __toString() { return parent::__toString() . ' -> ' . $this->serviceProviderEntityId; diff --git a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveOtherWorkflowStatesFilter.php b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveOtherWorkflowStatesFilter.php index f6582569ca..c3dcf2a31b 100644 --- a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveOtherWorkflowStatesFilter.php +++ b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/Filter/RemoveOtherWorkflowStatesFilter.php @@ -22,6 +22,7 @@ use OpenConext\EngineBlock\Metadata\Entity\AbstractRole; use OpenConext\EngineBlock\Metadata\Entity\IdentityProvider; use OpenConext\EngineBlock\Metadata\Entity\ServiceProvider; +use Override; use Psr\Log\LoggerInterface; /** @@ -89,6 +90,7 @@ public function toQueryBuilder(QueryBuilder $queryBuilder, $repositoryClassName) /** * {@inheritdoc} */ + #[Override] public function __toString() { return parent::__toString() . ' -> ' . $this->workflowState; diff --git a/src/OpenConext/EngineBlock/Metadata/MfaEntityFactory.php b/src/OpenConext/EngineBlock/Metadata/MfaEntityFactory.php index 60d1687501..725d9463d7 100644 --- a/src/OpenConext/EngineBlock/Metadata/MfaEntityFactory.php +++ b/src/OpenConext/EngineBlock/Metadata/MfaEntityFactory.php @@ -22,7 +22,7 @@ class MfaEntityFactory { - private const TRANSPARENT_AUTHN_CONTEXT = 'transparent_authn_context'; + private const string TRANSPARENT_AUTHN_CONTEXT = 'transparent_authn_context'; public static function from(string $entityId, string $level) { diff --git a/src/OpenConext/EngineBlock/Metadata/StepupConnections.php b/src/OpenConext/EngineBlock/Metadata/StepupConnections.php index 162eb88619..928c5d737a 100644 --- a/src/OpenConext/EngineBlock/Metadata/StepupConnections.php +++ b/src/OpenConext/EngineBlock/Metadata/StepupConnections.php @@ -59,7 +59,7 @@ public function hasConnections() */ public function getLoa($entityId) { - if (!array_key_exists($entityId, $this->connections)) { + if (!array_key_exists((string) $entityId, $this->connections)) { return null; } return $this->connections[$entityId]; diff --git a/src/OpenConext/EngineBlock/Metadata/X509/X509CertificateLazyProxy.php b/src/OpenConext/EngineBlock/Metadata/X509/X509CertificateLazyProxy.php index 1cf8d17882..43cd1f9c18 100644 --- a/src/OpenConext/EngineBlock/Metadata/X509/X509CertificateLazyProxy.php +++ b/src/OpenConext/EngineBlock/Metadata/X509/X509CertificateLazyProxy.php @@ -67,8 +67,14 @@ public function __call($methodName, $methodArguments) /** * Take care not to serialize the openSSL resource ($this->certificate). */ - public function __sleep() + public function __serialize(): array { - return array('certData', 'factory'); + return array('certData' => $this->certData, 'factory' => $this->factory); + } + + public function __unserialize(array $data): void + { + $this->certData = $data['certData']; + $this->factory = $data['factory']; } } diff --git a/src/OpenConext/EngineBlock/Service/Consent/ConsentAttributes.php b/src/OpenConext/EngineBlock/Service/Consent/ConsentAttributes.php index d0f764ac6d..089769c87b 100644 --- a/src/OpenConext/EngineBlock/Service/Consent/ConsentAttributes.php +++ b/src/OpenConext/EngineBlock/Service/Consent/ConsentAttributes.php @@ -165,6 +165,6 @@ private static function sortRecursive(array $sortMe): array private static function isSequentialArray(array $array): bool { - return count(array_filter(array_keys($array), 'is_string')) === 0; + return count(array_filter(array_keys($array), is_string(...))) === 0; } } diff --git a/src/OpenConext/EngineBlock/Service/FeedbackStateHelper.php b/src/OpenConext/EngineBlock/Service/FeedbackStateHelper.php index d7ec1a6daa..0e06ec09c7 100644 --- a/src/OpenConext/EngineBlock/Service/FeedbackStateHelper.php +++ b/src/OpenConext/EngineBlock/Service/FeedbackStateHelper.php @@ -26,7 +26,7 @@ */ class FeedbackStateHelper implements FeedbackStateHelperInterface { - private const EARLY_FEEDBACK_KEY = '_early'; + private const string EARLY_FEEDBACK_KEY = '_early'; public function __construct( private readonly RequestStack $requestStack, diff --git a/src/OpenConext/EngineBlock/Service/SsoNotificationService.php b/src/OpenConext/EngineBlock/Service/SsoNotificationService.php index 8880bdb1eb..f9558c1758 100644 --- a/src/OpenConext/EngineBlock/Service/SsoNotificationService.php +++ b/src/OpenConext/EngineBlock/Service/SsoNotificationService.php @@ -26,11 +26,11 @@ class SsoNotificationService { - private const SSO_NOT_COOKIE_NAME = "ssonot"; - private const FIELD_ENTITY_ID = "entityId"; - private const IV_SIZE = 16; - private const KEY_SIZE = 256; - private const ITERATION_COUNT = 1000; + private const string SSO_NOT_COOKIE_NAME = "ssonot"; + private const string FIELD_ENTITY_ID = "entityId"; + private const int IV_SIZE = 16; + private const int KEY_SIZE = 256; + private const int ITERATION_COUNT = 1000; /** * @var string diff --git a/src/OpenConext/EngineBlockBundle/Authentication/Entity/SamlPersistentId.php b/src/OpenConext/EngineBlockBundle/Authentication/Entity/SamlPersistentId.php index 9abb83096b..881ef61eaa 100644 --- a/src/OpenConext/EngineBlockBundle/Authentication/Entity/SamlPersistentId.php +++ b/src/OpenConext/EngineBlockBundle/Authentication/Entity/SamlPersistentId.php @@ -26,7 +26,7 @@ #[ORM\Index(columns: ['user_uuid', 'service_provider_uuid'], name: 'user_uuid')] class SamlPersistentId { - private const PERSISTENT_ID_SALT = 'COIN:'; + private const string PERSISTENT_ID_SALT = 'COIN:'; public static function generate(string $userUuid, string $spUuid): self { diff --git a/src/OpenConext/EngineBlockBundle/Controller/Api/UserController.php b/src/OpenConext/EngineBlockBundle/Controller/Api/UserController.php index 3819b5e5e9..12e414b8b3 100644 --- a/src/OpenConext/EngineBlockBundle/Controller/Api/UserController.php +++ b/src/OpenConext/EngineBlockBundle/Controller/Api/UserController.php @@ -151,7 +151,7 @@ private function assertEntryHasRequiredFields(mixed $entry, array $requiredField } foreach ($requiredFields as $field) { - if (!array_key_exists($field, $entry)) { + if (!array_key_exists((string) $field, $entry)) { throw new BadApiRequestHttpException( sprintf('Missing required field "%s" in request entry', $field) ); diff --git a/src/OpenConext/EngineBlockBundle/Controller/WayfController.php b/src/OpenConext/EngineBlockBundle/Controller/WayfController.php index 3dbbc32282..9c927b46bf 100644 --- a/src/OpenConext/EngineBlockBundle/Controller/WayfController.php +++ b/src/OpenConext/EngineBlockBundle/Controller/WayfController.php @@ -129,7 +129,7 @@ public function cookieAction(Request $request) $all = false; if (array_key_exists('remove_all', $postData)) { foreach ($cookies as $cookie) { - if (array_key_exists($cookie, $cookiesSet)) { + if (array_key_exists((string) $cookie, $cookiesSet)) { unset($cookiesSet[$cookie]); $response->headers->clearCookie($cookie); } diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonIdType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonIdType.php index 855c9c492c..699b1a0ea4 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonIdType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonIdType.php @@ -23,6 +23,7 @@ use Doctrine\DBAL\Types\Type; use OpenConext\EngineBlock\Authentication\Value\CollabPersonId; use OpenConext\EngineBlock\Exception\InvalidArgumentException; +use Override; class CollabPersonIdType extends Type { @@ -36,6 +37,7 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla return $platform->getStringTypeDeclarationSQL($fieldDeclaration); } + #[Override] public function convertToDatabaseValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { @@ -56,6 +58,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): mixe return $value->getCollabPersonId(); } + #[Override] public function convertToPHPValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonUuidType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonUuidType.php index 0df007518e..2d4e030e56 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonUuidType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/CollabPersonUuidType.php @@ -23,6 +23,7 @@ use Doctrine\DBAL\Types\Type; use OpenConext\EngineBlock\Authentication\Value\CollabPersonUuid; use OpenConext\EngineBlock\Exception\InvalidArgumentException; +use Override; class CollabPersonUuidType extends Type { @@ -33,6 +34,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st return $platform->getGuidTypeDeclarationSQL($column); } + #[Override] public function convertToDatabaseValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { @@ -53,6 +55,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): mixe return $value->getUuid(); } + #[Override] public function convertToPHPValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/LegacyJsonType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/LegacyJsonType.php index d63be8065d..2ece3f7bcc 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/LegacyJsonType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/LegacyJsonType.php @@ -23,12 +23,11 @@ use Doctrine\DBAL\Types\Exception\ValueNotConvertible; use Doctrine\DBAL\Types\Type; use JsonException; - +use Override; use function is_resource; use function json_decode; use function json_encode; use function stream_get_contents; - use const JSON_PRESERVE_ZERO_FRACTION; use const JSON_THROW_ON_ERROR; @@ -53,6 +52,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st ); } + #[Override] public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): ?string { if ($value === null) { @@ -66,6 +66,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) } } + #[Override] public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mixed { if ($value === null || $value === '') { diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataCoinType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataCoinType.php index 61ace806ee..317ab85db3 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataCoinType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataCoinType.php @@ -23,6 +23,7 @@ use Doctrine\DBAL\Types\Type; use OpenConext\EngineBlock\Exception\InvalidArgumentException; use OpenConext\EngineBlock\Metadata\Coins; +use Override; class MetadataCoinType extends Type { @@ -34,6 +35,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st return $platform->getClobTypeDeclarationSQL($column); } + #[Override] public function convertToDatabaseValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { @@ -53,11 +55,13 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): mixe return $value->toJson(); } + #[Override] public function getMappedDatabaseTypes(AbstractPlatform $platform): array { return parent::getMappedDatabaseTypes($platform); // TODO: Change the autogenerated stub } + #[Override] public function convertToPHPValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataMduiType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataMduiType.php index f050910e42..aeb4cb2de2 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataMduiType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/MetadataMduiType.php @@ -23,6 +23,7 @@ use Doctrine\DBAL\Types\Type; use OpenConext\EngineBlock\Exception\InvalidArgumentException; use OpenConext\EngineBlock\Metadata\Mdui; +use Override; class MetadataMduiType extends Type { @@ -34,6 +35,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st return $platform->getClobTypeDeclarationSQL($column); } + #[Override] public function convertToDatabaseValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { @@ -53,6 +55,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): mixe return $value->toJson(); } + #[Override] public function convertToPHPValue($value, AbstractPlatform $platform): mixed { if (is_null($value)) { diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedArrayType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedArrayType.php index e2f5e52d2c..a5c9f4c2ec 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedArrayType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedArrayType.php @@ -21,14 +21,13 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Exception\ValueNotConvertible; use Doctrine\DBAL\Types\Type; - +use Override; use function is_resource; use function restore_error_handler; use function serialize; use function set_error_handler; use function stream_get_contents; use function unserialize; - use const E_DEPRECATED; use const E_USER_DEPRECATED; @@ -47,11 +46,13 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st return $platform->getClobTypeDeclarationSQL($column); } + #[Override] public function convertToDatabaseValue($value, AbstractPlatform $platform): string { return serialize($value); } + #[Override] public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mixed { if ($value === null) { diff --git a/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedObjectType.php b/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedObjectType.php index ebd2560913..f5f26af3d6 100644 --- a/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedObjectType.php +++ b/src/OpenConext/EngineBlockBundle/Doctrine/Type/SerializedObjectType.php @@ -21,14 +21,13 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Exception\ValueNotConvertible; use Doctrine\DBAL\Types\Type; - +use Override; use function is_resource; use function restore_error_handler; use function serialize; use function set_error_handler; use function stream_get_contents; use function unserialize; - use const E_DEPRECATED; use const E_USER_DEPRECATED; @@ -47,11 +46,13 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform): st return $platform->getClobTypeDeclarationSQL($column); } + #[Override] public function convertToDatabaseValue($value, AbstractPlatform $platform): string { return serialize($value); } + #[Override] public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mixed { if ($value === null) { diff --git a/src/OpenConext/EngineBlockBundle/EventListener/ExecutionTimeTracker.php b/src/OpenConext/EngineBlockBundle/EventListener/ExecutionTimeTracker.php index c6a8769577..72b96c981b 100644 --- a/src/OpenConext/EngineBlockBundle/EventListener/ExecutionTimeTracker.php +++ b/src/OpenConext/EngineBlockBundle/EventListener/ExecutionTimeTracker.php @@ -23,7 +23,7 @@ final class ExecutionTimeTracker { - const SECTION_NAME = 'execution-time'; + const string SECTION_NAME = 'execution-time'; /** * @var Stopwatch diff --git a/src/OpenConext/EngineBlockBundle/Monolog/Formatter/SyslogJsonFormatter.php b/src/OpenConext/EngineBlockBundle/Monolog/Formatter/SyslogJsonFormatter.php index a0daf6019e..8fb22ccd16 100644 --- a/src/OpenConext/EngineBlockBundle/Monolog/Formatter/SyslogJsonFormatter.php +++ b/src/OpenConext/EngineBlockBundle/Monolog/Formatter/SyslogJsonFormatter.php @@ -20,9 +20,11 @@ use Monolog\Formatter\JsonFormatter; use Monolog\LogRecord; +use Override; class SyslogJsonFormatter extends JsonFormatter { + #[Override] protected function normalizeRecord(LogRecord $record): array { return [ diff --git a/src/OpenConext/EngineBlockBundle/Pdp/PolicyDecision.php b/src/OpenConext/EngineBlockBundle/Pdp/PolicyDecision.php index 126c23fdaa..1bb9d36599 100644 --- a/src/OpenConext/EngineBlockBundle/Pdp/PolicyDecision.php +++ b/src/OpenConext/EngineBlockBundle/Pdp/PolicyDecision.php @@ -25,10 +25,10 @@ final class PolicyDecision { - const DECISION_DENY = 'Deny'; - const DECISION_INDETERMINATE = 'Indeterminate'; - const DECISION_NOT_APPLICABLE = 'NotApplicable'; - const DECISION_PERMIT = 'Permit'; + const string DECISION_DENY = 'Deny'; + const string DECISION_INDETERMINATE = 'Indeterminate'; + const string DECISION_NOT_APPLICABLE = 'NotApplicable'; + const string DECISION_PERMIT = 'Permit'; /** * @var string diff --git a/src/OpenConext/EngineBlockBundle/Service/DiscoverySelectionService.php b/src/OpenConext/EngineBlockBundle/Service/DiscoverySelectionService.php index c886bd9fb5..aeeaee0f56 100644 --- a/src/OpenConext/EngineBlockBundle/Service/DiscoverySelectionService.php +++ b/src/OpenConext/EngineBlockBundle/Service/DiscoverySelectionService.php @@ -24,8 +24,8 @@ class DiscoverySelectionService { - private const PREVIOUSLY_SELECTED_DISCOVERY_SESSION_NAME = 'discovery'; - public const USED_DISCOVERY_HASH_PARAM = 'discovery'; + private const string PREVIOUSLY_SELECTED_DISCOVERY_SESSION_NAME = 'discovery'; + public const string USED_DISCOVERY_HASH_PARAM = 'discovery'; public function discoveryMatchesHash(Discovery $discovery, string $hash): bool { diff --git a/src/OpenConext/EngineBlockBundle/Twig/Extensions/Extension/Wayf.php b/src/OpenConext/EngineBlockBundle/Twig/Extensions/Extension/Wayf.php index 7ba2a4c4b7..81868aac75 100644 --- a/src/OpenConext/EngineBlockBundle/Twig/Extensions/Extension/Wayf.php +++ b/src/OpenConext/EngineBlockBundle/Twig/Extensions/Extension/Wayf.php @@ -98,7 +98,7 @@ private function formatIdpEntry(WayfIdp $idp): array private function formatIdpList(array $idpList): array { return array_map( - fn(WayfIdp $idp) => $this->formatIdpEntry($idp), + $this->formatIdpEntry(...), $idpList ); } diff --git a/src/OpenConext/EngineBlockBundle/Value/FeedbackInformationMap.php b/src/OpenConext/EngineBlockBundle/Value/FeedbackInformationMap.php index a8b43410f2..6b684684fa 100644 --- a/src/OpenConext/EngineBlockBundle/Value/FeedbackInformationMap.php +++ b/src/OpenConext/EngineBlockBundle/Value/FeedbackInformationMap.php @@ -30,7 +30,7 @@ class FeedbackInformationMap public function add(FeedbackInformation $feedbackInformation) { $key = $feedbackInformation->getKey(); - if (array_key_exists($key, $this->data)) { + if (array_key_exists((string) $key, $this->data)) { throw new RuntimeException( sprintf('Feedback information with key "%s" is already mapped.', $key) ); @@ -51,7 +51,7 @@ public function getData() public function has($key) { - return array_key_exists($key, $this->data); + return array_key_exists((string) $key, $this->data); } public function get($key) diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/FunctionalTestingAttributeAggregationClient.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/FunctionalTestingAttributeAggregationClient.php index 1d5482baed..e84c710ed2 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/FunctionalTestingAttributeAggregationClient.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/FunctionalTestingAttributeAggregationClient.php @@ -70,13 +70,7 @@ public function aggregate(Request $request) */ private function hasRuleForAttribute(array $rules, $name, $source) { - foreach ($rules as $rule) { - if ($this->ruleMatchesAttribute($rule, $name, $source)) { - return true; - } - } - - return false; + return array_any($rules, fn($rule) => $this->ruleMatchesAttribute($rule, $name, $source)); } /** diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/ServiceRegistryFixture.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/ServiceRegistryFixture.php index f19586370b..caccd0dbc4 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/ServiceRegistryFixture.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Fixtures/ServiceRegistryFixture.php @@ -497,7 +497,7 @@ public function substituteNameIdWithAttributeValue(string $entityId, $attributeN ]; // It could be the rule was already added (for example to set the release_as directive) // in that case, load the existing rule and add the 'use_as_nameid' - if (array_key_exists($attributeName, $rules)) { + if (array_key_exists((string) $attributeName, $rules)) { $arpRule = $rules[$attributeName][0]; $arpRule['use_as_nameid'] = true; } diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/FakeUserDirectory.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/FakeUserDirectory.php index 67a89fbe30..62cc01fec3 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/FakeUserDirectory.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/FakeUserDirectory.php @@ -27,6 +27,7 @@ use OpenConext\EngineBlock\Authentication\Value\Uid; use OpenConext\EngineBlock\Exception\RuntimeException; use OpenConext\EngineBlockBridge\Authentication\Repository\UserDirectoryAdapter; +use Override; use Symfony\Component\Filesystem\Filesystem; class FakeUserDirectory extends UserDirectoryAdapter @@ -79,6 +80,7 @@ public function __construct(Filesystem $filesystem) $this->users = $users; } + #[Override] public function identifyUser(array $attributes) { if (!isset($attributes[Uid::URN_MACE][0])) { @@ -111,6 +113,7 @@ public function identifyUser(array $attributes) return $user; } + #[Override] public function registerUser($uid, $schacHomeOrganization) { $collabPersonId = CollabPersonId::generateWithReplacedAtSignFrom( @@ -126,6 +129,7 @@ public function registerUser($uid, $schacHomeOrganization) return $user; } + #[Override] public function findUserBy($collabPersonId) { if (!array_key_exists($collabPersonId, $this->users)) { @@ -135,6 +139,7 @@ public function findUserBy($collabPersonId) return $this->users[$collabPersonId]; } + #[Override] public function getUserBy($collabPersonId) { $user = $this->findUserBy($collabPersonId); @@ -146,6 +151,7 @@ public function getUserBy($collabPersonId) return $user; } + #[Override] public function deleteUserWith($collabPersonId) { unset($this->users[$collabPersonId]); diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockIdentityProvider.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockIdentityProvider.php index 8d7a280ed1..f6f77356d4 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockIdentityProvider.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockIdentityProvider.php @@ -371,7 +371,7 @@ protected function getRoleClass() * * @return array */ - public function __sleep() + public function __serialize(): array { $role = $this->getSsoRole(); $extensions = $role->getExtensions(); @@ -388,40 +388,43 @@ public function __sleep() $role->setExtensions($extensions); } - return ['name', 'descriptor', 'sendAssertions', 'turnBackTime', 'fromTheFuture', 'omitInResponseTo']; + return [ + 'name' => $this->name, + 'descriptor' => $this->descriptor, + 'sendAssertions' => $this->sendAssertions, + 'turnBackTime' => $this->turnBackTime, + 'fromTheFuture' => $this->fromTheFuture, + 'omitInResponseTo' => $this->omitInResponseTo, + ]; } /** * Handle deserialization of the MockIdentityProvider. * Reconstruct the SAMLResponse from the stored XML string. */ - public function __wakeup() + public function __unserialize(array $data): void { + foreach ($data as $property => $value) { + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + } + $role = $this->getSsoRole(); $extensions = $role->getExtensions(); - // Reconstruct SAMLResponse from XML if it was serialized if (isset($extensions['_SAMLResponseXML'])) { $xml = $extensions['_SAMLResponseXML']; - - // Parse the XML to get the DOMElement $document = DOMDocumentFactory::fromString($xml); $messageDomElement = $document->getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:protocol', 'Response')->item(0); if ($messageDomElement) { - // Create a custom Response instance by passing the DOMElement to the constructor - // This properly initializes all the parent class properties $samlResponse = new Response($messageDomElement); - // Restore RelayState if it was stored if (isset($extensions['_SAMLResponseRelayState']) && $extensions['_SAMLResponseRelayState'] !== null) { $samlResponse->setRelayState($extensions['_SAMLResponseRelayState']); } - // DO NOT set the XML string - let the Response object generate signed XML dynamically - // when toXml() is called with the signature keys that will be set by ResponseFactory - - // Restore it to the extensions unset($extensions['_SAMLResponseXML'], $extensions['_SAMLResponseRelayState']); $extensions['SAMLResponse'] = $samlResponse; $role->setExtensions($extensions); diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockServiceProvider.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockServiceProvider.php index 4c4db2f884..87d0b0c424 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockServiceProvider.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Mock/MockServiceProvider.php @@ -193,7 +193,7 @@ public function setAuthnContextClassRef($classRef) * * @return array */ - public function __sleep() + public function __serialize(): array { $extensions = $this->descriptor->getExtensions(); @@ -209,39 +209,35 @@ public function __sleep() $this->descriptor->setExtensions($extensions); } - return ['name', 'descriptor']; + return ['name' => $this->name, 'descriptor' => $this->descriptor]; } /** * Handle deserialization of the MockServiceProvider. * Reconstruct the SAMLRequest from the stored XML string. */ - public function __wakeup() + public function __unserialize(array $data): void { + foreach ($data as $property => $value) { + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + } + $extensions = $this->descriptor->getExtensions(); - // Reconstruct SAMLRequest from XML if it was serialized if (isset($extensions['_SAMLRequestXML'])) { $xml = $extensions['_SAMLRequestXML']; - - // Parse the XML to get the DOMElement $document = DOMDocumentFactory::fromString($xml); $messageDomElement = $document->getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:protocol', 'AuthnRequest')->item(0); if ($messageDomElement) { - // Create a custom AuthnRequest instance by passing the DOMElement to the constructor - // This properly initializes all the parent class properties $samlRequest = new AuthnRequest($messageDomElement); - // Restore RelayState if it was stored if (isset($extensions['_SAMLRequestRelayState']) && $extensions['_SAMLRequestRelayState'] !== null) { $samlRequest->setRelayState($extensions['_SAMLRequestRelayState']); } - // DO NOT set the XML string - let the AuthnRequest object generate signed XML dynamically - // when toXml() is called with the signature keys if signing is configured - - // Restore it to the extensions unset($extensions['_SAMLRequestXML'], $extensions['_SAMLRequestRelayState']); $extensions['SAMLRequest'] = $samlRequest; $this->descriptor->setExtensions($extensions); diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Parser/Corto/XmlToArray.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Parser/Corto/XmlToArray.php index fe64c9bfa0..fe78d10b8b 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Parser/Corto/XmlToArray.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Parser/Corto/XmlToArray.php @@ -231,8 +231,6 @@ public static function xml2array($xml) ) ); } - - xml_parser_free($parser); self::$_singulars = array_fill_keys(self::$_singulars, 1); $return = self::xml2arrayRecursive($values); self::$_singulars = array_keys(self::$_singulars); diff --git a/src/OpenConext/EngineBlockFunctionalTestingBundle/Validator/SsoRequestValidator.php b/src/OpenConext/EngineBlockFunctionalTestingBundle/Validator/SsoRequestValidator.php index 9ec922664a..235297532a 100644 --- a/src/OpenConext/EngineBlockFunctionalTestingBundle/Validator/SsoRequestValidator.php +++ b/src/OpenConext/EngineBlockFunctionalTestingBundle/Validator/SsoRequestValidator.php @@ -19,11 +19,13 @@ namespace OpenConext\EngineBlockFunctionalTestingBundle\Validator; use OpenConext\EngineBlock\Validator\SsoRequestValidator as BaseSsoRequestValidator; +use Override; use RuntimeException; use Symfony\Component\HttpFoundation\Request; class SsoRequestValidator extends BaseSsoRequestValidator { + #[Override] public function isValid(Request $request) { // This service is overloaded in order to allow us to throw a custom exception from behat diff --git a/tests/functional/OpenConext/EngineBlockBundle/Controller/Api/UserControllerTest.php b/tests/functional/OpenConext/EngineBlockBundle/Controller/Api/UserControllerTest.php index 94c398dbe9..df2055ed0c 100644 --- a/tests/functional/OpenConext/EngineBlockBundle/Controller/Api/UserControllerTest.php +++ b/tests/functional/OpenConext/EngineBlockBundle/Controller/Api/UserControllerTest.php @@ -27,9 +27,9 @@ final class UserControllerTest extends FunctionalWebTestCase { - private const SHO = 'example.edu'; - private const UID = 'student001'; - private const SP_ENTITY_ID = 'https://sp.example.com/'; + private const string SHO = 'example.edu'; + private const string UID = 'student001'; + private const string SP_ENTITY_ID = 'https://sp.example.com/'; public function tearDown(): void { diff --git a/tests/library/EngineBlock/Test/Corto/Module/Service/AssertionConsumerTest.php b/tests/library/EngineBlock/Test/Corto/Module/Service/AssertionConsumerTest.php index 228424a3f0..2b5f33aad7 100644 --- a/tests/library/EngineBlock/Test/Corto/Module/Service/AssertionConsumerTest.php +++ b/tests/library/EngineBlock/Test/Corto/Module/Service/AssertionConsumerTest.php @@ -34,10 +34,10 @@ class EngineBlock_Test_Corto_Module_Service_AssertionConsumerTest extends TestCase { - private const PROXY_SP_ENTITY_ID = 'https://proxy.example.com'; - private const REAL_SP_ENTITY_ID = 'https://realsp.example.com'; - private const IDP_ENTITY_ID = 'https://idp.example.com'; - private const ENGINE_URL = 'https://engine.example.com/some-service'; + private const string PROXY_SP_ENTITY_ID = 'https://proxy.example.com'; + private const string REAL_SP_ENTITY_ID = 'https://realsp.example.com'; + private const string IDP_ENTITY_ID = 'https://idp.example.com'; + private const string ENGINE_URL = 'https://engine.example.com/some-service'; /** @var EngineBlock_Corto_ProxyServer */ private $proxyServerMock; diff --git a/tests/library/EngineBlock/Test/Saml2/NameIdResolverMock.php b/tests/library/EngineBlock/Test/Saml2/NameIdResolverMock.php index 05e70f620b..75b45f4d12 100644 --- a/tests/library/EngineBlock/Test/Saml2/NameIdResolverMock.php +++ b/tests/library/EngineBlock/Test/Saml2/NameIdResolverMock.php @@ -21,11 +21,13 @@ class EngineBlock_Test_Saml2_NameIdResolverMock extends EngineBlock_Saml2_NameId private $_serviceProviderUuids = array(); private $_persistentIds = array(); + #[Override] protected function _getUserUuid($collabPersonId) { return sha1($collabPersonId); } + #[Override] protected function _fetchPersistentId($serviceProviderUuid, $userUuid) { return empty($this->_persistentIds[$serviceProviderUuid][$userUuid]) ? @@ -33,6 +35,7 @@ protected function _fetchPersistentId($serviceProviderUuid, $userUuid) $this->_persistentIds[$serviceProviderUuid][$userUuid]; } + #[Override] protected function _storePersistentId($persistentId, $serviceProviderUuid, $userUuid) { if (!isset($this->_persistentIds[$serviceProviderUuid])) { @@ -41,6 +44,7 @@ protected function _storePersistentId($persistentId, $serviceProviderUuid, $user $this->_persistentIds[$serviceProviderUuid][$userUuid] = $persistentId; } + #[Override] protected function _fetchServiceProviderUuid($spEntityId) { return empty($this->_serviceProviderUuids[$spEntityId]) ? @@ -48,6 +52,7 @@ protected function _fetchServiceProviderUuid($spEntityId) $this->_serviceProviderUuids[$spEntityId]; } + #[Override] protected function _storeServiceProviderUuid($spEntityId, $uuid) { $this->_serviceProviderUuids[$spEntityId] = $uuid; diff --git a/tests/unit/OpenConext/EngineBlock/Service/FeedbackInfoCollectorTest.php b/tests/unit/OpenConext/EngineBlock/Service/FeedbackInfoCollectorTest.php index ccd7a72f01..abe7d8bbcf 100644 --- a/tests/unit/OpenConext/EngineBlock/Service/FeedbackInfoCollectorTest.php +++ b/tests/unit/OpenConext/EngineBlock/Service/FeedbackInfoCollectorTest.php @@ -45,8 +45,7 @@ class FeedbackInfoCollectorTest extends TestCase protected function setUp(): void { $request = new Request(); - $requestStack = new RequestStack(); - $requestStack->push($request); + $requestStack = new RequestStack([$request]); $requestId = new RequestId(new class implements RequestIdGenerator { public function generateRequestId(): string diff --git a/tests/unit/OpenConext/EngineBlock/Service/FeedbackStateHelperTest.php b/tests/unit/OpenConext/EngineBlock/Service/FeedbackStateHelperTest.php index 7d5ccb899a..826cf11574 100644 --- a/tests/unit/OpenConext/EngineBlock/Service/FeedbackStateHelperTest.php +++ b/tests/unit/OpenConext/EngineBlock/Service/FeedbackStateHelperTest.php @@ -37,8 +37,7 @@ protected function setUp(): void $request = new Request(); $request->setSession($this->session); - $requestStack = new RequestStack(); - $requestStack->push($request); + $requestStack = new RequestStack([$request]); $this->helper = new FeedbackStateHelper($requestStack); } diff --git a/tests/unit/OpenConext/EngineBlock/Service/ProcessingStateHelperTest.php b/tests/unit/OpenConext/EngineBlock/Service/ProcessingStateHelperTest.php index 3382fcfce0..243cdfedee 100644 --- a/tests/unit/OpenConext/EngineBlock/Service/ProcessingStateHelperTest.php +++ b/tests/unit/OpenConext/EngineBlock/Service/ProcessingStateHelperTest.php @@ -45,8 +45,7 @@ protected function setUp(): void $request = new Request(); $request->setSession($this->session); - $requestStack = new RequestStack(); - $requestStack->push($request); + $requestStack = new RequestStack([$request]); $this->helper = new ProcessingStateHelper($requestStack); } diff --git a/tests/unit/OpenConext/EngineBlock/Service/SsoSessionServiceTest.php b/tests/unit/OpenConext/EngineBlock/Service/SsoSessionServiceTest.php index 4160c641c9..c982046e29 100644 --- a/tests/unit/OpenConext/EngineBlock/Service/SsoSessionServiceTest.php +++ b/tests/unit/OpenConext/EngineBlock/Service/SsoSessionServiceTest.php @@ -27,10 +27,10 @@ class SsoSessionServiceTest extends TestCase { - private const SSO_SESSION_COOKIE_NAME = "sso_id"; - private const SSO_SESSION_COOKIE_MAX_AGE = 0; - private const SSO_SESSION_COOKIE_DOMAIN = "test.domain"; - private const SSO_SESSION_COOKIE_PATH = "/testpath"; + private const string SSO_SESSION_COOKIE_NAME = "sso_id"; + private const int SSO_SESSION_COOKIE_MAX_AGE = 0; + private const string SSO_SESSION_COOKIE_DOMAIN = "test.domain"; + private const string SSO_SESSION_COOKIE_PATH = "/testpath"; /** * @var SsoSessionService diff --git a/tests/unit/OpenConext/EngineBlockBridge/ErrorReporterTest.php b/tests/unit/OpenConext/EngineBlockBridge/ErrorReporterTest.php index 723ef6e4b3..dfe1e810b5 100644 --- a/tests/unit/OpenConext/EngineBlockBridge/ErrorReporterTest.php +++ b/tests/unit/OpenConext/EngineBlockBridge/ErrorReporterTest.php @@ -54,8 +54,7 @@ protected function setUp(): void $request = new Request(); $request->setSession($this->session); - $this->requestStack = new RequestStack(); - $this->requestStack->push($request); + $this->requestStack = new RequestStack([$request]); $this->applicationSingleton = m::mock(EngineBlock_ApplicationSingleton::class); $this->applicationSingleton->shouldReceive('flushLog')->byDefault(); diff --git a/tests/unit/OpenConext/Mockery/Matcher/ValueObjectListEqualsMatcher.php b/tests/unit/OpenConext/Mockery/Matcher/ValueObjectListEqualsMatcher.php index 4a9b4b1cd0..fa7c353795 100644 --- a/tests/unit/OpenConext/Mockery/Matcher/ValueObjectListEqualsMatcher.php +++ b/tests/unit/OpenConext/Mockery/Matcher/ValueObjectListEqualsMatcher.php @@ -35,7 +35,7 @@ public function __construct(array $valueObjects) __METHOD__ ); - $first = array_values($valueObjects)[0]; + $first = array_first($valueObjects); if (!is_object($first) || !method_exists($first, 'equals')) { throw new InvalidArgumentException($message);