diff options
| author | 2025-10-21 17:49:06 -0400 | |
|---|---|---|
| committer | 2025-10-21 23:49:06 +0200 | |
| commit | eee8b8c03f93b82ed762137e386659d9da3adbf3 (patch) | |
| tree | ff8d78c35a5dabca59f8b105acad0a5e47e307ce /lib/Minz/ExtensionManager.php | |
| parent | 59d33779d1e80ad2bb60b110377a3a18a085f95c (diff) | |
Add support for extension compatibility (#8081)
The compatibility does support only a minimum version of FreshRSS. If we need
something a bit more clever in the future, it is possible to handle a rule
with a bit more complexity.
See https://github.com/FreshRSS/FreshRSS/issues/5903
* Update app/Controllers/extensionController.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* Update app/i18n/pl/admin.php
Co-authored-by: Inverle <inverle@proton.me>
* Minor move phpstan-type
---------
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Inverle <inverle@proton.me>
Diffstat (limited to 'lib/Minz/ExtensionManager.php')
| -rw-r--r-- | lib/Minz/ExtensionManager.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index dac2e1d60..f1d5d0c25 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -5,6 +5,7 @@ declare(strict_types=1); * An extension manager to load extensions present in CORE_EXTENSIONS_PATH and THIRDPARTY_EXTENSIONS_PATH. * * @todo see coding style for methods!! + * @phpstan-import-type ExtensionMetadata from Minz_Extension */ final class Minz_ExtensionManager { @@ -81,7 +82,7 @@ final class Minz_ExtensionManager { continue; } $meta_raw_content = file_get_contents($metadata_filename) ?: ''; - /** @var array{'name':string,'entrypoint':string,'path':string,'author'?:string,'description'?:string,'version'?:string,'type'?:'system'|'user'}|null $meta_json */ + /** @var ExtensionMetadata|null $meta_json */ $meta_json = json_decode($meta_raw_content, true); if (!is_array($meta_json) || !self::isValidMetadata($meta_json)) { // metadata.json is not a json file? Invalid! @@ -109,8 +110,7 @@ final class Minz_ExtensionManager { * If the extension class name is `TestExtension`, entry point will be `Test`. * `entry_point` must be composed of alphanumeric characters. * - * @param array{'name':string,'entrypoint':string,'path':string,'author'?:string,'description'?:string,'version'?:string,'type'?:'system'|'user'} $meta - * is an array of values. + * @param ExtensionMetadata $meta is an array of values. * @return bool true if the array is valid, false else. */ private static function isValidMetadata(array $meta): bool { @@ -121,8 +121,7 @@ final class Minz_ExtensionManager { /** * Load the extension source code based on info metadata. * - * @param array{'name':string,'entrypoint':string,'path':string,'author'?:string,'description'?:string,'version'?:string,'type'?:'system'|'user'} $info - * an array containing information about extension. + * @param ExtensionMetadata $info an array containing information about extension. * @return Minz_Extension|null an extension inheriting from Minz_Extension. */ private static function load(array $info): ?Minz_Extension { |
