Skip to content

Commit

Permalink
fix a few psalm errors
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Dec 20, 2022
1 parent 42cb621 commit 783e49c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
7 changes: 1 addition & 6 deletions core/Controller/ReferenceApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ public function resolve(array $references, int $limit = 1): DataResponse {
* @return DataResponse
*/
public function getProvidersInfo(): DataResponse {
try {
$providers = $this->referenceManager->getDiscoverableProviders();
} catch (ContainerExceptionInterface | NotFoundExceptionInterface $e) {
return new DataResponse(['message' => 'Error getting providers'], Http::STATUS_NOT_FOUND);
}

$providers = $this->referenceManager->getDiscoverableProviders();
$jsonProviders = array_map(static function (IDiscoverableReferenceProvider $provider) {
return $provider->jsonSerialize();
}, $providers);
Expand Down
12 changes: 1 addition & 11 deletions lib/private/Collaboration/Reference/ReferenceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct(LinkReferenceProvider $linkReferenceProvider, ICache
* Extract a list of URLs from a text
*
* @param string $text
* @return array|string[]
* @return string[]
*/
public function extractReferences(string $text): array {
preg_match_all(IURLGenerator::URL_REGEX, $text, $matches);
Expand All @@ -78,8 +78,6 @@ public function extractReferences(string $text): array {
*
* @param string $referenceId
* @return IReference|null
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getReferenceFromCache(string $referenceId): ?IReference {
$matchedProvider = $this->getMatchedProvider($referenceId);
Expand Down Expand Up @@ -113,8 +111,6 @@ public function getReferenceByCacheKey(string $cacheKey): ?IReference {
*
* @param string $referenceId
* @return IReference|null
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function resolveReference(string $referenceId): ?IReference {
$matchedProvider = $this->getMatchedProvider($referenceId);
Expand Down Expand Up @@ -144,8 +140,6 @@ public function resolveReference(string $referenceId): ?IReference {
*
* @param string $referenceId
* @return IReferenceProvider|null the first matching provider
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function getMatchedProvider(string $referenceId): ?IReferenceProvider {
$matchedProvider = null;
Expand Down Expand Up @@ -195,8 +189,6 @@ public function invalidateCache(string $cachePrefix, ?string $cacheKey = null):

/**
* @return IReferenceProvider[]
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getProviders(): array {
if ($this->providers === null) {
Expand Down Expand Up @@ -230,8 +222,6 @@ public function getProviders(): array {
* If the provider is searchable, also get the list of supported unified search providers
*
* @return IDiscoverableReferenceProvider[]
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getDiscoverableProviders(): array {
// preserve 0 based index to avoid returning an object in data responses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ public function handle(Event $event): void {
return;
}

try {
$providers = $this->manager->getDiscoverableProviders();
} catch (ContainerExceptionInterface | NotFoundExceptionInterface $e) {
return;
}

$providers = $this->manager->getDiscoverableProviders();
$jsonProviders = array_map(static function (IDiscoverableReferenceProvider $provider) {
return $provider->jsonSerialize();
}, $providers);
Expand Down

0 comments on commit 783e49c

Please sign in to comment.