diff --git a/src/QUI/Menu/DropDownMenu.php b/src/QUI/Menu/DropDownMenu.php index 9c3ab02a437fb32f864568c608c146a731ae3a31..9b65eecd33709ea721644a38fb8fe5fe5290f58c 100644 --- a/src/QUI/Menu/DropDownMenu.php +++ b/src/QUI/Menu/DropDownMenu.php @@ -18,7 +18,7 @@ /** * Class DropDownMenu - * Creates an Drop Down Menu + * Creates a Drop-Down Menu * * @package QUI\Menu * @author www.pcsg.de (Henning Leutz) diff --git a/src/QUI/Menu/Independent/Factory.php b/src/QUI/Menu/Independent/Factory.php index 51f89e5aa13f103a3a749dda1ec13825be101513..884af3be92d3b77ae6ff4a0569615edfbd2c7ac5 100644 --- a/src/QUI/Menu/Independent/Factory.php +++ b/src/QUI/Menu/Independent/Factory.php @@ -2,6 +2,7 @@ namespace QUI\Menu\Independent; +use Exception; use QUI; /** @@ -29,7 +30,7 @@ public static function createMenu(): Menu try { QUI::getEvents()->fireEvent('quiqqerMenuIndependentCreate', [$Menu]); - } catch (\Exception $Exception) { + } catch (Exception $Exception) { QUI\System\Log::writeException($Exception); } @@ -42,7 +43,7 @@ public static function createMenu(): Menu * @throws QUI\Database\Exception * @throws QUI\Permissions\Exception */ - public static function deleteMenu(int $menuId) + public static function deleteMenu(int $menuId): void { QUI\Permissions\Permission::checkPermission('quiqqer.menu.delete'); @@ -52,7 +53,7 @@ public static function deleteMenu(int $menuId) try { QUI::getEvents()->fireEvent('quiqqerMenuIndependentDelete', [$menuId]); - } catch (\Exception $Exception) { + } catch (Exception $Exception) { QUI\System\Log::writeException($Exception); } } diff --git a/src/QUI/Menu/Independent/Handler.php b/src/QUI/Menu/Independent/Handler.php index e1b357bf2223af561e92f38a6b45300fa70c6dfa..8e7668785d4fe2c26fc39b535c0b034fba6c8a8e 100644 --- a/src/QUI/Menu/Independent/Handler.php +++ b/src/QUI/Menu/Independent/Handler.php @@ -36,7 +36,7 @@ public static function getMenu(int $menuId): Menu * @param QUI\Projects\Project|null $Project * @return string */ - public static function getMenuCacheName($menuId = false, QUI\Projects\Project $Project = null): string + public static function getMenuCacheName(bool|int $menuId = false, QUI\Projects\Project $Project = null): string { if ($Project) { $project = $Project->getName(); diff --git a/src/QUI/Menu/Independent/Items/AbstractMenuItem.php b/src/QUI/Menu/Independent/Items/AbstractMenuItem.php index ae5d311978fbb883914dd897099fec64c532ff91..c4e98c25680e95926e952efe6a0259ab7282ce9b 100644 --- a/src/QUI/Menu/Independent/Items/AbstractMenuItem.php +++ b/src/QUI/Menu/Independent/Items/AbstractMenuItem.php @@ -82,7 +82,7 @@ public function getName(Locale $Locale = null): string /** * alias for name - * - can be use for the `a title=""` attribute + * - can be used for the `a title=""` attribute * * @param Locale|null $Locale * @return string @@ -179,7 +179,7 @@ public function getMenuType(): string /** * @return mixed */ - public function getCustomData() + public function getCustomData(): mixed { if (isset($this->attributes['data'])) { return $this->attributes['data']; @@ -322,7 +322,7 @@ public function getChildren(bool $onlyActive = true): array * * @param AbstractMenuItem $Item */ - public function appendChild(AbstractMenuItem $Item) + public function appendChild(AbstractMenuItem $Item): void { $this->children[] = $Item; } diff --git a/src/QUI/Menu/Independent/Items/Anchor.php b/src/QUI/Menu/Independent/Items/Anchor.php index 79dac31f3f4c2107ac303c09e82e6c10ad41d296..62c179556ac9e280e5cc6c047741e01b06d274ba 100644 --- a/src/QUI/Menu/Independent/Items/Anchor.php +++ b/src/QUI/Menu/Independent/Items/Anchor.php @@ -35,7 +35,7 @@ public function getUrl(): string if ($Site) { try { $url .= $Site->getUrlRewritten(); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { } } @@ -66,7 +66,7 @@ public function getSite(): ?QUI\Projects\Site try { $siteUrl = $data['site']; $Site = QUI\Projects\Site\Utils::getSiteByLink($siteUrl); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { return null; } @@ -79,7 +79,7 @@ public function getSite(): ?QUI\Projects\Site $langId = $Site->getId($current); $LangProject = QUI::getProject($Project->getName(), $current); return $LangProject->get($langId); - } catch (QUI\Exception $exception) { + } catch (QUI\Exception) { return null; } } diff --git a/src/QUI/Menu/Independent/Items/Site.php b/src/QUI/Menu/Independent/Items/Site.php index 884fa312460ae272d59dc6f2e58e2bbc545fa2a1..3d49d1243b7e1ce8d91ef04ae28575a5188cc399 100644 --- a/src/QUI/Menu/Independent/Items/Site.php +++ b/src/QUI/Menu/Independent/Items/Site.php @@ -58,7 +58,7 @@ public function getSite(): ?QUI\Projects\Site try { $siteUrl = $data['site']; $Site = QUI\Projects\Site\Utils::getSiteByLink($siteUrl); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { return null; } @@ -72,7 +72,7 @@ public function getSite(): ?QUI\Projects\Site $LangProject = QUI::getProject($Project->getName(), $current); return $LangProject->get($langId); - } catch (QUI\Exception $exception) { + } catch (QUI\Exception) { return null; } } @@ -136,7 +136,7 @@ public function getTitle(QUI\Locale $Locale = null): string $Site = QUI\Projects\Site\Utils::getSiteByLink($siteUrl); return $Site->getAttribute('title'); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { } return ''; @@ -152,7 +152,7 @@ public function getUrl(): string if ($Site) { try { return $Site->getUrlRewritten(); - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { return ''; } } diff --git a/src/QUI/Menu/Independent/Menu.php b/src/QUI/Menu/Independent/Menu.php index efc156a3fbef91d97fdad11e34c182784e02024e..9f9d1dfc347defcb715128cd18afa4ba973e7cde 100644 --- a/src/QUI/Menu/Independent/Menu.php +++ b/src/QUI/Menu/Independent/Menu.php @@ -2,6 +2,7 @@ namespace QUI\Menu\Independent; +use Exception; use QUI; use QUI\Menu\Independent\Items\AbstractMenuItem; @@ -33,7 +34,7 @@ class Menu * @throws QUI\Exception * @throws QUI\Database\Exception */ - public function __construct($menuId) + public function __construct(int|array $menuId) { if (is_numeric($menuId)) { $data = Handler::getMenuData($menuId); @@ -92,7 +93,7 @@ public function __construct($menuId) * @param array $children * @return void */ - protected function buildChildren($Parent, array $children) + protected function buildChildren(AbstractMenuItem|Menu $Parent, array $children): void { foreach ($children as $item) { $type = $item['type']; @@ -124,7 +125,7 @@ protected function buildChildren($Parent, array $children) * * @param AbstractMenuItem $Item */ - public function appendChild(AbstractMenuItem $Item) + public function appendChild(AbstractMenuItem $Item): void { $this->children[] = $Item; } @@ -244,7 +245,7 @@ public function getData(): array * @throws QUI\Database\Exception * @throws QUI\Permissions\Exception */ - public function save(?QUI\Interfaces\Users\User $PermissionUser = null) + public function save(?QUI\Interfaces\Users\User $PermissionUser = null): void { QUI\Permissions\Permission::checkPermission('quiqqer.menu.edit', $PermissionUser); @@ -258,7 +259,7 @@ public function save(?QUI\Interfaces\Users\User $PermissionUser = null) try { QUI::getEvents()->fireEvent('quiqqerMenuIndependentSave', [$this]); - } catch (\Exception $Exception) { + } catch (Exception $Exception) { QUI\System\Log::writeException($Exception); } } @@ -269,7 +270,7 @@ public function save(?QUI\Interfaces\Users\User $PermissionUser = null) * @param array|null $title - ['de' => '', 'en' => ''] * @return void */ - public function setTitle(?array $title) + public function setTitle(?array $title): void { if ($title === null) { return; @@ -294,7 +295,7 @@ public function setTitle(?array $title) * @param array|null $title - ['de' => '', 'en' => ''] * @return void */ - public function setWorkingTitle(?array $title) + public function setWorkingTitle(?array $title): void { if ($title === null) { return; @@ -317,7 +318,7 @@ public function setWorkingTitle(?array $title) * @param array|null $data * @return void */ - public function setData(?array $data) + public function setData(?array $data): void { if ($data === null) { return; diff --git a/src/QUI/Menu/Mega/AbstractChild.php b/src/QUI/Menu/Mega/AbstractChild.php index a9999b3c2f0275164248e50d1d40f0ea0bbc622e..ad975486a7fe1944b4afc2e17bc06bd57567c9df 100644 --- a/src/QUI/Menu/Mega/AbstractChild.php +++ b/src/QUI/Menu/Mega/AbstractChild.php @@ -53,7 +53,7 @@ public function getChildren(): ?array * @return int * @throws Exception */ - public function count() + public function count(): int { return count($this->getChildren()); } diff --git a/src/QUI/Menu/MegaMenu.php b/src/QUI/Menu/MegaMenu.php index 887957230dbbf647c1054b5708eb5f18c3c0f112..542a515918728ce5532589bf46742ac8879b7579 100644 --- a/src/QUI/Menu/MegaMenu.php +++ b/src/QUI/Menu/MegaMenu.php @@ -144,7 +144,7 @@ public function getBody(): string } return $cacheResult['html']; - } catch (QUI\Exception $Exception) { + } catch (QUI\Exception) { } $Engine = QUI::getTemplateManager()->getEngine(); diff --git a/src/QUI/Menu/SlideOut.php b/src/QUI/Menu/SlideOut.php index aadf4e3754208d81a39f77ca8517f2e250c4966c..663bea4234c062343cedb2192e863bca023b95f3 100644 --- a/src/QUI/Menu/SlideOut.php +++ b/src/QUI/Menu/SlideOut.php @@ -20,7 +20,7 @@ class SlideOut extends QUI\Control /** * @param array $attributes */ - public function __construct($attributes = []) + public function __construct(array $attributes = []) { $this->setAttributes([ 'showHomeLink' => true, @@ -77,9 +77,9 @@ public function getBody(): string /** * Return the current site * - * @return mixed|QUI\Projects\Site + * @return QUI\Interfaces\Projects\Site */ - protected function getSite() + protected function getSite(): QUI\Interfaces\Projects\Site { if ($this->getAttribute('Site')) { return $this->getAttribute('Site'); diff --git a/src/QUI/Menu/SlideOutAdvanced.php b/src/QUI/Menu/SlideOutAdvanced.php index a2e460f1cd0789ec74fbd0474dfbbde0d87590a5..d345844cc3719502762884ae6e969a1527bc5548 100644 --- a/src/QUI/Menu/SlideOutAdvanced.php +++ b/src/QUI/Menu/SlideOutAdvanced.php @@ -8,9 +8,11 @@ use QUI; +use function dirname; + /** * Class MenuAdvanced - * Creates an slideout menu + * Creates a slide-out menu * * @package QUI\Menu */ @@ -19,7 +21,7 @@ class SlideOutAdvanced extends QUI\Control /** * @param array $attributes */ - public function __construct($attributes = []) + public function __construct(array $attributes = []) { $this->setAttributes([ 'menuId' => false, // if set independent menu template will be used @@ -31,7 +33,7 @@ public function __construct($attributes = []) parent::__construct($attributes); $this->addCSSFile( - \dirname(__FILE__) . '/SlideOutAdvanced.css' + dirname(__FILE__) . '/SlideOutAdvanced.css' ); } @@ -73,9 +75,9 @@ public function getBody(): string /** * Return the current site * - * @return mixed|QUI\Projects\Site + * @return QUI\Interfaces\Projects\Site */ - protected function getSite() + protected function getSite(): QUI\Interfaces\Projects\Site { if ($this->getAttribute('Site')) { return $this->getAttribute('Site'); diff --git a/src/QUI/Menu/UrlList.php b/src/QUI/Menu/UrlList.php index 6cdb5b8d7880e30856c9224d5959130dd8f903c4..a3fa9d7507b593ae888eaf26063cc9698172403b 100644 --- a/src/QUI/Menu/UrlList.php +++ b/src/QUI/Menu/UrlList.php @@ -30,7 +30,7 @@ class UrlList extends QUI\Control /** * @param array $attributes */ - public function __construct($attributes = []) + public function __construct(array $attributes = []) { // defaults values $this->setAttributes([ @@ -106,7 +106,7 @@ public function getBody(): string * @return array * @throws QUI\Exception */ - public function getChildrenForIndependentMenu() + public function getChildrenForIndependentMenu(): array { $IndependentMenu = Independent\Handler::getMenu($this->getAttribute('menuId')); @@ -116,10 +116,10 @@ public function getChildrenForIndependentMenu() /** * Get sites for QUI site * - * @return array - * @throws QUI\Exception + * @return array|int + * @throws Exception */ - public function getChildrenForQUISite() + public function getChildrenForQUISite(): array|int { $Project = $this->getProject(); @@ -146,7 +146,7 @@ public function getChildrenForQUISite() * @return array|int * @throws QUI\Exception */ - public function getChildren(QUI\Projects\Site $Site) + public function getChildren(QUI\Projects\Site $Site): array|int { if (!$this->getAttribute('showAllChildren')) { return $Site->getNavigation();