0
0
Fork 0
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:
Côme Chilliet 2025-02-27 18:08:18 +01:00 committed by Côme Chilliet
parent 2cd90f8281
commit 1725d63820
4 changed files with 15 additions and 7 deletions
lib

View file

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

View file

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

View file

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

View file

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