mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
chore: Fix typing in WizardResult
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com> Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
parent
9d41d8172b
commit
ac078b6e68
1 changed files with 20 additions and 16 deletions
|
|
@ -1,52 +1,56 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace OCA\User_LDAP;
|
||||
|
||||
class WizardResult {
|
||||
protected $changes = [];
|
||||
protected $options = [];
|
||||
protected $markedChange = false;
|
||||
/**
|
||||
* @var array<string,int|string|int[]|string[]>
|
||||
*/
|
||||
protected array $changes = [];
|
||||
/**
|
||||
* @var array<string,string[]>
|
||||
*/
|
||||
protected array $options = [];
|
||||
protected bool $markedChange = false;
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param int|string|int[]|string[] $value
|
||||
*/
|
||||
public function addChange($key, $value) {
|
||||
public function addChange(string $key, int|string|array $value): void {
|
||||
$this->changes[$key] = $value;
|
||||
}
|
||||
|
||||
|
||||
public function markChange() {
|
||||
public function markChange(): void {
|
||||
$this->markedChange = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param array|string $values
|
||||
* @param string|string[] $values
|
||||
*/
|
||||
public function addOptions($key, $values) {
|
||||
public function addOptions(string $key, string|array $values): void {
|
||||
if (!is_array($values)) {
|
||||
$values = [$values];
|
||||
}
|
||||
$this->options[$key] = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChanges() {
|
||||
public function hasChanges(): bool {
|
||||
return (count($this->changes) > 0 || $this->markedChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array{changes:array<string,int|string|int[]|string[]>,options?:array<string,string[]>}
|
||||
*/
|
||||
public function getResultArray() {
|
||||
public function getResultArray(): array {
|
||||
$result = [];
|
||||
$result['changes'] = $this->changes;
|
||||
if (count($this->options) > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue