mirror of
https://github.com/nextcloud/server.git
synced 2025-03-15 00:43:23 +00:00
fix: Fix signatures and types in template related classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
2cd90f8281
commit
1725d63820
4 changed files with 15 additions and 7 deletions
lib
|
@ -75,20 +75,18 @@ class Base {
|
|||
*
|
||||
* If the key existed before, it will be overwritten
|
||||
*/
|
||||
public function assign(string $key, float|array|bool|int|string|\Throwable|null $value): void {
|
||||
public function assign(string $key, mixed $value): void {
|
||||
$this->vars[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a variable
|
||||
* @param string $key key
|
||||
* @param mixed $value value
|
||||
*
|
||||
* This function assigns a variable in an array context. If the key already
|
||||
* exists, the value will be appended. It can be accessed via
|
||||
* $_[$key][$position] in the template.
|
||||
*/
|
||||
public function append($key, $value) {
|
||||
public function append(string $key, mixed $value): void {
|
||||
if (array_key_exists($key, $this->vars)) {
|
||||
$this->vars[$key][] = $value;
|
||||
} else {
|
||||
|
|
|
@ -16,9 +16,10 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\IRequest;
|
||||
use OCP\Server;
|
||||
use OCP\Template\ITemplate;
|
||||
use OCP\Template\ITemplateManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class TemplateManager {
|
||||
class TemplateManager implements ITemplateManager {
|
||||
public function __construct(
|
||||
private IAppManager $appManager,
|
||||
private IEventDispatcher $eventDispatcher,
|
||||
|
|
|
@ -34,5 +34,14 @@ interface ITemplate {
|
|||
* If the key existed before, it will be overwritten
|
||||
* @since 32.0.0
|
||||
*/
|
||||
public function assign(string $key, float|array|bool|int|string|\Throwable|null $value): void;
|
||||
public function assign(string $key, mixed $value): void;
|
||||
|
||||
/**
|
||||
* Appends a variable
|
||||
*
|
||||
* This function assigns a variable in an array context. If the key already
|
||||
* exists, the value will be appended. It can be accessed via
|
||||
* $_[$key][$position] in the template.
|
||||
*/
|
||||
public function append(string $key, mixed $value): void;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class Util {
|
|||
* @param string $file
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static function addStyle($application, $file = null) {
|
||||
public static function addStyle($application, $file = null): void {
|
||||
\OC_Util::addStyle($application, $file);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue