From 979e36fb7f8d56c7d70b539aa62aebfdab6c6d3f Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Tue, 12 Dec 2023 19:17:02 +0700 Subject: [PATCH] Update docstring with proper return types --- composer.lock | 8 ++++---- src/Lib/QueryProcessor.php | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index c0cb309d..a806f2ed 100644 --- a/composer.lock +++ b/composer.lock @@ -815,12 +815,12 @@ "source": { "type": "git", "url": "https://github.com/manticoresoftware/buddy-core.git", - "reference": "2815588217640b8cb14482cd4e103ae117654414" + "reference": "a5ebad0e511557b53c547761e638704b8808a37e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/manticoresoftware/buddy-core/zipball/2815588217640b8cb14482cd4e103ae117654414", - "reference": "2815588217640b8cb14482cd4e103ae117654414", + "url": "https://api.github.com/repos/manticoresoftware/buddy-core/zipball/a5ebad0e511557b53c547761e638704b8808a37e", + "reference": "a5ebad0e511557b53c547761e638704b8808a37e", "shasum": "" }, "require": { @@ -858,7 +858,7 @@ "issues": "https://github.com/manticoresoftware/buddy-core/issues", "source": "https://github.com/manticoresoftware/buddy-core/tree/main" }, - "time": "2023-12-12T11:43:44+00:00" + "time": "2023-12-12T12:16:36+00:00" }, { "name": "manticoresoftware/buddy-plugin-alias", diff --git a/src/Lib/QueryProcessor.php b/src/Lib/QueryProcessor.php index 0bad12c3..d35d8439 100644 --- a/src/Lib/QueryProcessor.php +++ b/src/Lib/QueryProcessor.php @@ -41,10 +41,10 @@ class QueryProcessor { /** @var Pluggable */ protected static Pluggable $pluggable; - /** @var string[] */ + /** @var array */ protected static array $corePlugins = []; - /** @var string[] */ + /** @var array */ protected static array $extraPlugins = []; /** @@ -141,7 +141,7 @@ public static function printPluginsInfo(): void { foreach (['core', 'local', 'extra'] as $type) { $method = 'get' . ucfirst($type) . 'Plugins'; $plugins = array_map( - fn ($v) => explode('/', $v)[1], + fn ($v) => $v['short'], QueryProcessor::$method() ); $pluginsLine = implode(', ', $plugins) . PHP_EOL; @@ -151,15 +151,15 @@ public static function printPluginsInfo(): void { /** * Get core plugins and exclude local one that does not start with our prefix - * @return array + * @return array */ public static function getCorePlugins(): array { - return array_filter(static::$corePlugins, fn ($v) => str_starts_with($v, 'manticoresoftware/')); + return array_filter(static::$corePlugins, fn ($v) => str_starts_with($v['full'], 'manticoresoftware/')); } /** * Get local plugins by getting diff - * @return array + * @return array */ public static function getLocalPlugins(): array { return array_diff(static::$corePlugins, static::getCorePlugins()); @@ -167,7 +167,7 @@ public static function getLocalPlugins(): array { /** * Get list of external plugins that was installed by using CREATE PLUGIN instruction - * @return array + * @return array */ public static function getExtraPlugins(): array { return static::$extraPlugins; @@ -199,7 +199,7 @@ protected static function getObjFromContainer(string $objName): object { public static function detectPluginPrefixFromRequest(Request $request): string { // Try to match plugin to handle and return prefix foreach ([...static::$corePlugins, ...static::$extraPlugins] as $plugin) { - $pluginPrefix = static::NAMESPACE_PREFIX . ucfirst(Strings::camelcaseBySeparator($plugin, '-')); + $pluginPrefix = static::NAMESPACE_PREFIX . ucfirst(Strings::camelcaseBySeparator($plugin['short'], '-')); $pluginPayloadClass = "$pluginPrefix\\Payload"; if ($pluginPayloadClass::hasMatch($request)) { return $pluginPrefix;