fix nullsafe warnings

This commit is contained in:
Jean-Christian Denis 2023-05-01 19:34:54 +02:00
parent 16d67e0b43
commit a0b5e61cef
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
3 changed files with 31 additions and 14 deletions

View file

@ -18,6 +18,7 @@ use dcAdmin;
use dcCore;
use dcFavorites;
use dcNsProcess;
use dcMenu;
use dcPage;
class Backend extends dcNsProcess
@ -36,16 +37,21 @@ class Backend extends dcNsProcess
return false;
}
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
My::name(),
dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
dcPage::getPF(My::id() . '/icon.svg'),
preg_match(
'/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
dcCore::app()->auth?->isSuperAdmin()
);
if (!is_null(dcCore::app()->auth)
&& !is_null(dcCore::app()->adminurl)
&& (dcCore::app()->menu[dcAdmin::MENU_PLUGINS] instanceof dcMenu)
) {
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
My::name(),
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
dcPage::getPF(My::id() . '/icon.svg'),
preg_match(
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
dcCore::app()->auth->isSuperAdmin()
);
}
dcCore::app()->addBehaviors([
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {

View file

@ -23,16 +23,25 @@ use Exception;
class ManageVars
{
/**
* @var ManageVars self instance
*/
/** @var ManageVars self instance */
private static $container;
/** @var CleanersStack The cleaners stack */
public readonly CleanersStack $cleaners;
/** @var null|CleanerParent The post form cleaner */
public readonly ?CleanerParent $cleaner;
/** @var string $related The post form related action id */
public readonly string $related;
/** @var array<int,string> The post form selected ns */
public readonly array $entries;
/** @var string The post form action id */
public readonly string $action;
/** @var array<string,string> The form actions combo */
public readonly array $combo;
protected function __construct()

View file

@ -37,7 +37,9 @@ class My
*/
public static function name(): string
{
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
return __(is_string($name) ? $name : self::id());
}
/**