chore(OCP): Migrate lib/Config/ to new attributes

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2025-07-25 15:45:47 +02:00
parent de46e39405
commit a3b2557486
No known key found for this signature in database
GPG key ID: F72FA5B49FFA96B0
12 changed files with 21 additions and 28 deletions

View file

@ -25,6 +25,7 @@ class OcpSinceChecker implements Psalm\Plugin\EventHandler\AfterClassLikeVisitIn
}
$isTesting = str_contains($statementsSource->getFilePath(), '/lib/public/Notification/')
|| str_contains($statementsSource->getFilePath(), '/lib/public/Config/')
|| str_contains($statementsSource->getFilePath(), 'CalendarEventStatus');
if ($isTesting) {

View file

@ -8,11 +8,10 @@ declare(strict_types=1);
namespace OCP\Config;
use OCP\AppFramework\Attribute\Listenable;
use OCP\EventDispatcher\Event;
/**
* @since 25.0.0
*/
#[Listenable(since: '25.0.0')]
class BeforePreferenceDeletedEvent extends Event {
protected string $userId;
protected string $appId;

View file

@ -8,11 +8,10 @@ declare(strict_types=1);
namespace OCP\Config;
use OCP\AppFramework\Attribute\Listenable;
use OCP\EventDispatcher\Event;
/**
* @since 25.0.0
*/
#[Listenable(since: '25.0.0')]
class BeforePreferenceSetEvent extends Event {
protected string $userId;
protected string $appId;

View file

@ -9,9 +9,8 @@ declare(strict_types=1);
namespace OCP\Config\Exceptions;
use Exception;
use OCP\AppFramework\Attribute\Throwable;
/**
* @since 32.0.0
*/
#[Throwable(since: '32.0.0')]
class IncorrectTypeException extends Exception {
}

View file

@ -9,9 +9,8 @@ declare(strict_types=1);
namespace OCP\Config\Exceptions;
use Exception;
use OCP\AppFramework\Attribute\Throwable;
/**
* @since 32.0.0
*/
#[Throwable(since: '32.0.0')]
class TypeConflictException extends Exception {
}

View file

@ -9,9 +9,8 @@ declare(strict_types=1);
namespace OCP\Config\Exceptions;
use Exception;
use OCP\AppFramework\Attribute\Throwable;
/**
* @since 32.0.0
*/
#[Throwable(since: '32.0.0')]
class UnknownKeyException extends Exception {
}

View file

@ -27,8 +27,6 @@ use OCP\Config\Exceptions\UnknownKeyException;
* Similarly, some methods from this class are marked with a warning about ignoring
* lazy loading. Use them wisely and only on parts of the code that are called
* during specific requests or actions to avoid loading the lazy values all the time.
*
* @since 32.0.0
*/
#[Consumable(since: '32.0.0')]
interface IUserConfig {

View file

@ -9,14 +9,15 @@ 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;

View file

@ -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 {

View file

@ -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;

View file

@ -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

View file

@ -8,15 +8,15 @@ declare(strict_types=1);
namespace OCP\Config;
use OCP\AppFramework\Attribute\Consumable;
use OCP\Config\Exceptions\IncorrectTypeException;
use OCP\IAppConfig;
use UnhandledMatchError;
/**
* Listing of available value type for typed config value
*
* @since 32.0.0
*/
#[Consumable(since: '32.0.0')]
enum ValueType: int {
/**
* @since 32.0.0