Added declare strict types to all files

This commit is contained in:
Jan Böhmer 2023-06-11 18:59:07 +02:00
parent bea90a7d94
commit 6a2ff9d153
196 changed files with 685 additions and 360 deletions

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Services\Trees;
use Symfony\Contracts\Cache\CacheInterface;
@ -51,4 +53,4 @@ final class SidebarTreeUpdater
return new \DateTime();
});
}
}
}

View file

@ -68,20 +68,20 @@ class ToolsTreeBuilder
$item->tag(['tree_tools', 'groups', $this->keyGenerator->generateKey()]);
$tree = [];
if (!empty($this->getToolsNode())) {
if ($this->getToolsNode() !== []) {
$tree[] = (new TreeViewNode($this->translator->trans('tree.tools.tools'), null, $this->getToolsNode()))
->setIcon('fa-fw fa-treeview fa-solid fa-toolbox');
}
if (!empty($this->getEditNodes())) {
if ($this->getEditNodes() !== []) {
$tree[] = (new TreeViewNode($this->translator->trans('tree.tools.edit'), null, $this->getEditNodes()))
->setIcon('fa-fw fa-treeview fa-solid fa-pen-to-square');
}
if (!empty($this->getShowNodes())) {
if ($this->getShowNodes() !== []) {
$tree[] = (new TreeViewNode($this->translator->trans('tree.tools.show'), null, $this->getShowNodes()))
->setIcon('fa-fw fa-treeview fa-solid fa-eye');
}
if (!empty($this->getSystemNodes())) {
if ($this->getSystemNodes() !== []) {
$tree[] = (new TreeViewNode($this->translator->trans('tree.tools.system'), null, $this->getSystemNodes()))
->setIcon('fa-fw fa-treeview fa-solid fa-server');
}

View file

@ -105,11 +105,11 @@ class TreeViewGenerator
$item->setSelected(true);
}
if (!empty($item->getNodes())) {
if ($item->getNodes() !== null && $item->getNodes() !== []) {
$item->addTag((string) count($item->getNodes()));
}
if (!empty($href_type) && null !== $item->getId()) {
if ($href_type !== '' && null !== $item->getId()) {
$entity = $this->em->getPartialReference($class, $item->getId());
$item->setHref($this->urlGenerator->getURL($entity, $href_type));
}