mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 12:40:08 +02:00
Fixed some psalm issues.
This commit is contained in:
parent
eb9b24d5d7
commit
cb0aa7bc7a
32 changed files with 217 additions and 148 deletions
|
@ -56,13 +56,13 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
*/
|
||||
protected $filetype_filter = '';
|
||||
/**
|
||||
* @var Collection<AttachmentTypeAttachment>
|
||||
* @var Collection<int, AttachmentTypeAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<AttachmentTypeParameter>
|
||||
/** @var Collection<int, AttachmentTypeParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
@ -70,7 +70,7 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
protected $parameters;
|
||||
|
||||
/**
|
||||
* @var Collection|Attachment[]
|
||||
* @var Collection<int, Attachment>
|
||||
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachment_type")
|
||||
*/
|
||||
protected $attachments_with_type;
|
||||
|
|
|
@ -93,12 +93,12 @@ class Device extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $order_only_missing_parts = false;
|
||||
/**
|
||||
* @var Collection<DeviceAttachment>
|
||||
* @var Collection<int, DeviceAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<DeviceParameter>
|
||||
/** @var Collection<int, DeviceParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\DeviceParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
*/
|
||||
|
|
|
@ -37,11 +37,13 @@ trait ParametersTrait
|
|||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Return all associated specifications.
|
||||
* Return all associated specifications.
|
||||
*
|
||||
* @return Collection<AbstractParameter>
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*
|
||||
* @psalm-return \Doctrine\Common\Collections\Collection<int, PartParameter>
|
||||
*/
|
||||
public function getParameters(): Collection
|
||||
public function getParameters(): \Doctrine\Common\Collections\Collection
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
|
|
@ -101,13 +101,13 @@ class Category extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $default_comment = '';
|
||||
/**
|
||||
* @var Collection|CategoryAttachment[]
|
||||
* @var Collection<int, CategoryAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection|CategoryParameter[]
|
||||
/** @var Collection<int, CategoryParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -81,7 +81,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @var Collection<FootprintAttachment>
|
||||
* @var Collection<int, FootprintAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
@ -94,7 +94,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $footprint_3d;
|
||||
|
||||
/** @var Collection<FootprintParameter>
|
||||
/** @var Collection<int, FootprintParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})@ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -81,13 +81,13 @@ class Manufacturer extends AbstractCompany
|
|||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @var Collection<ManufacturerAttachment>
|
||||
* @var Collection<int, ManufacturerAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<ManufacturerParameter>
|
||||
/** @var Collection<int, ManufacturerParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -98,13 +98,13 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @var Collection<MeasurementUnitAttachment>
|
||||
* @var Collection<int, MeasurementUnitAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<MeasurementUnitParameter>
|
||||
/** @var Collection<int, MeasurementUnitParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -92,7 +92,7 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
protected $devices = [];
|
||||
|
||||
/** @var Collection<PartParameter>
|
||||
/** @var Collection<int, PartParameter>
|
||||
* @Assert\Valid()
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
|
@ -119,7 +119,7 @@ class Part extends AttachmentContainingDBElement
|
|||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var Collection<PartAttachment>
|
||||
* @var Collection<int, PartAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ColumnSecurity(type="collection", prefix="attachments")
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -92,7 +92,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parts;
|
||||
|
||||
/** @var Collection<StorelocationParameter>
|
||||
/** @var Collection<int, StorelocationParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
@ -117,7 +117,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $limit_to_existing_parts = false;
|
||||
/**
|
||||
* @var Collection<StorelocationAttachment>
|
||||
* @var Collection<int, StorelocationAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
|
|
@ -109,13 +109,13 @@ class Supplier extends AbstractCompany
|
|||
protected $parts;
|
||||
|
||||
/**
|
||||
* @var Collection<SupplierAttachment>
|
||||
* @var Collection<int, SupplierAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<SupplierParameter>
|
||||
/** @var Collection<int, SupplierParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -88,13 +88,13 @@ class Currency extends AbstractStructuralDBElement
|
|||
protected $parent;
|
||||
|
||||
/**
|
||||
* @var Collection<CurrencyAttachment>
|
||||
* @var Collection<int, CurrencyAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<CurrencyParameter>
|
||||
/** @var Collection<int, CurrencyParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -136,11 +136,11 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*********************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
|
||||
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
|
||||
*
|
||||
* @return Orderdetail the orderdetail this price belongs to
|
||||
* @return Orderdetail|null the orderdetail this price belongs to
|
||||
*/
|
||||
public function getOrderdetail(): Orderdetail
|
||||
public function getOrderdetail(): ?Orderdetail
|
||||
{
|
||||
return $this->orderdetail;
|
||||
}
|
||||
|
@ -157,17 +157,20 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the price for a single unit in the currency associated with this price detail.
|
||||
* Get the price for a single unit in the currency associated with this price detail.
|
||||
*
|
||||
* @param float|string $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
*
|
||||
* You will get the price for $multiplier parts. If you want the price which is stored
|
||||
* in the database, you have to pass the "price_related_quantity" count as $multiplier.
|
||||
*
|
||||
* @param float|string $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
*
|
||||
* You will get the price for $multiplier parts. If you want the price which is stored
|
||||
* in the database, you have to pass the "price_related_quantity" count as $multiplier.
|
||||
*
|
||||
* @return string the price as a bcmath string
|
||||
* @return null|string the price as a bcmath string
|
||||
*/
|
||||
public function getPricePerUnit($multiplier = 1.0): string
|
||||
public function getPricePerUnit($multiplier = 1.0): ?string
|
||||
{
|
||||
$multiplier = (string) $multiplier;
|
||||
$tmp = bcmul($this->price, $multiplier, static::PRICE_PRECISION);
|
||||
|
|
|
@ -81,7 +81,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
*/
|
||||
protected $enforce2FA = false;
|
||||
/**
|
||||
* @var Collection<GroupAttachment>
|
||||
* @var Collection<int, GroupAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
*/
|
||||
protected $permissions;
|
||||
|
||||
/** @var Collection<GroupParameter>
|
||||
/** @var Collection<int, GroupParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -227,7 +227,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected $settings = [];
|
||||
|
||||
/**
|
||||
* @var Collection|UserAttachment[]
|
||||
* @var Collection<int, UserAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\UserAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $attachments;
|
||||
|
@ -237,7 +237,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
protected $backupCodesGenerationDate;
|
||||
|
||||
/** @var Collection<TwoFactorKeyInterface>
|
||||
/** @var Collection<int, TwoFactorKeyInterface>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $u2fKeys;
|
||||
|
@ -862,9 +862,11 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
*
|
||||
* @return Collection<TwoFactorKeyInterface>
|
||||
* @return Collection
|
||||
*
|
||||
* @psalm-return Collection<int, TwoFactorKeyInterface>
|
||||
*/
|
||||
public function getU2FKeys(): Collection
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue