mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Added declare strict types to all files
This commit is contained in:
parent
bea90a7d94
commit
6a2ff9d153
196 changed files with 685 additions and 360 deletions
|
@ -64,7 +64,7 @@ class AttachmentManager
|
|||
*/
|
||||
public function toAbsoluteFilePath(Attachment $attachment): ?string
|
||||
{
|
||||
if (empty($attachment->getPath())) {
|
||||
if ($attachment->getPath() === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ class AttachmentManager
|
|||
*/
|
||||
public function isFileExisting(Attachment $attachment): bool
|
||||
{
|
||||
if (empty($attachment->getPath())) {
|
||||
if ($attachment->getPath() === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class AttachmentSubmitHandler
|
|||
public function isValidFileExtension(AttachmentType $attachment_type, UploadedFile $uploadedFile): bool
|
||||
{
|
||||
//Only validate if the attachment type has specified a filetype filter:
|
||||
if (empty($attachment_type->getFiletypeFilter())) {
|
||||
if ($attachment_type->getFiletypeFilter() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class AttachmentSubmitHandler
|
|||
|
||||
//Determine the old filepath
|
||||
$old_path = $this->pathResolver->placeholderToRealPath($attachment->getPath());
|
||||
if (empty($old_path) || !file_exists($old_path)) {
|
||||
if ($old_path === null || $old_path === '' || !file_exists($old_path)) {
|
||||
return $attachment;
|
||||
}
|
||||
$filename = basename($old_path);
|
||||
|
@ -357,7 +357,7 @@ class AttachmentSubmitHandler
|
|||
|
||||
//Check if we have an extension given
|
||||
$pathinfo = pathinfo($filename);
|
||||
if (!empty($pathinfo['extension'])) {
|
||||
if ($pathinfo['extension'] !== '') {
|
||||
$new_ext = $pathinfo['extension'];
|
||||
} else { //Otherwise we have to guess the extension for the new file, based on its content
|
||||
$new_ext = $this->mimeTypes->getExtensions($this->mimeTypes->guessMimeType($tmp_path))[0] ?? 'tmp';
|
||||
|
|
|
@ -119,7 +119,7 @@ class AttachmentURLGenerator
|
|||
throw new InvalidArgumentException('Thumbnail creation only works for picture attachments!');
|
||||
}
|
||||
|
||||
if ($attachment->isExternal() && !empty($attachment->getURL())) {
|
||||
if ($attachment->isExternal() && ($attachment->getURL() !== null && $attachment->getURL() !== '')) {
|
||||
return $attachment->getURL();
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ class BuiltinAttachmentsFinder
|
|||
*/
|
||||
public function find(string $keyword, array $options = [], ?array $base_list = []): array
|
||||
{
|
||||
if (empty($base_list)) {
|
||||
if ($base_list === null || $base_list === []) {
|
||||
$base_list = $this->getListOfRessources();
|
||||
}
|
||||
|
||||
|
|
|
@ -173,6 +173,6 @@ class FileTypeFilterTools
|
|||
{
|
||||
$extension = strtolower($extension);
|
||||
|
||||
return empty($filter) || in_array($extension, $this->resolveFileExtensions($filter), false);
|
||||
return $filter === '' || in_array($extension, $this->resolveFileExtensions($filter), false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ class ElementTypeNameGenerator
|
|||
public function formatLabelHTMLForEntity(AbstractDBElement $entity, bool $include_associated = false): string
|
||||
{
|
||||
//The element is existing
|
||||
if ($entity instanceof NamedElementInterface && !empty($entity->getName())) {
|
||||
if ($entity instanceof NamedElementInterface && $entity->getName() !== '') {
|
||||
try {
|
||||
$tmp = sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
|
|
|
@ -46,7 +46,7 @@ class MoneyFormatter
|
|||
public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string
|
||||
{
|
||||
$iso_code = $this->base_currency;
|
||||
if ($currency instanceof Currency && !empty($currency->getIsoCode())) {
|
||||
if ($currency instanceof Currency && ($currency->getIsoCode() !== null && $currency->getIsoCode() !== '')) {
|
||||
$iso_code = $currency->getIsoCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -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\ImportExportSystem;
|
||||
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
|
@ -135,4 +137,4 @@ class BOMImporter
|
|||
|
||||
return $bom_entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\ImportExportSystem\PartKeeprImporter;
|
||||
|
||||
class MySQLDumpXMLConverter
|
||||
|
@ -107,4 +109,4 @@ class MySQLDumpXMLConverter
|
|||
|
||||
return $row_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\ImportExportSystem\PartKeeprImporter;
|
||||
|
||||
use App\Doctrine\Purger\ResetAutoIncrementORMPurger;
|
||||
|
@ -268,4 +270,4 @@ class PKDatastructureImporter
|
|||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\ImportExportSystem\PartKeeprImporter;
|
||||
|
||||
use App\Doctrine\Purger\ResetAutoIncrementORMPurger;
|
||||
|
@ -64,4 +66,4 @@ class PKImportHelper
|
|||
{
|
||||
return $this->getDatabaseSchemaVersion($data) === '20170601175559';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\ImportExportSystem\PartKeeprImporter;
|
||||
|
||||
use Doctrine\ORM\Id\AssignedGenerator;
|
||||
|
@ -233,4 +235,4 @@ trait PKImportHelperTrait
|
|||
$property->setAccessible(true);
|
||||
$property->setValue($entity, $date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\ImportExportSystem\PartKeeprImporter;
|
||||
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
|
@ -144,4 +146,4 @@ class PKOptionalImporter
|
|||
|
||||
return is_countable($users_data) ? count($users_data) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\ImportExportSystem\PartKeeprImporter;
|
||||
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
|
@ -311,4 +313,4 @@ class PKPartImporter
|
|||
|
||||
throw new \RuntimeException(sprintf('Could not find unit with ID %s', $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\LabelSystem\PlaceholderProviders;
|
||||
|
||||
use App\Entity\LabelSystem\LabelOptions;
|
||||
|
@ -68,4 +70,4 @@ final class BarcodeProvider implements PlaceholderProviderInterface
|
|||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\LabelSystem\PlaceholderProviders;
|
||||
|
||||
use App\Entity\UserSystem\User;
|
||||
|
@ -39,4 +41,4 @@ class StorelocationProvider implements PlaceholderProviderInterface
|
|||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 => '',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Misc;
|
||||
|
||||
class ConsoleInfoHelper
|
||||
|
@ -47,17 +49,7 @@ class ConsoleInfoHelper
|
|||
return $user['name'];
|
||||
}
|
||||
|
||||
//Try to retrieve the name via the environment variable Username (Windows)
|
||||
if (isset($_SERVER['USERNAME'])) {
|
||||
return $_SERVER['USERNAME'];
|
||||
}
|
||||
|
||||
//Try to retrieve the name via the environment variable USER (Linux)
|
||||
if (isset($_SERVER['USER'])) {
|
||||
return $_SERVER['USER'];
|
||||
}
|
||||
|
||||
//Otherwise we can't determine the username
|
||||
return null;
|
||||
return $_SERVER['USERNAME'] ?? $_SERVER['USER'] ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Misc;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
|
|
|
@ -71,7 +71,7 @@ class RangeParser
|
|||
$ranges[] = $this->generateMinMaxRange($matches[1], $matches[2]);
|
||||
} elseif (is_numeric($number)) {
|
||||
$ranges[] = [(int) $number];
|
||||
} elseif (empty($number)) { //Allow empty tokens
|
||||
} elseif ($number === '') { //Allow empty tokens
|
||||
continue;
|
||||
} else {
|
||||
throw new InvalidArgumentException('Invalid range encoutered: '.$number);
|
||||
|
|
|
@ -97,7 +97,7 @@ class ParameterExtractor
|
|||
$value = trim($value);
|
||||
|
||||
//Don't allow empty names or values (these are a sign of an invalid extracted string)
|
||||
if (empty($name) || empty($value)) {
|
||||
if ($name === '' || $value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\Parts;
|
||||
|
||||
use App\Entity\Parts\Storelocation;
|
||||
|
@ -85,7 +87,7 @@ final class PartLotWithdrawAddHelper
|
|||
$this->eventLogger->log($event);
|
||||
|
||||
//Apply the comment also to global events, so it gets associated with the elementChanged log entry
|
||||
if (!$this->eventCommentHelper->isMessageSet() && !empty($comment)) {
|
||||
if (!$this->eventCommentHelper->isMessageSet() && ($comment !== null && $comment !== '')) {
|
||||
$this->eventCommentHelper->setMessage($comment);
|
||||
}
|
||||
|
||||
|
@ -125,7 +127,7 @@ final class PartLotWithdrawAddHelper
|
|||
$this->eventLogger->log($event);
|
||||
|
||||
//Apply the comment also to global events, so it gets associated with the elementChanged log entry
|
||||
if (!$this->eventCommentHelper->isMessageSet() && !empty($comment)) {
|
||||
if (!$this->eventCommentHelper->isMessageSet() && ($comment !== null && $comment !== '')) {
|
||||
$this->eventCommentHelper->setMessage($comment);
|
||||
}
|
||||
|
||||
|
@ -179,8 +181,8 @@ final class PartLotWithdrawAddHelper
|
|||
$this->eventLogger->log($event);
|
||||
|
||||
//Apply the comment also to global events, so it gets associated with the elementChanged log entry
|
||||
if (!$this->eventCommentHelper->isMessageSet() && !empty($comment)) {
|
||||
if (!$this->eventCommentHelper->isMessageSet() && ($comment !== null && $comment !== '')) {
|
||||
$this->eventCommentHelper->setMessage($comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Parts;
|
||||
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
|
|
|
@ -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\ProjectSystem;
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
|
@ -149,4 +151,4 @@ class ProjectBuildHelper
|
|||
$this->withdraw_add_helper->add($buildRequest->getBuildsPartLot(), $buildRequest->getNumberOfBuilds(), $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\ProjectSystem;
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
|
@ -35,4 +37,4 @@ class ProjectBuildPartHelper
|
|||
|
||||
return $part;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Tools;
|
||||
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class PasswordResetManager
|
|||
$expiration_date->add(date_interval_create_from_date_string('1 day'));
|
||||
$user->setPwResetExpires($expiration_date);
|
||||
|
||||
if (!empty($user->getEmail())) {
|
||||
if ($user->getEmail() !== null && $user->getEmail() !== '') {
|
||||
$address = new Address($user->getEmail(), $user->getFullName());
|
||||
$mail = new TemplatedEmail();
|
||||
$mail->to($address);
|
||||
|
|
|
@ -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\UserSystem;
|
||||
|
||||
use App\Entity\UserSystem\PermissionData;
|
||||
|
@ -181,4 +183,4 @@ class PermissionPresetsHelper
|
|||
$this->permissionResolver->setAllPermissions($perm_holder, PermissionData::ALLOW);
|
||||
return $perm_holder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\UserSystem;
|
||||
|
||||
use App\Entity\UserSystem\Group;
|
||||
|
@ -138,4 +140,4 @@ class PermissionSchemaUpdater
|
|||
$holder->getPermissions()->removePermission('devices');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class BackupCodeManager
|
|||
*/
|
||||
public function enableBackupCodes(User $user): void
|
||||
{
|
||||
if (empty($user->getBackupCodes())) {
|
||||
if ($user->getBackupCodes() === []) {
|
||||
$this->regenerateBackupCodes($user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\UserSystem;
|
||||
|
||||
use Imagine\Exception\RuntimeException;
|
||||
|
@ -115,7 +117,7 @@ class UserAvatarHelper
|
|||
private function getGravatar(User $user, int $s = 80, string $d = 'identicon', string $r = 'g'): string
|
||||
{
|
||||
$email = $user->getEmail();
|
||||
if (empty($email)) {
|
||||
if ($email === null || $email === '') {
|
||||
$email = 'Part-DB';
|
||||
}
|
||||
|
||||
|
@ -161,4 +163,4 @@ class UserAvatarHelper
|
|||
|
||||
return $attachment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue