Skip to content

Commit

Permalink
Update docstring with proper return types
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Dec 12, 2023
1 parent 90cbc62 commit 979e36f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/Lib/QueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class QueryProcessor {
/** @var Pluggable */
protected static Pluggable $pluggable;

/** @var string[] */
/** @var array<array{full:string,short:string,version:string}> */
protected static array $corePlugins = [];

/** @var string[] */
/** @var array<array{full:string,short:string,version:string}> */
protected static array $extraPlugins = [];

/**
Expand Down Expand Up @@ -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;
Expand All @@ -151,23 +151,23 @@ public static function printPluginsInfo(): void {

/**
* Get core plugins and exclude local one that does not start with our prefix
* @return array<string>
* @return array<array{full:string,short:string,version:string}>
*/
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<string>
* @return array<array{full:string,short:string,version:string}>
*/
public static function getLocalPlugins(): array {
return array_diff(static::$corePlugins, static::getCorePlugins());
}

/**
* Get list of external plugins that was installed by using CREATE PLUGIN instruction
* @return array<string>
* @return array<array{full:string,short:string,version:string}>
*/
public static function getExtraPlugins(): array {
return static::$extraPlugins;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 979e36f

Please sign in to comment.