Skip to content

Commit 33bff30

Browse files
committed
feat(lexicon): moving out from unstable
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent cb410cd commit 33bff30

34 files changed

+444
-443
lines changed

apps/files_external/lib/ConfigLexicon.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@
88

99
namespace OCA\Files_External;
1010

11-
use NCU\Config\Lexicon\ConfigLexiconEntry;
12-
use NCU\Config\Lexicon\ConfigLexiconStrictness;
13-
use NCU\Config\Lexicon\IConfigLexicon;
14-
use NCU\Config\ValueType;
11+
use OCP\Config\Lexicon\Entry;
12+
use OCP\Config\Lexicon\ILexicon;
13+
use OCP\Config\Lexicon\Strictness;
14+
use OCP\Config\ValueType;
1515

1616
/**
1717
* Config Lexicon for files_sharing.
1818
*
1919
* Please Add & Manage your Config Keys in that file and keep the Lexicon up to date!
2020
*
21-
* {@see IConfigLexicon}
21+
* {@see ILexicon}
2222
*/
23-
class ConfigLexicon implements IConfigLexicon {
23+
class ConfigLexicon implements ILexicon {
2424
public const ALLOW_USER_MOUNTING = 'allow_user_mounting';
2525
public const USER_MOUNTING_BACKENDS = 'user_mounting_backends';
2626

27-
public function getStrictness(): ConfigLexiconStrictness {
28-
return ConfigLexiconStrictness::NOTICE;
27+
public function getStrictness(): Strictness {
28+
return Strictness::NOTICE;
2929
}
3030

3131
public function getAppConfigs(): array {
3232
return [
33-
new ConfigLexiconEntry(self::ALLOW_USER_MOUNTING, ValueType::BOOL, false, 'allow users to mount their own external filesystems', true),
34-
new ConfigLexiconEntry(self::USER_MOUNTING_BACKENDS, ValueType::STRING, '', 'list of mounting backends available for users', true),
33+
new Entry(self::ALLOW_USER_MOUNTING, ValueType::BOOL, false, 'allow users to mount their own external filesystems', true),
34+
new Entry(self::USER_MOUNTING_BACKENDS, ValueType::STRING, '', 'list of mounting backends available for users', true),
3535
];
3636
}
3737

apps/files_sharing/lib/Config/ConfigLexicon.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88

99
namespace OCA\Files_Sharing\Config;
1010

11-
use NCU\Config\Lexicon\ConfigLexiconEntry;
12-
use NCU\Config\Lexicon\ConfigLexiconStrictness;
13-
use NCU\Config\Lexicon\IConfigLexicon;
14-
use NCU\Config\ValueType;
11+
use OCP\Config\Lexicon\Entry;
12+
use OCP\Config\Lexicon\ILexicon;
13+
use OCP\Config\Lexicon\Strictness;
14+
use OCP\Config\ValueType;
1515

1616
/**
1717
* Config Lexicon for files_sharing.
1818
*
1919
* Please Add & Manage your Config Keys in that file and keep the Lexicon up to date!
2020
*
21-
* {@see IConfigLexicon}
21+
* {@see ILexicon}
2222
*/
23-
class ConfigLexicon implements IConfigLexicon {
23+
class ConfigLexicon implements ILexicon {
2424
public const SHOW_FEDERATED_AS_INTERNAL = 'show_federated_shares_as_internal';
2525

26-
public function getStrictness(): ConfigLexiconStrictness {
27-
return ConfigLexiconStrictness::IGNORE;
26+
public function getStrictness(): Strictness {
27+
return Strictness::IGNORE;
2828
}
2929

3030
public function getAppConfigs(): array {
3131
return [
32-
new ConfigLexiconEntry(self::SHOW_FEDERATED_AS_INTERNAL, ValueType::BOOL, false, 'shows federated shares as internal shares', true),
32+
new Entry(self::SHOW_FEDERATED_AS_INTERNAL, ValueType::BOOL, false, 'shows federated shares as internal shares', true),
3333
];
3434
}
3535

apps/theming/tests/Migration/Version2006Date20240905111627Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace OCA\Theming\Tests\Migration;
1111

12-
use NCU\Config\IUserConfig;
1312
use OCA\Theming\Migration\Version2006Date20240905111627;
1413
use OCP\BackgroundJob\IJobList;
14+
use OCP\Config\IUserConfig;
1515
use OCP\IAppConfig;
1616
use OCP\IDBConnection;
1717
use OCP\IUserManager;

core/Command/Config/Preset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
*/
99
namespace OC\Core\Command\Config;
1010

11-
use NCU\Config\Lexicon\Preset as ConfigLexiconPreset;
1211
use OC\Config\ConfigManager;
1312
use OC\Core\Command\Base;
13+
use OCP\Config\Lexicon\Preset as ConfigLexiconPreset;
1414
use OCP\IConfig;
1515
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Input\InputInterface;

lib/composer/composer/autoload_classmap.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
return array(
99
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10-
'NCU\\Config\\Exceptions\\IncorrectTypeException' => $baseDir . '/lib/unstable/Config/Exceptions/IncorrectTypeException.php',
11-
'NCU\\Config\\Exceptions\\TypeConflictException' => $baseDir . '/lib/unstable/Config/Exceptions/TypeConflictException.php',
12-
'NCU\\Config\\Exceptions\\UnknownKeyException' => $baseDir . '/lib/unstable/Config/Exceptions/UnknownKeyException.php',
13-
'NCU\\Config\\IUserConfig' => $baseDir . '/lib/unstable/Config/IUserConfig.php',
14-
'NCU\\Config\\Lexicon\\ConfigLexiconEntry' => $baseDir . '/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php',
15-
'NCU\\Config\\Lexicon\\ConfigLexiconStrictness' => $baseDir . '/lib/unstable/Config/Lexicon/ConfigLexiconStrictness.php',
16-
'NCU\\Config\\Lexicon\\IConfigLexicon' => $baseDir . '/lib/unstable/Config/Lexicon/IConfigLexicon.php',
17-
'NCU\\Config\\Lexicon\\Preset' => $baseDir . '/lib/unstable/Config/Lexicon/Preset.php',
18-
'NCU\\Config\\ValueType' => $baseDir . '/lib/unstable/Config/ValueType.php',
1910
'NCU\\Federation\\ISignedCloudFederationProvider' => $baseDir . '/lib/unstable/Federation/ISignedCloudFederationProvider.php',
2011
'NCU\\Security\\Signature\\Enum\\DigestAlgorithm' => $baseDir . '/lib/unstable/Security/Signature/Enum/DigestAlgorithm.php',
2112
'NCU\\Security\\Signature\\Enum\\SignatoryStatus' => $baseDir . '/lib/unstable/Security/Signature/Enum/SignatoryStatus.php',
@@ -275,6 +266,15 @@
275266
'OCP\\Common\\Exception\\NotFoundException' => $baseDir . '/lib/public/Common/Exception/NotFoundException.php',
276267
'OCP\\Config\\BeforePreferenceDeletedEvent' => $baseDir . '/lib/public/Config/BeforePreferenceDeletedEvent.php',
277268
'OCP\\Config\\BeforePreferenceSetEvent' => $baseDir . '/lib/public/Config/BeforePreferenceSetEvent.php',
269+
'OCP\\Config\\Exceptions\\IncorrectTypeException' => $baseDir . '/lib/public/Config/Exceptions/IncorrectTypeException.php',
270+
'OCP\\Config\\Exceptions\\TypeConflictException' => $baseDir . '/lib/public/Config/Exceptions/TypeConflictException.php',
271+
'OCP\\Config\\Exceptions\\UnknownKeyException' => $baseDir . '/lib/public/Config/Exceptions/UnknownKeyException.php',
272+
'OCP\\Config\\IUserConfig' => $baseDir . '/lib/public/Config/IUserConfig.php',
273+
'OCP\\Config\\Lexicon\\Entry' => $baseDir . '/lib/public/Config/Lexicon/Entry.php',
274+
'OCP\\Config\\Lexicon\\ILexicon' => $baseDir . '/lib/public/Config/Lexicon/ILexicon.php',
275+
'OCP\\Config\\Lexicon\\Preset' => $baseDir . '/lib/public/Config/Lexicon/Preset.php',
276+
'OCP\\Config\\Lexicon\\Strictness' => $baseDir . '/lib/public/Config/Lexicon/Strictness.php',
277+
'OCP\\Config\\ValueType' => $baseDir . '/lib/public/Config/ValueType.php',
278278
'OCP\\Console\\ConsoleEvent' => $baseDir . '/lib/public/Console/ConsoleEvent.php',
279279
'OCP\\Console\\ReservedOptions' => $baseDir . '/lib/public/Console/ReservedOptions.php',
280280
'OCP\\Constants' => $baseDir . '/lib/public/Constants.php',

lib/composer/composer/autoload_static.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
4848

4949
public static $classMap = array (
5050
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
51-
'NCU\\Config\\Exceptions\\IncorrectTypeException' => __DIR__ . '/../../..' . '/lib/unstable/Config/Exceptions/IncorrectTypeException.php',
52-
'NCU\\Config\\Exceptions\\TypeConflictException' => __DIR__ . '/../../..' . '/lib/unstable/Config/Exceptions/TypeConflictException.php',
53-
'NCU\\Config\\Exceptions\\UnknownKeyException' => __DIR__ . '/../../..' . '/lib/unstable/Config/Exceptions/UnknownKeyException.php',
54-
'NCU\\Config\\IUserConfig' => __DIR__ . '/../../..' . '/lib/unstable/Config/IUserConfig.php',
55-
'NCU\\Config\\Lexicon\\ConfigLexiconEntry' => __DIR__ . '/../../..' . '/lib/unstable/Config/Lexicon/ConfigLexiconEntry.php',
56-
'NCU\\Config\\Lexicon\\ConfigLexiconStrictness' => __DIR__ . '/../../..' . '/lib/unstable/Config/Lexicon/ConfigLexiconStrictness.php',
57-
'NCU\\Config\\Lexicon\\IConfigLexicon' => __DIR__ . '/../../..' . '/lib/unstable/Config/Lexicon/IConfigLexicon.php',
58-
'NCU\\Config\\Lexicon\\Preset' => __DIR__ . '/../../..' . '/lib/unstable/Config/Lexicon/Preset.php',
59-
'NCU\\Config\\ValueType' => __DIR__ . '/../../..' . '/lib/unstable/Config/ValueType.php',
6051
'NCU\\Federation\\ISignedCloudFederationProvider' => __DIR__ . '/../../..' . '/lib/unstable/Federation/ISignedCloudFederationProvider.php',
6152
'NCU\\Security\\Signature\\Enum\\DigestAlgorithm' => __DIR__ . '/../../..' . '/lib/unstable/Security/Signature/Enum/DigestAlgorithm.php',
6253
'NCU\\Security\\Signature\\Enum\\SignatoryStatus' => __DIR__ . '/../../..' . '/lib/unstable/Security/Signature/Enum/SignatoryStatus.php',
@@ -316,6 +307,15 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
316307
'OCP\\Common\\Exception\\NotFoundException' => __DIR__ . '/../../..' . '/lib/public/Common/Exception/NotFoundException.php',
317308
'OCP\\Config\\BeforePreferenceDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/Config/BeforePreferenceDeletedEvent.php',
318309
'OCP\\Config\\BeforePreferenceSetEvent' => __DIR__ . '/../../..' . '/lib/public/Config/BeforePreferenceSetEvent.php',
310+
'OCP\\Config\\Exceptions\\IncorrectTypeException' => __DIR__ . '/../../..' . '/lib/public/Config/Exceptions/IncorrectTypeException.php',
311+
'OCP\\Config\\Exceptions\\TypeConflictException' => __DIR__ . '/../../..' . '/lib/public/Config/Exceptions/TypeConflictException.php',
312+
'OCP\\Config\\Exceptions\\UnknownKeyException' => __DIR__ . '/../../..' . '/lib/public/Config/Exceptions/UnknownKeyException.php',
313+
'OCP\\Config\\IUserConfig' => __DIR__ . '/../../..' . '/lib/public/Config/IUserConfig.php',
314+
'OCP\\Config\\Lexicon\\Entry' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/Entry.php',
315+
'OCP\\Config\\Lexicon\\ILexicon' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/ILexicon.php',
316+
'OCP\\Config\\Lexicon\\Preset' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/Preset.php',
317+
'OCP\\Config\\Lexicon\\Strictness' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/Strictness.php',
318+
'OCP\\Config\\ValueType' => __DIR__ . '/../../..' . '/lib/public/Config/ValueType.php',
319319
'OCP\\Console\\ConsoleEvent' => __DIR__ . '/../../..' . '/lib/public/Console/ConsoleEvent.php',
320320
'OCP\\Console\\ReservedOptions' => __DIR__ . '/../../..' . '/lib/public/Console/ReservedOptions.php',
321321
'OCP\\Constants' => __DIR__ . '/../../..' . '/lib/public/Constants.php',

lib/composer/composer/platform_check.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
2020
}
2121
}
22-
trigger_error(
23-
'Composer detected issues in your platform: ' . implode(' ', $issues),
24-
E_USER_ERROR
22+
throw new \RuntimeException(
23+
'Composer detected issues in your platform: ' . implode(' ', $issues)
2524
);
2625
}

lib/private/AllConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
*/
88
namespace OC;
99

10-
use NCU\Config\Exceptions\TypeConflictException;
11-
use NCU\Config\IUserConfig;
12-
use NCU\Config\ValueType;
1310
use OC\Config\UserConfig;
1411
use OCP\Cache\CappedMemoryCache;
12+
use OCP\Config\Exceptions\TypeConflictException;
13+
use OCP\Config\IUserConfig;
14+
use OCP\Config\ValueType;
1515
use OCP\IConfig;
1616
use OCP\IDBConnection;
1717
use OCP\PreConditionNotMetException;

lib/private/AppConfig.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
use InvalidArgumentException;
1313
use JsonException;
14-
use NCU\Config\Lexicon\ConfigLexiconEntry;
15-
use NCU\Config\Lexicon\ConfigLexiconStrictness;
16-
use NCU\Config\Lexicon\IConfigLexicon;
17-
use NCU\Config\Lexicon\Preset;
1814
use OC\AppFramework\Bootstrap\Coordinator;
1915
use OC\Config\ConfigManager;
16+
use OCP\Config\Lexicon\Entry;
17+
use OCP\Config\Lexicon\ILexicon;
18+
use OCP\Config\Lexicon\Preset;
19+
use OCP\Config\Lexicon\Strictness;
2020
use OCP\DB\Exception as DBException;
2121
use OCP\DB\QueryBuilder\IQueryBuilder;
2222
use OCP\Exceptions\AppConfigIncorrectTypeException;
@@ -62,7 +62,7 @@ class AppConfig implements IAppConfig {
6262
private array $valueTypes = []; // type for all config values
6363
private bool $fastLoaded = false;
6464
private bool $lazyLoaded = false;
65-
/** @var array<string, array{entries: array<string, ConfigLexiconEntry>, aliases: array<string, string>, strictness: ConfigLexiconStrictness}> ['app_id' => ['strictness' => ConfigLexiconStrictness, 'entries' => ['config_key' => ConfigLexiconEntry[]]] */
65+
/** @var array<string, array{entries: array<string, Entry>, aliases: array<string, string>, strictness: Strictness}> ['app_id' => ['strictness' => ConfigLexiconStrictness, 'entries' => ['config_key' => ConfigLexiconEntry[]]] */
6666
private array $configLexiconDetails = [];
6767
private bool $ignoreLexiconAliases = false;
6868
private ?Preset $configLexiconPreset = null;
@@ -1655,7 +1655,7 @@ private function matchAndApplyLexiconDefinition(
16551655
return true;
16561656
}
16571657

1658-
/** @var ConfigLexiconEntry $configValue */
1658+
/** @var Entry $configValue */
16591659
$configValue = $configDetails['entries'][$key];
16601660
$type &= ~self::VALUE_SENSITIVE;
16611661

@@ -1685,28 +1685,28 @@ private function matchAndApplyLexiconDefinition(
16851685
/**
16861686
* manage ConfigLexicon behavior based on strictness set in IConfigLexicon
16871687
*
1688-
* @param ConfigLexiconStrictness|null $strictness
1688+
* @param Strictness|null $strictness
16891689
* @param string $line
16901690
*
16911691
* @return bool TRUE if conflict can be fully ignored, FALSE if action should be not performed
16921692
* @throws AppConfigUnknownKeyException if strictness implies exception
1693-
* @see IConfigLexicon::getStrictness()
1693+
* @see ILexicon::getStrictness()
16941694
*/
16951695
private function applyLexiconStrictness(
1696-
?ConfigLexiconStrictness $strictness,
1696+
?Strictness $strictness,
16971697
string $line = '',
16981698
): bool {
16991699
if ($strictness === null) {
17001700
return true;
17011701
}
17021702

17031703
switch ($strictness) {
1704-
case ConfigLexiconStrictness::IGNORE:
1704+
case Strictness::IGNORE:
17051705
return true;
1706-
case ConfigLexiconStrictness::NOTICE:
1706+
case Strictness::NOTICE:
17071707
$this->logger->notice($line);
17081708
return true;
1709-
case ConfigLexiconStrictness::WARNING:
1709+
case Strictness::WARNING:
17101710
$this->logger->warning($line);
17111711
return false;
17121712
}
@@ -1720,7 +1720,7 @@ private function applyLexiconStrictness(
17201720
* @param string $appId
17211721
* @internal
17221722
*
1723-
* @return array{entries: array<string, ConfigLexiconEntry>, aliases: array<string, string>, strictness: ConfigLexiconStrictness}
1723+
* @return array{entries: array<string, Entry>, aliases: array<string, string>, strictness: Strictness}
17241724
*/
17251725
public function getConfigDetailsFromLexicon(string $appId): array {
17261726
if (!array_key_exists($appId, $this->configLexiconDetails)) {
@@ -1737,14 +1737,14 @@ public function getConfigDetailsFromLexicon(string $appId): array {
17371737
$this->configLexiconDetails[$appId] = [
17381738
'entries' => $entries,
17391739
'aliases' => $aliases,
1740-
'strictness' => $configLexicon?->getStrictness() ?? ConfigLexiconStrictness::IGNORE
1740+
'strictness' => $configLexicon?->getStrictness() ?? Strictness::IGNORE
17411741
];
17421742
}
17431743

17441744
return $this->configLexiconDetails[$appId];
17451745
}
17461746

1747-
private function getLexiconEntry(string $appId, string $key): ?ConfigLexiconEntry {
1747+
private function getLexiconEntry(string $appId, string $key): ?Entry {
17481748
return $this->getConfigDetailsFromLexicon($appId)['entries'][$key] ?? null;
17491749
}
17501750

lib/private/AppFramework/Bootstrap/RegistrationContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace OC\AppFramework\Bootstrap;
1111

1212
use Closure;
13-
use NCU\Config\Lexicon\IConfigLexicon;
1413
use OC\Config\Lexicon\CoreConfigLexicon;
1514
use OC\Support\CrashReport\Registry;
1615
use OCP\AppFramework\App;
@@ -23,6 +22,7 @@
2322
use OCP\Calendar\Room\IBackend as IRoomBackend;
2423
use OCP\Capabilities\ICapability;
2524
use OCP\Collaboration\Reference\IReferenceProvider;
25+
use OCP\Config\Lexicon\ILexicon;
2626
use OCP\Dashboard\IManager;
2727
use OCP\Dashboard\IWidget;
2828
use OCP\EventDispatcher\IEventDispatcher;
@@ -652,7 +652,7 @@ public function registerMailProvider(string $appId, string $class): void {
652652
}
653653

654654
/**
655-
* @psalm-param class-string<IConfigLexicon> $configLexiconClass
655+
* @psalm-param class-string<ILexicon> $configLexiconClass
656656
*/
657657
public function registerConfigLexicon(string $appId, string $configLexiconClass): void {
658658
$this->configLexiconClasses[$appId] = $configLexiconClass;
@@ -1023,9 +1023,9 @@ public function getMailProviders(): array {
10231023
*
10241024
* @param string $appId
10251025
*
1026-
* @return IConfigLexicon|null
1026+
* @return ILexicon|null
10271027
*/
1028-
public function getConfigLexicon(string $appId): ?IConfigLexicon {
1028+
public function getConfigLexicon(string $appId): ?ILexicon {
10291029
if (!array_key_exists($appId, $this->configLexiconClasses)) {
10301030
return null;
10311031
}

0 commit comments

Comments
 (0)