Signed-off-by: Joas Schilling <coding@schilljs.com>pull/53072/head
parent
bbc7041c07
commit
d717dd9850
@ -0,0 +1,34 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Abstract base attribute to declare an API's stability. |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Consumable(since: '32.0.0')] |
||||
abstract class ASince { |
||||
/** |
||||
* @param string $since For shipped apps and server code such as core/ and lib/, |
||||
* this should be the server version. For other apps it |
||||
* should be the semantic app version. |
||||
*/ |
||||
public function __construct( |
||||
protected string $since, |
||||
) { |
||||
} |
||||
|
||||
public function getSince(): string { |
||||
return $this->since; |
||||
} |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the exception is "catchable" by apps. |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class Catchable extends ASince { |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the API stability is limited to "consuming" the |
||||
* class, interface, enum, etc. Apps are not allowed to implement or replace them. |
||||
* |
||||
* For events use @see \OCP\AppFramework\Attribute\Listenable |
||||
* For exceptions use @see \OCP\AppFramework\Attribute\Catchable |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class Consumable extends ASince { |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the event is "dispatchable" by apps. |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class Dispatchable extends ASince { |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the API marked as Consumable/Listenable/Catchable |
||||
* has an exception and is Implementable/Dispatchable/Throwable by a dedicated |
||||
* app. Changes to such an API have to be communicated to the affected app maintainers. |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class ExceptionalImplementable { |
||||
public function __construct( |
||||
protected string $app, |
||||
protected ?string $class = null, |
||||
) { |
||||
} |
||||
|
||||
public function getApp(): string { |
||||
return $this->app; |
||||
} |
||||
|
||||
public function getClass(): ?string { |
||||
return $this->class; |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the API stability is limited to "implementing" the |
||||
* class, interface, enum, etc. |
||||
* |
||||
* For events use @see \OCP\AppFramework\Attribute\Dispatchable |
||||
* For exceptions use @see \OCP\AppFramework\Attribute\Throwable |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class Implementable extends ASince { |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the event is "listenable" by apps. |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class Listenable extends ASince { |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
namespace OCP\AppFramework\Attribute; |
||||
|
||||
use Attribute; |
||||
|
||||
/** |
||||
* Attribute to declare that the exception is "throwable" by apps. |
||||
* |
||||
* @since 32.0.0 |
||||
*/ |
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)] |
||||
#[Consumable(since: '32.0.0')] |
||||
#[Implementable(since: '32.0.0')] |
||||
class Throwable extends ASince { |
||||
} |
||||
Loading…
Reference in new issue