Skip to content

Commit de46e39

Browse files
Merge pull request #53975 from nextcloud/feat/lexicon/moving-out-from-unstable
feat(lexicon): moving out from unstable
2 parents 3c3b98e + 011500f commit de46e39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1844
-309
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/AppInfo/ConfigLexicon.php

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

99
namespace OC\Core\AppInfo;
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 core.
1818
*
1919
* Please Add & Manage your Config Keys in that file and keep the Lexicon up to date!
2020
*/
21-
class ConfigLexicon implements IConfigLexicon {
21+
class ConfigLexicon implements ILexicon {
2222
public const SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES = 'shareapi_allow_federation_on_public_shares';
2323

24-
public function getStrictness(): ConfigLexiconStrictness {
25-
return ConfigLexiconStrictness::IGNORE;
24+
public function getStrictness(): Strictness {
25+
return Strictness::IGNORE;
2626
}
2727

2828
public function getAppConfigs(): array {
2929
return [
30-
new ConfigLexiconEntry(
30+
new Entry(
3131
key: self::SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES,
3232
type: ValueType::BOOL,
33-
lazy: true,
3433
defaultRaw: true,
3534
definition: 'adds share permission to public shares to allow adding them to your Nextcloud (federation)',
35+
lazy: true,
3636
),
3737
];
3838
}

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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@
275275
'OCP\\Common\\Exception\\NotFoundException' => $baseDir . '/lib/public/Common/Exception/NotFoundException.php',
276276
'OCP\\Config\\BeforePreferenceDeletedEvent' => $baseDir . '/lib/public/Config/BeforePreferenceDeletedEvent.php',
277277
'OCP\\Config\\BeforePreferenceSetEvent' => $baseDir . '/lib/public/Config/BeforePreferenceSetEvent.php',
278+
'OCP\\Config\\Exceptions\\IncorrectTypeException' => $baseDir . '/lib/public/Config/Exceptions/IncorrectTypeException.php',
279+
'OCP\\Config\\Exceptions\\TypeConflictException' => $baseDir . '/lib/public/Config/Exceptions/TypeConflictException.php',
280+
'OCP\\Config\\Exceptions\\UnknownKeyException' => $baseDir . '/lib/public/Config/Exceptions/UnknownKeyException.php',
281+
'OCP\\Config\\IUserConfig' => $baseDir . '/lib/public/Config/IUserConfig.php',
282+
'OCP\\Config\\Lexicon\\Entry' => $baseDir . '/lib/public/Config/Lexicon/Entry.php',
283+
'OCP\\Config\\Lexicon\\ILexicon' => $baseDir . '/lib/public/Config/Lexicon/ILexicon.php',
284+
'OCP\\Config\\Lexicon\\Preset' => $baseDir . '/lib/public/Config/Lexicon/Preset.php',
285+
'OCP\\Config\\Lexicon\\Strictness' => $baseDir . '/lib/public/Config/Lexicon/Strictness.php',
286+
'OCP\\Config\\ValueType' => $baseDir . '/lib/public/Config/ValueType.php',
278287
'OCP\\Console\\ConsoleEvent' => $baseDir . '/lib/public/Console/ConsoleEvent.php',
279288
'OCP\\Console\\ReservedOptions' => $baseDir . '/lib/public/Console/ReservedOptions.php',
280289
'OCP\\Constants' => $baseDir . '/lib/public/Constants.php',

lib/composer/composer/autoload_static.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
316316
'OCP\\Common\\Exception\\NotFoundException' => __DIR__ . '/../../..' . '/lib/public/Common/Exception/NotFoundException.php',
317317
'OCP\\Config\\BeforePreferenceDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/Config/BeforePreferenceDeletedEvent.php',
318318
'OCP\\Config\\BeforePreferenceSetEvent' => __DIR__ . '/../../..' . '/lib/public/Config/BeforePreferenceSetEvent.php',
319+
'OCP\\Config\\Exceptions\\IncorrectTypeException' => __DIR__ . '/../../..' . '/lib/public/Config/Exceptions/IncorrectTypeException.php',
320+
'OCP\\Config\\Exceptions\\TypeConflictException' => __DIR__ . '/../../..' . '/lib/public/Config/Exceptions/TypeConflictException.php',
321+
'OCP\\Config\\Exceptions\\UnknownKeyException' => __DIR__ . '/../../..' . '/lib/public/Config/Exceptions/UnknownKeyException.php',
322+
'OCP\\Config\\IUserConfig' => __DIR__ . '/../../..' . '/lib/public/Config/IUserConfig.php',
323+
'OCP\\Config\\Lexicon\\Entry' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/Entry.php',
324+
'OCP\\Config\\Lexicon\\ILexicon' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/ILexicon.php',
325+
'OCP\\Config\\Lexicon\\Preset' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/Preset.php',
326+
'OCP\\Config\\Lexicon\\Strictness' => __DIR__ . '/../../..' . '/lib/public/Config/Lexicon/Strictness.php',
327+
'OCP\\Config\\ValueType' => __DIR__ . '/../../..' . '/lib/public/Config/ValueType.php',
319328
'OCP\\Console\\ConsoleEvent' => __DIR__ . '/../../..' . '/lib/public/Console/ConsoleEvent.php',
320329
'OCP\\Console\\ReservedOptions' => __DIR__ . '/../../..' . '/lib/public/Console/ReservedOptions.php',
321330
'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

0 commit comments

Comments
 (0)