Skip to content

Commit

Permalink
EZP-31481: Introduced strict types for eZ\Publish\API\Repository\Repo…
Browse files Browse the repository at this point in the history
…sitory (#2987)
  • Loading branch information
adamwojs authored Mar 16, 2020
1 parent 581e013 commit 58debb5
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 81 deletions.
46 changes: 24 additions & 22 deletions eZ/Publish/API/Repository/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\API\Repository;

/**
Expand Down Expand Up @@ -32,7 +34,7 @@ interface Repository
*
* @return mixed
*/
public function sudo(callable $callback, Repository $outerRepository = null);
public function sudo(callable $callback, ?Repository $outerRepository = null);

/**
* Get Content Service.
Expand All @@ -41,7 +43,7 @@ public function sudo(callable $callback, Repository $outerRepository = null);
*
* @return \eZ\Publish\API\Repository\ContentService
*/
public function getContentService();
public function getContentService(): ContentService;

/**
* Get Content Language Service.
Expand All @@ -50,7 +52,7 @@ public function getContentService();
*
* @return \eZ\Publish\API\Repository\LanguageService
*/
public function getContentLanguageService();
public function getContentLanguageService(): LanguageService;

/**
* Get Content Type Service.
Expand All @@ -60,7 +62,7 @@ public function getContentLanguageService();
*
* @return \eZ\Publish\API\Repository\ContentTypeService
*/
public function getContentTypeService();
public function getContentTypeService(): ContentTypeService;

/**
* Get Content Location Service.
Expand All @@ -69,7 +71,7 @@ public function getContentTypeService();
*
* @return \eZ\Publish\API\Repository\LocationService
*/
public function getLocationService();
public function getLocationService(): LocationService;

/**
* Get Content Trash service.
Expand All @@ -79,7 +81,7 @@ public function getLocationService();
*
* @return \eZ\Publish\API\Repository\TrashService
*/
public function getTrashService();
public function getTrashService(): TrashService;

/**
* Get Content Section Service.
Expand All @@ -88,7 +90,7 @@ public function getTrashService();
*
* @return \eZ\Publish\API\Repository\SectionService
*/
public function getSectionService();
public function getSectionService(): SectionService;

/**
* Get Search Service.
Expand All @@ -97,7 +99,7 @@ public function getSectionService();
*
* @return \eZ\Publish\API\Repository\SearchService
*/
public function getSearchService();
public function getSearchService(): SearchService;

/**
* Get User Service.
Expand All @@ -106,85 +108,85 @@ public function getSearchService();
*
* @return \eZ\Publish\API\Repository\UserService
*/
public function getUserService();
public function getUserService(): UserService;

/**
* Get URLAliasService.
*
* @return \eZ\Publish\API\Repository\URLAliasService
*/
public function getURLAliasService();
public function getURLAliasService(): URLAliasService;

/**
* Get URLWildcardService.
*
* @return \eZ\Publish\API\Repository\URLWildcardService
*/
public function getURLWildcardService();
public function getURLWildcardService(): URLWildcardService;

/**
* Get ObjectStateService.
*
* @return \eZ\Publish\API\Repository\ObjectStateService
*/
public function getObjectStateService();
public function getObjectStateService(): ObjectStateService;

/**
* Get RoleService.
*
* @return \eZ\Publish\API\Repository\RoleService
*/
public function getRoleService();
public function getRoleService(): RoleService;

/**
* Get FieldTypeService.
*
* @return \eZ\Publish\API\Repository\FieldTypeService
*/
public function getFieldTypeService();
public function getFieldTypeService(): FieldTypeService;

/**
* Get PermissionResolver.
*
* @return \eZ\Publish\API\Repository\PermissionResolver
*/
public function getPermissionResolver();
public function getPermissionResolver(): PermissionResolver;

/**
* Get URLService.
*
* @return \eZ\Publish\API\Repository\URLService
*/
public function getURLService();
public function getURLService(): URLService;

/**
* Get BookmarkService.
*
* @return \eZ\Publish\API\Repository\BookmarkService
*/
public function getBookmarkService();
public function getBookmarkService(): BookmarkService;

/**
* Get NotificationService.
*
* @return \eZ\Publish\API\Repository\NotificationService
*/
public function getNotificationService();
public function getNotificationService(): NotificationService;

/**
* Get UserPreferenceService.
*
* @return \eZ\Publish\API\Repository\UserPreferenceService
*/
public function getUserPreferenceService();
public function getUserPreferenceService(): UserPreferenceService;

/**
* Begin transaction.
*
* Begins an transaction, make sure you'll call commit or rollback when done,
* otherwise work will be lost.
*/
public function beginTransaction();
public function beginTransaction(): void;

/**
* Commit transaction.
Expand All @@ -193,7 +195,7 @@ public function beginTransaction();
*
* @throws \RuntimeException If no transaction has been started
*/
public function commit();
public function commit(): void;

/**
* Rollback transaction.
Expand All @@ -202,5 +204,5 @@ public function commit();
*
* @throws \RuntimeException If no transaction has been started
*/
public function rollback();
public function rollback(): void;
}
12 changes: 9 additions & 3 deletions eZ/Publish/Core/Event/Repository.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\Event;

use eZ\Publish\API\Repository\BookmarkService as BookmarkServiceInterface;
Expand All @@ -10,7 +16,7 @@
use eZ\Publish\API\Repository\LocationService as LocationServiceInterface;
use eZ\Publish\API\Repository\NotificationService as NotificationServiceInterface;
use eZ\Publish\API\Repository\ObjectStateService as ObjectStateServiceInterface;
use eZ\Publish\API\Repository\PermissionResolver;
use eZ\Publish\API\Repository\PermissionResolver as PermissionResolverInterface;
use eZ\Publish\API\Repository\Repository as RepositoryInterface;
use eZ\Publish\API\Repository\RoleService as RoleServiceInterface;
use eZ\Publish\API\Repository\SearchService as SearchServiceInterface;
Expand Down Expand Up @@ -118,7 +124,7 @@ public function __construct(
$this->userService = $userService;
}

public function sudo(callable $callback, RepositoryInterface $outerRepository = null)
public function sudo(callable $callback, ?RepositoryInterface $outerRepository = null)
{
return $this->repository->sudo($callback, $outerRepository);
}
Expand All @@ -138,7 +144,7 @@ public function rollback(): void
$this->repository->rollback();
}

public function getPermissionResolver(): PermissionResolver
public function getPermissionResolver(): PermissionResolverInterface
{
return $this->repository->getPermissionResolver();
}
Expand Down
Loading

0 comments on commit 58debb5

Please sign in to comment.