diff options
Diffstat (limited to 'lib/public/Config/Lexicon')
-rw-r--r-- | lib/public/Config/Lexicon/Entry.php | 23 | ||||
-rw-r--r-- | lib/public/Config/Lexicon/ILexicon.php | 4 | ||||
-rw-r--r-- | lib/public/Config/Lexicon/Preset.php | 5 | ||||
-rw-r--r-- | lib/public/Config/Lexicon/Strictness.php | 5 |
4 files changed, 26 insertions, 11 deletions
diff --git a/lib/public/Config/Lexicon/Entry.php b/lib/public/Config/Lexicon/Entry.php index 95dae44ed11..c810522dde5 100644 --- a/lib/public/Config/Lexicon/Entry.php +++ b/lib/public/Config/Lexicon/Entry.php @@ -9,29 +9,34 @@ declare(strict_types=1); namespace OCP\Config\Lexicon; use Closure; +use OCP\AppFramework\Attribute\Consumable; use OCP\Config\ValueType; /** * Model that represent config values within an app config lexicon. * * @see ILexicon - * @since 32.0.0 */ +#[Consumable(since: '32.0.0')] class Entry { /** @since 32.0.0 */ public const RENAME_INVERT_BOOLEAN = 1; private string $definition = ''; + private string $note = ''; private ?string $default = null; /** - * @param string $key config key, can only contain alphanumerical chars and -._ + * @param string $key config key; can only contain alphanumerical chars and underscore "_" * @param ValueType $type type of config value + * @param string|int|float|bool|array|Closure|null $defaultRaw default value to be used in case none known * @param string $definition optional description of config key available when using occ command * @param bool $lazy set config value as lazy * @param int $flags set flags - * @param string|null $rename previous config key to migrate config value from * @param bool $deprecated set config key as deprecated + * @param string|null $rename source in case of a rename of a config key. + * @param int $options additional bitflag options {@see self::RENAME_INVERT_BOOLEAN} + * @param string $note additional note and warning related to the use of the config key. * * @since 32.0.0 * @psalm-suppress PossiblyInvalidCast @@ -47,6 +52,7 @@ class Entry { private readonly bool $deprecated = false, private readonly ?string $rename = null, private readonly int $options = 0, + string $note = '', ) { // key can only contain alphanumeric chars and underscore "_" if (preg_match('/[^[:alnum:]_]/', $key)) { @@ -56,6 +62,7 @@ class Entry { /** @psalm-suppress UndefinedClass */ if (\OC::$CLI) { // only store definition if ran from CLI $this->definition = $definition; + $this->note = $note; } } @@ -187,6 +194,16 @@ class Entry { } /** + * returns eventual note + * + * @return string + * @since 32.0.0 + */ + public function getNote(): string { + return $this->note; + } + + /** * returns if config key is set as lazy * * @see IAppConfig for details on lazy config values diff --git a/lib/public/Config/Lexicon/ILexicon.php b/lib/public/Config/Lexicon/ILexicon.php index 1dde23714cb..05bf5967f24 100644 --- a/lib/public/Config/Lexicon/ILexicon.php +++ b/lib/public/Config/Lexicon/ILexicon.php @@ -8,16 +8,12 @@ declare(strict_types=1); namespace OCP\Config\Lexicon; -use OCP\AppFramework\Attribute\Consumable; use OCP\AppFramework\Attribute\Implementable; /** * This interface needs to be implemented if you want to define a config lexicon for your application * The config lexicon is used to avoid conflicts and problems when storing/retrieving config values - * - * @since 32.0.0 */ -#[Consumable(since: '32.0.0')] #[Implementable(since: '32.0.0')] interface ILexicon { diff --git a/lib/public/Config/Lexicon/Preset.php b/lib/public/Config/Lexicon/Preset.php index ba0fb66dd3b..6dac8736131 100644 --- a/lib/public/Config/Lexicon/Preset.php +++ b/lib/public/Config/Lexicon/Preset.php @@ -8,6 +8,8 @@ declare(strict_types=1); namespace OCP\Config\Lexicon; +use OCP\AppFramework\Attribute\Consumable; + /** * list of preset to handle the default behavior of the instance * @@ -22,9 +24,8 @@ namespace OCP\Config\Lexicon; * - **Preset::CLUB** - Club/Association * - **Preset::FAMILY** - Family * - **Preset::PRIVATE** - Private - * - * @since 32.0.0 */ +#[Consumable(since: '32.0.0')] enum Preset: int { /** @since 32.0.0 */ case LARGE = 9; diff --git a/lib/public/Config/Lexicon/Strictness.php b/lib/public/Config/Lexicon/Strictness.php index 48e96bfc91c..8136499cb3e 100644 --- a/lib/public/Config/Lexicon/Strictness.php +++ b/lib/public/Config/Lexicon/Strictness.php @@ -8,6 +8,8 @@ declare(strict_types=1); namespace OCP\Config\Lexicon; +use OCP\AppFramework\Attribute\Consumable; + /** * Strictness regarding using not-listed config keys * @@ -15,9 +17,8 @@ namespace OCP\Config\Lexicon; * - **Strictness::NOTICE** - ignore and report * - **Strictness::WARNING** - silently block (returns $default) and report * - **Strictness::EXCEPTION** - block (throws exception) and report - * - * @since 32.0.0 */ +#[Consumable(since: '32.0.0')] enum Strictness { /** @since 32.0.0 */ case IGNORE; // fully ignore |