From 05c056854fe29f60b1a2293e43837edcf2a7dd9c Mon Sep 17 00:00:00 2001 From: splitbrain <86426+splitbrain@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:51:18 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Automatic=20code=20style=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Embeddings.php | 3 --- Model/AbstractModel.php | 4 ++-- ModelFactory.php | 10 ++-------- cli/simulate.php | 3 --- helper.php | 2 -- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Embeddings.php b/Embeddings.php index e0f856c..da198a4 100644 --- a/Embeddings.php +++ b/Embeddings.php @@ -51,9 +51,6 @@ class Embeddings /** * Embeddings constructor. * - * @param ChatInterface $chatModel - * @param EmbeddingInterface $embedModel - * @param AbstractStorage $storage * @param array $config The plugin configuration */ public function __construct( diff --git a/Model/AbstractModel.php b/Model/AbstractModel.php index 1ed4752..87dbe6a 100644 --- a/Model/AbstractModel.php +++ b/Model/AbstractModel.php @@ -38,7 +38,7 @@ abstract class AbstractModel implements ModelInterface protected $requestStart = 0; /** @var int How often to retry a request if it fails */ - public const MAX_RETRIES = 3; + final public const MAX_RETRIES = 3; /** @var DokuHTTPClient */ protected $http; @@ -194,7 +194,7 @@ public function setDebug($debug = true) * @return mixed * @throws \Exception when the response indicates an error */ - abstract protected function parseAPIResponse($response); + abstract protected function parseAPIResponse(mixed $response); /** * Send a request to the API diff --git a/ModelFactory.php b/ModelFactory.php index 41d0dc5..3ce76c0 100644 --- a/ModelFactory.php +++ b/ModelFactory.php @@ -7,9 +7,6 @@ class ModelFactory { - /** @var array The plugin configuration */ - protected array $config; - public $chatModel; public $rephraseModel; public $embeddingModel; @@ -19,9 +16,8 @@ class ModelFactory /** * @param array $config The plugin configuration */ - public function __construct(array $config) + public function __construct(protected array $config) { - $this->config = $config; } /** @@ -39,8 +35,6 @@ public function updateConfig(array $config) /** * Set the debug flag for all models - * - * @param bool $debug */ public function setDebug(bool $debug = true) { @@ -122,7 +116,7 @@ public function getModels($availableOnly = false, $typeOnly = '') try { $info['instance'] = $this->loadModel($type, "$namespace $name"); $info['instance']->setDebug($this->debug); - } catch (\Exception $e) { + } catch (\Exception) { if ($availableOnly) continue; $info['instance'] = false; } diff --git a/cli/simulate.php b/cli/simulate.php index 3c670e0..4726640 100644 --- a/cli/simulate.php +++ b/cli/simulate.php @@ -159,8 +159,6 @@ protected function records2rows(array $result): array /** * Prefix each key in the given stats array to be merged with a larger array * - * @param string $prefix - * @param array $stats * @return array */ protected function flattenStats(string $prefix, array $stats) @@ -173,7 +171,6 @@ protected function flattenStats(string $prefix, array $stats) } /** - * @param string $file * @return array * @throws Exception */ diff --git a/helper.php b/helper.php index 19fbc1f..ec62a9b 100644 --- a/helper.php +++ b/helper.php @@ -59,7 +59,6 @@ public function setLogger($logger) /** * Update the configuration * - * @param array $config * @return void */ public function updateConfig(array $config) @@ -387,7 +386,6 @@ public function getLanguageLimit() /** * Store info about the last run * - * @param array $data * @return void */ public function setRunData(array $data)