mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 04:30:08 +02:00
Fixed some inspection issues
This commit is contained in:
parent
c6f1758a18
commit
8ae4e9fe05
39 changed files with 46 additions and 56 deletions
|
@ -22,7 +22,7 @@ namespace App\DataTables\Filters\Constraints;
|
|||
|
||||
use Doctrine\DBAL\ParameterType;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use \RuntimeException;
|
||||
use RuntimeException;
|
||||
|
||||
class NumberConstraint extends AbstractConstraint
|
||||
{
|
||||
|
|
|
@ -378,7 +378,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
->addGroupBy('suppliers')
|
||||
->addGroupBy('attachments')
|
||||
->addGroupBy('partUnit')
|
||||
->addGroupBy('parameters');
|
||||
->addGroupBy('parameters')
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode
|
||||
$tmp = explode('/', $this->path);
|
||||
|
||||
return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER));
|
||||
return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,7 +331,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
public function getShowInTable(): bool
|
||||
{
|
||||
return (bool) $this->show_in_table;
|
||||
return $this->show_in_table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -259,7 +259,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
return round($this->amount);
|
||||
}
|
||||
|
||||
return (float) $this->amount;
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -107,7 +107,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
public function isFull(): bool
|
||||
{
|
||||
return (bool) $this->is_full;
|
||||
return $this->is_full;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -176,7 +176,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
*/
|
||||
public function getObsolete(): bool
|
||||
{
|
||||
return (bool) $this->obsolete;
|
||||
return $this->obsolete;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -187,7 +187,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->price_related_quantity);
|
||||
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
return max($tmp, 1);
|
||||
}
|
||||
|
||||
return $this->price_related_quantity;
|
||||
|
|
|
@ -283,7 +283,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
public function getUsername(): string
|
||||
{
|
||||
return (string) $this->name;
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getUserIdentifier(): string
|
||||
|
|
|
@ -50,8 +50,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function Sodium\add;
|
||||
|
||||
class PartBaseType extends AbstractType
|
||||
{
|
||||
protected Security $security;
|
||||
|
|
|
@ -30,9 +30,6 @@ use App\Entity\LogSystem\ElementDeletedLogEntry;
|
|||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||
use App\Entity\UserSystem\User;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Doctrine\ORM\TransactionRequiredException;
|
||||
use RuntimeException;
|
||||
|
||||
class LogEntryRepository extends DBElementRepository
|
||||
|
|
|
@ -166,16 +166,11 @@ class EntityURLGenerator
|
|||
|
||||
public function viewURL(Attachment $entity): ?string
|
||||
{
|
||||
if ($entity instanceof Attachment) {
|
||||
if ($entity->isExternal()) { //For external attachments, return the link to external path
|
||||
return $entity->getURL();
|
||||
}
|
||||
//return $this->urlGenerator->generate('attachment_view', ['id' => $entity->getID()]);
|
||||
return $this->attachmentURLGenerator->getViewURL($entity);
|
||||
if ($entity->isExternal()) { //For external attachments, return the link to external path
|
||||
return $entity->getURL();
|
||||
}
|
||||
|
||||
//Otherwise throw an error
|
||||
throw new EntityNotSupportedException('The given entity is not supported yet!');
|
||||
//return $this->urlGenerator->generate('attachment_view', ['id' => $entity->getID()]);
|
||||
return $this->attachmentURLGenerator->getViewURL($entity);
|
||||
}
|
||||
|
||||
public function downloadURL($entity): ?string
|
||||
|
|
|
@ -26,7 +26,7 @@ use App\Entity\Parts\Part;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function \mb_strlen;
|
||||
use function mb_strlen;
|
||||
use function array_slice;
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ class UserCacheKeyGenerator
|
|||
|
||||
//If the user is null, then treat it as anonymous user.
|
||||
//When the anonymous user is passed as user then use this path too.
|
||||
if (null === $user || !($user instanceof User) || User::ID_ANONYMOUS === $user->getID()) {
|
||||
if (!($user instanceof User) || User::ID_ANONYMOUS === $user->getID()) {
|
||||
return 'user$_'.User::ID_ANONYMOUS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue