From ba3de620762cc84e1eaa4be1f4cee2808a72bfcd Mon Sep 17 00:00:00 2001 From: Mario Trojan <mario.trojan@uni-tuebingen.de> Date: Fri, 30 Oct 2020 13:57:36 +0100 Subject: [PATCH] Fix for several problems found by PHPStan --- module/VuFind/src/VuFind/Favorites/FavoritesService.php | 1 + module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php | 2 +- module/VuFind/src/VuFind/ILS/Driver/Symphony.php | 4 ++-- module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php | 2 +- module/VuFind/src/VuFind/RecordDriver/IlsAwareTrait.php | 2 ++ .../src/VuFindSearch/Backend/LibGuides/Connector.php | 1 - 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/VuFind/src/VuFind/Favorites/FavoritesService.php b/module/VuFind/src/VuFind/Favorites/FavoritesService.php index 2217326a52a..5bd04ab8b55 100644 --- a/module/VuFind/src/VuFind/Favorites/FavoritesService.php +++ b/module/VuFind/src/VuFind/Favorites/FavoritesService.php @@ -29,6 +29,7 @@ namespace VuFind\Favorites; use VuFind\Db\Table\Resource as ResourceTable; use VuFind\Db\Table\UserList as UserListTable; +use VuFind\Exception\LoginRequired as LoginRequiredException; use VuFind\Record\Cache as RecordCache; use VuFind\RecordDriver\AbstractBase as RecordDriver; diff --git a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php index 70407f92871..d47db5c3357 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php @@ -1956,7 +1956,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements $result = $stmt->execute( [ $newPassword_hashed, $detail['patron']['id'] ] ); - } catch (Exception $e) { + } catch (\Exception $e) { return [ 'success' => false, 'status' => $e->getMessage() ]; } return [ diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php index 7bf5c7a4043..5f97e402572 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php @@ -148,11 +148,11 @@ class Symphony extends AbstractBase implements LoggerAwareInterface ]; // Initialize cache manager. - if (isset($configArray['PolicyCache']['type']) + if (isset($this->config['PolicyCache']['type']) && $this->cacheManager ) { $this->policyCache = $this->cacheManager - ->getCache($configArray['PolicyCache']['type']); + ->getCache($this->config['PolicyCache']['type']); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index a5de9cb63dc..6fad1cd9682 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -2378,7 +2378,7 @@ EOT; $replyCode = (string)$results->{'reply-code'}; if ($replyCode != 0 && $replyCode != 8) { - throw new Exception('System error fetching call slips'); + throw new \Exception('System error fetching call slips'); } $requests = []; if (isset($results->callslips->institution)) { diff --git a/module/VuFind/src/VuFind/RecordDriver/IlsAwareTrait.php b/module/VuFind/src/VuFind/RecordDriver/IlsAwareTrait.php index 323ff5cbee4..56ee1fb0b45 100644 --- a/module/VuFind/src/VuFind/RecordDriver/IlsAwareTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/IlsAwareTrait.php @@ -29,6 +29,8 @@ */ namespace VuFind\RecordDriver; +use VuFind\Exception\ILS as ILSException; + /** * ILS support for MARC and other types of records. * diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php index 3d1f20688ee..e3325c06b15 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/LibGuides/Connector.php @@ -224,7 +224,6 @@ class Connector implements \Laminas\Log\LoggerAwareInterface 'widget_type' => 1, 'search_match' => 2, 'search_type' => 0, - 'sort_by' => 'relevance', 'list_format' => 1, 'output_format' => 1, 'load_type' => 2, -- GitLab