From 26f59d84338942c0907279ba1a377281a6054095 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Wed, 10 Apr 2024 12:28:07 +0200 Subject: [PATCH] IBX-7717: Introduced strict getters for LookupLimitationResult and VersionInfo Value Object (#349) For more details see https://issues.ibexa.co/browse/IBX-7717 and https://github.com/ibexa/core/pull/349 * Introduced strict getters for LookupLimitationResult Value Object * Introduced strict getter `VersionInfo::getLanguageCodes` --------- Co-Authored-By: Jakub Brzegowski --- .../Repository/Values/Content/VersionInfo.php | 10 ++++++- .../Values/User/LookupLimitationResult.php | 28 ++++++++++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/contracts/Repository/Values/Content/VersionInfo.php b/src/contracts/Repository/Values/Content/VersionInfo.php index e5f3005168..f416251c89 100644 --- a/src/contracts/Repository/Values/Content/VersionInfo.php +++ b/src/contracts/Repository/Values/Content/VersionInfo.php @@ -89,7 +89,7 @@ abstract class VersionInfo extends ValueObject implements MultiLanguageName * * @var string[] */ - protected $languageCodes = []; + protected array $languageCodes = []; /** * Content of the content this version belongs to. @@ -107,6 +107,14 @@ abstract public function getInitialLanguage(): Language; */ abstract public function getLanguages(): iterable; + /** + * @return array + */ + public function getLanguageCodes(): array + { + return $this->languageCodes; + } + /** * Returns true if version is a draft. * diff --git a/src/contracts/Repository/Values/User/LookupLimitationResult.php b/src/contracts/Repository/Values/User/LookupLimitationResult.php index 8b85af8a15..4e27a7c1f6 100644 --- a/src/contracts/Repository/Values/User/LookupLimitationResult.php +++ b/src/contracts/Repository/Values/User/LookupLimitationResult.php @@ -16,16 +16,15 @@ final class LookupLimitationResult extends ValueObject { /** @var bool */ - protected $hasAccess; + protected bool $hasAccess; /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] */ - protected $roleLimitations; + protected array $roleLimitations; /** @var \Ibexa\Contracts\Core\Repository\Values\User\LookupPolicyLimitations[] */ - protected $lookupPolicyLimitations; + protected array $lookupPolicyLimitations; /** - * @param bool $hasAccess * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] $roleLimitations * @param \Ibexa\Contracts\Core\Repository\Values\User\LookupPolicyLimitations[] $lookupPolicyLimitations */ @@ -40,6 +39,27 @@ public function __construct( $this->lookupPolicyLimitations = $lookupPolicyLimitations; $this->roleLimitations = $roleLimitations; } + + public function hasAccess(): bool + { + return $this->hasAccess; + } + + /** + * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] + */ + public function getRoleLimitations(): array + { + return $this->roleLimitations; + } + + /** + * @return \Ibexa\Contracts\Core\Repository\Values\User\LookupPolicyLimitations[] + */ + public function getLookupPolicyLimitations(): array + { + return $this->lookupPolicyLimitations; + } } class_alias(LookupLimitationResult::class, 'eZ\Publish\API\Repository\Values\User\LookupLimitationResult');