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

View file

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

View file

@ -37,7 +37,9 @@ class My
*/ */
public static function name(): string 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());
} }
/** /**