mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-22 15:13:59 -06:00
Fixed coding styles
This commit is contained in:
parent
0b8e305533
commit
5be5e0bc60
@ -28,16 +28,18 @@ class TagService implements TagServiceInterface
|
||||
* @return Tag[]
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function listTags()
|
||||
public function listTags(): array
|
||||
{
|
||||
return $this->em->getRepository(Tag::class)->findBy([], ['name' => 'ASC']);
|
||||
/** @var Tag[] $tags */
|
||||
$tags = $this->em->getRepository(Tag::class)->findBy([], ['name' => 'ASC']);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $tagNames
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTags(array $tagNames)
|
||||
public function deleteTags(array $tagNames): void
|
||||
{
|
||||
/** @var TagRepository $repo */
|
||||
$repo = $this->em->getRepository(Tag::class);
|
||||
@ -50,7 +52,7 @@ class TagService implements TagServiceInterface
|
||||
* @param string[] $tagNames
|
||||
* @return Collection|Tag[]
|
||||
*/
|
||||
public function createTags(array $tagNames)
|
||||
public function createTags(array $tagNames): Collection
|
||||
{
|
||||
$tags = $this->tagNamesToEntities($this->em, $tagNames);
|
||||
$this->em->flush();
|
||||
@ -65,7 +67,7 @@ class TagService implements TagServiceInterface
|
||||
* @throws EntityDoesNotExistException
|
||||
* @throws ORM\OptimisticLockException
|
||||
*/
|
||||
public function renameTag($oldName, $newName)
|
||||
public function renameTag($oldName, $newName): Tag
|
||||
{
|
||||
$criteria = ['name' => $oldName];
|
||||
/** @var Tag|null $tag */
|
||||
|
@ -12,13 +12,13 @@ interface TagServiceInterface
|
||||
/**
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function listTags();
|
||||
public function listTags(): array;
|
||||
|
||||
/**
|
||||
* @param string[] $tagNames
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTags(array $tagNames);
|
||||
public function deleteTags(array $tagNames): void;
|
||||
|
||||
/**
|
||||
* Provided a list of tag names, creates all that do not exist yet
|
||||
@ -26,7 +26,7 @@ interface TagServiceInterface
|
||||
* @param string[] $tagNames
|
||||
* @return Collection|Tag[]
|
||||
*/
|
||||
public function createTags(array $tagNames);
|
||||
public function createTags(array $tagNames): Collection;
|
||||
|
||||
/**
|
||||
* @param string $oldName
|
||||
@ -34,5 +34,5 @@ interface TagServiceInterface
|
||||
* @return Tag
|
||||
* @throws EntityDoesNotExistException
|
||||
*/
|
||||
public function renameTag($oldName, $newName);
|
||||
public function renameTag($oldName, $newName): Tag;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class ApiKeyService implements ApiKeyServiceInterface
|
||||
* @param \DateTime $expirationDate
|
||||
* @return ApiKey
|
||||
*/
|
||||
public function create(\DateTime $expirationDate = null)
|
||||
public function create(\DateTime $expirationDate = null): ApiKey
|
||||
{
|
||||
$key = new ApiKey();
|
||||
if ($expirationDate !== null) {
|
||||
@ -44,7 +44,7 @@ class ApiKeyService implements ApiKeyServiceInterface
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function check(string $key)
|
||||
public function check(string $key): bool
|
||||
{
|
||||
/** @var ApiKey|null $apiKey */
|
||||
$apiKey = $this->getByKey($key);
|
||||
@ -58,7 +58,7 @@ class ApiKeyService implements ApiKeyServiceInterface
|
||||
* @return ApiKey
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function disable(string $key)
|
||||
public function disable(string $key): ApiKey
|
||||
{
|
||||
/** @var ApiKey|null $apiKey */
|
||||
$apiKey = $this->getByKey($key);
|
||||
@ -77,10 +77,12 @@ class ApiKeyService implements ApiKeyServiceInterface
|
||||
* @param bool $enabledOnly Tells if only enabled keys should be returned
|
||||
* @return ApiKey[]
|
||||
*/
|
||||
public function listKeys(bool $enabledOnly = false)
|
||||
public function listKeys(bool $enabledOnly = false): array
|
||||
{
|
||||
$conditions = $enabledOnly ? ['enabled' => true] : [];
|
||||
return $this->em->getRepository(ApiKey::class)->findBy($conditions);
|
||||
/** @var ApiKey[] $apiKeys */
|
||||
$apiKeys = $this->em->getRepository(ApiKey::class)->findBy($conditions);
|
||||
return $apiKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +91,7 @@ class ApiKeyService implements ApiKeyServiceInterface
|
||||
* @param string $key
|
||||
* @return ApiKey|null
|
||||
*/
|
||||
public function getByKey(string $key)
|
||||
public function getByKey(string $key): ?ApiKey
|
||||
{
|
||||
/** @var ApiKey|null $apiKey */
|
||||
$apiKey = $this->em->getRepository(ApiKey::class)->findOneBy([
|
||||
|
@ -14,7 +14,7 @@ interface ApiKeyServiceInterface
|
||||
* @param \DateTime $expirationDate
|
||||
* @return ApiKey
|
||||
*/
|
||||
public function create(\DateTime $expirationDate = null);
|
||||
public function create(\DateTime $expirationDate = null): ApiKey;
|
||||
|
||||
/**
|
||||
* Checks if provided key is a valid api key
|
||||
@ -22,7 +22,7 @@ interface ApiKeyServiceInterface
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function check(string $key);
|
||||
public function check(string $key): bool;
|
||||
|
||||
/**
|
||||
* Disables provided api key
|
||||
@ -31,7 +31,7 @@ interface ApiKeyServiceInterface
|
||||
* @return ApiKey
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function disable(string $key);
|
||||
public function disable(string $key): ApiKey;
|
||||
|
||||
/**
|
||||
* Lists all existing api keys
|
||||
@ -39,7 +39,7 @@ interface ApiKeyServiceInterface
|
||||
* @param bool $enabledOnly Tells if only enabled keys should be returned
|
||||
* @return ApiKey[]
|
||||
*/
|
||||
public function listKeys(bool $enabledOnly = false);
|
||||
public function listKeys(bool $enabledOnly = false): array;
|
||||
|
||||
/**
|
||||
* Tries to find one API key by its key string
|
||||
@ -47,5 +47,5 @@ interface ApiKeyServiceInterface
|
||||
* @param string $key
|
||||
* @return ApiKey|null
|
||||
*/
|
||||
public function getByKey(string $key);
|
||||
public function getByKey(string $key): ?ApiKey;
|
||||
}
|
||||
|
@ -4,4 +4,3 @@ parameters:
|
||||
- module/Rest/src/Util/RestUtils.php
|
||||
ignoreErrors:
|
||||
- '#is not subtype of Throwable#'
|
||||
- '#Cannot access offset#'
|
||||
|
Loading…
Reference in New Issue
Block a user