Browse Source

Fix docblock and types for new public API

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v28.0.0beta1
Côme Chilliet 9 months ago
parent
commit
1202171b32
No account linked to committer's email address

+ 2
- 3
lib/public/AppFramework/Bootstrap/IRegistrationContext.php View File

@@ -376,9 +376,8 @@ interface IRegistrationContext {
* Register an implementation of \OCP\SetupCheck\ISetupCheck that
* will handle the implementation of a setup check
*
* @psalm-param class-string<\OCP\SetupCheck\ISetupCheck> $setupCheckClass
* @return void
* @since 25.0.0
* @param class-string<\OCP\SetupCheck\ISetupCheck> $setupCheckClass
* @since 28.0.0
*/
public function registerSetupCheck(string $setupCheckClass): void;
}

+ 5
- 4
lib/public/SetupCheck/ISetupCheck.php View File

@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace OCP\SetupCheck;
@@ -8,21 +9,21 @@ namespace OCP\SetupCheck;
* setup checks in your application. The results of these checks will them
* be displayed in the admin overview.
*
* @since 25.0.0
* @since 28.0.0
*/
interface ISetupCheck {
/**
* @since 25.0.0
* @since 28.0.0
*/
public function getCategory(): string;

/**
* @since 25.0.0
* @since 28.0.0
*/
public function getName(): string;

/**
* @since 25.0.0
* @since 28.0.0
*/
public function run(): SetupResult;
}

+ 17
- 21
lib/public/SetupCheck/SetupResult.php View File

@@ -5,33 +5,30 @@ namespace OCP\SetupCheck;
/**
* @brief This class is used for storing the result of a setup check
*
* @since 25.0.0
* @since 28.0.0
*/
class SetupResult implements \JsonSerializable {
const SUCCESS = 'success';
const INFO = 'info';
const WARNING = 'warning';
const ERROR = 'error';

private string $severity;
private ?string $description;
private ?string $linkToDoc;
public const SUCCESS = 'success';
public const INFO = 'info';
public const WARNING = 'warning';
public const ERROR = 'error';

/**
* @psalm-param self::SUCCESS|self::INFO|self::WARNING|self::ERROR $severity
* @since 25.0.0
* @param self::SUCCESS|self::INFO|self::WARNING|self::ERROR $severity
* @since 28.0.0
*/
public function __construct(string $severity, ?string $description = null, ?string $linkToDoc = null) {
$this->severity = $severity;
$this->description = $description;
$this->linkToDoc = $linkToDoc;
public function __construct(
private string $severity,
private ?string $description = null,
private ?string $linkToDoc = null,
) {
}

/**
* @brief Get the severity for the setup check result
*
* @psalm-return self::INFO|self::WARNING|self::ERROR
* @since 25.0.0
* @return self::SUCCESS|self::INFO|self::WARNING|self::ERROR
* @since 28.0.0
*/
public function getSeverity(): string {
return $this->severity;
@@ -40,7 +37,7 @@ class SetupResult implements \JsonSerializable {
/**
* @brief Get the description for the setup check result
*
* @since 25.0.0
* @since 28.0.0
*/
public function getDescription(): ?string {
return $this->description;
@@ -49,14 +46,13 @@ class SetupResult implements \JsonSerializable {
/**
* @brief Get a link to the doc for the explanation.
*
* @since 25.0.0
* @since 28.0.0
*/
public function getLinkToDoc(): ?string {
return $this->linkToDoc;
}

#[\ReturnTypeWillChange]
function jsonSerialize() {
public function jsonSerialize(): array {
return [
'severity' => $this->severity,
'description' => $this->description,

Loading…
Cancel
Save