Address PHPStan warnings in 'include/controls_compat.php'.

This commit is contained in:
wn_ 2021-11-11 20:40:30 +00:00
parent d2ccbecea6
commit e4b8e2d063
1 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,9 @@
<?php
function stylesheet_tag($filename, $attributes = []) {
/**
* @param array<string, mixed> $attributes
*/
function stylesheet_tag(string $filename, array $attributes = []): string {
$attributes_str = \Controls\attributes_to_string(
array_merge(
@ -16,7 +18,10 @@ function stylesheet_tag($filename, $attributes = []) {
return "<link $attributes_str/>\n";
}
function javascript_tag($filename, $attributes = []) {
/**
* @param array<string, mixed> $attributes
*/
function javascript_tag(string $filename, array $attributes = []): string {
$attributes_str = \Controls\attributes_to_string(
array_merge(
[
@ -29,26 +34,26 @@ function javascript_tag($filename, $attributes = []) {
return "<script $attributes_str></script>\n";
}
function format_warning($msg, $id = "") {
function format_warning(string $msg, string $id = ""): string {
return "<div class=\"alert\" id=\"$id\">$msg</div>";
}
function format_notice($msg, $id = "") {
function format_notice(string $msg, string $id = ""): string {
return "<div class=\"alert alert-info\" id=\"$id\">$msg</div>";
}
function format_error($msg, $id = "") {
function format_error(string $msg, string $id = ""): string {
return "<div class=\"alert alert-danger\" id=\"$id\">$msg</div>";
}
function print_notice($msg) {
function print_notice(string $msg): string {
return print format_notice($msg);
}
function print_warning($msg) {
function print_warning(string $msg): string {
return print format_warning($msg);
}
function print_error($msg) {
function print_error(string $msg): string {
return print format_error($msg);
}