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\LogSystem;
/**
@ -53,4 +55,4 @@ class EventCommentNeededHelper
return in_array($comment_type, $this->enforce_change_comments_for, true);
}
}
}

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\LogSystem;
use App\Entity\LogSystem\AbstractLogEntry;
@ -148,4 +150,4 @@ class LogDataFormatter
{
return $data ? $this->translator->trans('true') : $this->translator->trans('false');
}
}
}

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\LogSystem;
use Jfcherng\Diff\DiffHelper;
@ -72,4 +74,4 @@ class LogDiffFormatter
return sprintf('<span class="text-muted">%s</span>', $difference);
}
}
}
}

View file

@ -68,7 +68,7 @@ class LogEntryExtraFormatter
$str .= '<error>'.$this->translator->trans($key).'</error>: ';
}
$str .= $value;
if (!empty($str)) {
if ($str !== '') {
$tmp[] = $str;
}
}
@ -91,7 +91,7 @@ class LogEntryExtraFormatter
$str .= '<b>'.$this->translator->trans($key).'</b>: ';
}
$str .= $value;
if (!empty($str)) {
if ($str !== '') {
$tmp[] = $str;
}
}
@ -184,7 +184,7 @@ class LogEntryExtraFormatter
$context->getNewStock(),
($context->getNewStock() > $context->getOldStock() ? '+' : '-'). $context->getChangeAmount(),
);
if (!empty($context->getComment())) {
if ($context->getComment() !== '') {
$array['log.part_stock_changed.comment'] = htmlspecialchars($context->getComment());
}
if ($context->getInstockChangeType() === PartStockChangedLogEntry::TYPE_MOVE) {

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\LogSystem;
use App\Entity\LogSystem\AbstractLogEntry;
@ -60,4 +62,4 @@ class LogLevelHelper
default => '',
};
}
}
}

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\LogSystem;
use App\Entity\Attachments\Attachment;
@ -82,4 +84,4 @@ class LogTargetHelper
//Otherwise we can return a label for the target
return $this->elementTypeNameGenerator->formatLabelHTMLForEntity($target, $options['show_associated']);
}
}
}