Use typed properties

This commit is contained in:
Jan Böhmer 2022-09-18 22:59:31 +02:00
parent 548ec2ea50
commit 51e05a8669
216 changed files with 603 additions and 698 deletions

View file

@ -82,24 +82,24 @@ abstract class Attachment extends AbstractNamedDBElement
* @var string|null the original filename the file had, when the user uploaded it
* @ORM\Column(type="string", nullable=true)
*/
protected $original_filename;
protected ?string $original_filename = null;
/**
* @var string The path to the file relative to a placeholder path like %MEDIA%
* @ORM\Column(type="string", name="path")
*/
protected $path = '';
protected string $path = '';
/**
* ORM mapping is done in sub classes (like PartAttachment).
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $show_in_table = false;
protected bool $show_in_table = false;
/**
* @var AttachmentType
@ -108,7 +108,7 @@ abstract class Attachment extends AbstractNamedDBElement
* @Selectable()
* @Assert\NotNull(message="validator.attachment.must_not_be_null")
*/
protected $attachment_type;
protected ?AttachmentType $attachment_type = null;
public function __construct()
{

View file

@ -55,7 +55,7 @@ class AttachmentType extends AbstractStructuralDBElement
* @ORM\Column(type="text")
* @ValidFileFilter
*/
protected $filetype_filter = '';
protected string $filetype_filter = '';
/**
* @var Collection<int, AttachmentTypeAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)

View file

@ -59,5 +59,5 @@ class AttachmentTypeAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class CategoryAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class CurrencyAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class DeviceAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class FootprintAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class GroupAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -42,5 +42,5 @@ class LabelAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\LabelSystem\LabelProfile", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class ManufacturerAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -61,5 +61,5 @@ class MeasurementUnitAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class PartAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class StorelocationAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class SupplierAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -60,5 +60,5 @@ class UserAttachment extends Attachment
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?AttachmentContainingDBElement $element = null;
}

View file

@ -57,39 +57,39 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
* @var string The address of the company
* @ORM\Column(type="string")
*/
protected $address = '';
protected string $address = '';
/**
* @var string The phone number of the company
* @ORM\Column(type="string")
*/
protected $phone_number = '';
protected string $phone_number = '';
/**
* @var string The fax number of the company
* @ORM\Column(type="string")
*/
protected $fax_number = '';
protected string $fax_number = '';
/**
* @var string The email address of the company
* @ORM\Column(type="string")
* @Assert\Email()
*/
protected $email_address = '';
protected string $email_address = '';
/**
* @var string The website of the company
* @ORM\Column(type="string")
* @Assert\Url()
*/
protected $website = '';
protected string $website = '';
/**
* @var string
* @ORM\Column(type="string")
*/
protected $auto_product_url = '';
protected string $auto_product_url = '';
/********************************************************************************
*

View file

@ -65,7 +65,7 @@ abstract class AbstractDBElement implements JsonSerializable
* @ORM\GeneratedValue()
* @Groups({"full"})
*/
protected $id;
protected ?int $id = null;
public function __clone()
{

View file

@ -44,7 +44,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
* @Assert\NotBlank()
* @Groups({"simple", "extended", "full"})
*/
protected $name = '';
protected string $name = '';
/******************************************************************************
*

View file

@ -65,19 +65,19 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
* @ORM\Column(type="text")
* @Groups({"simple", "extended", "full"})
*/
protected $comment = '';
protected string $comment = '';
/**
* @var bool If this property is set, this element can not be selected for part properties.
* Useful if this element should be used only for grouping, sorting.
* @ORM\Column(type="boolean")
*/
protected $not_selectable = false;
protected bool $not_selectable = false;
/**
* @var int
*/
protected $level = 0;
protected int $level = 0;
/**
* We can not define the mapping here or we will get an exception. Unfortunately we have to do the mapping in the
@ -98,7 +98,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/** @var string[] all names of all parent elements as a array of strings,
* the last array element is the name of the element itself
*/
private $full_path_strings = [];
private array $full_path_strings = [];
public function __construct()
{

View file

@ -57,7 +57,7 @@ trait MasterAttachmentTrait
* @ORM\JoinColumn(name="id_preview_attachement", referencedColumnName="id")
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
*/
protected $master_picture_attachment;
protected ?Attachment $master_picture_attachment = null;
/**
* Get the master picture "Attachment"-object of this part (if there is one).

View file

@ -56,14 +56,14 @@ trait TimestampTrait
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/
protected $lastModified;
protected ?DateTime $lastModified = null;
/**
* @var DateTime|null the date when this element was created
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/
protected $addedDate;
protected ?DateTime $addedDate = null;
/**
* Returns the last time when the element was modified.

View file

@ -84,16 +84,14 @@ class Device extends AbstractPartsContainingDBElement
protected $parts;
/**
* @var int
* @ORM\Column(type="integer")
*/
protected $order_quantity = 0;
protected int $order_quantity = 0;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $order_only_missing_parts = false;
protected bool $order_only_missing_parts = false;
/**
* @var Collection<int, DeviceAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)

View file

@ -66,24 +66,24 @@ class DevicePart extends AbstractDBElement
* @var int
* @ORM\Column(type="integer", name="quantity")
*/
protected $quantity;
protected int $quantity;
/**
* @var string
* @ORM\Column(type="text", name="mountnames")
*/
protected $mountnames;
protected string $mountnames;
/**
* @var Device
* @ORM\ManyToOne(targetEntity="Device", inversedBy="parts")
* @ORM\JoinColumn(name="id_device", referencedColumnName="id")
*/
protected $device;
protected Device $device;
/**
* @var Part
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part")
* @ORM\JoinColumn(name="id_part", referencedColumnName="id")
*/
protected $part;
protected Part $part;
}

View file

@ -42,53 +42,53 @@ class LabelOptions
* @Assert\Positive()
* @ORM\Column(type="float")
*/
protected $width = 50.0;
protected float $width = 50.0;
/**
* @var float The page size of the label in mm
* @Assert\Positive()
* @ORM\Column(type="float")
*/
protected $height = 30.0;
protected float $height = 30.0;
/**
* @var string The type of the barcode that should be used in the label (e.g. 'qr')
* @Assert\Choice(choices=LabelOptions::BARCODE_TYPES)
* @ORM\Column(type="string")
*/
protected $barcode_type = 'none';
protected string $barcode_type = 'none';
/**
* @var string What image should be shown along the
* @Assert\Choice(choices=LabelOptions::PICTURE_TYPES)
* @ORM\Column(type="string")
*/
protected $picture_type = 'none';
protected string $picture_type = 'none';
/**
* @var string
* @Assert\Choice(choices=LabelOptions::SUPPORTED_ELEMENTS)
* @ORM\Column(type="string")
*/
protected $supported_element = 'part';
protected string $supported_element = 'part';
/**
* @var string any additional CSS for the label
* @ORM\Column(type="text")
*/
protected $additional_css = '';
protected string $additional_css = '';
/** @var string The mode that will be used to interpret the lines
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
* @ORM\Column(type="string")
*/
protected $lines_mode = 'html';
protected string $lines_mode = 'html';
/**
* @var string
* @ORM\Column(type="text")
*/
protected $lines = '';
protected string $lines = '';
public function getWidth(): float
{

View file

@ -50,19 +50,19 @@ class LabelProfile extends AttachmentContainingDBElement
* @ORM\Embedded(class="LabelOptions")
* @Assert\Valid()
*/
protected $options;
protected LabelOptions $options;
/**
* @var string The comment info for this element
* @ORM\Column(type="text")
*/
protected $comment = '';
protected string $comment = '';
/**
* @var bool determines, if this label profile should be shown in the dropdown quick menu
* @ORM\Column(type="boolean")
*/
protected $show_in_dropdown = true;
protected bool $show_in_dropdown = true;
public function __construct()
{

View file

@ -161,33 +161,33 @@ abstract class AbstractLogEntry extends AbstractDBElement
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", fetch="EAGER")
* @ORM\JoinColumn(name="id_user", nullable=false)
*/
protected $user;
protected ?User $user = null;
/** @var DateTime The datetime the event associated with this log entry has occured
* @ORM\Column(type="datetime", name="datetime")
*/
protected $timestamp;
protected ?DateTime $timestamp = null;
/** @var int The priority level of the associated level. 0 is highest, 7 lowest
* @ORM\Column(type="integer", name="level", columnDefinition="TINYINT(4) NOT NULL")
*/
protected $level;
protected int $level;
/** @var int The ID of the element targeted by this event
* @ORM\Column(name="target_id", type="integer", nullable=false)
*/
protected $target_id = 0;
protected int $target_id = 0;
/** @var int The Type of the targeted element
* @ORM\Column(name="target_type", type="smallint", nullable=false)
*/
protected $target_type = 0;
protected int $target_type = 0;
/** @var string The type of this log entry, aka the description what has happened.
* The mapping between the log entry class and the discriminator column is done by doctrine.
* Each subclass should override this string to specify a better string.
*/
protected $typeString = 'unknown';
protected string $typeString = 'unknown';
/** @var array The extra data in raw (short form) saved in the DB
* @ORM\Column(name="extra", type="json")

View file

@ -36,8 +36,8 @@ use InvalidArgumentException;
*/
class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventUndoInterface
{
protected $typeString = 'collection_element_deleted';
protected $level = self::LEVEL_INFO;
protected string $typeString = 'collection_element_deleted';
protected int $level = self::LEVEL_INFO;
public function __construct(AbstractDBElement $changed_element, string $collection_name, AbstractDBElement $deletedElement)
{

View file

@ -50,7 +50,7 @@ use Doctrine\ORM\Mapping as ORM;
*/
class ConfigChangedLogEntry extends AbstractLogEntry
{
protected $typeString = 'config_changed';
protected string $typeString = 'config_changed';
public function __construct()
{

View file

@ -49,7 +49,7 @@ use Doctrine\ORM\Mapping as ORM;
*/
class DatabaseUpdatedLogEntry extends AbstractLogEntry
{
protected $typeString = 'database_updated';
protected string $typeString = 'database_updated';
public function __construct(string $oldVersion, string $newVersion)
{

View file

@ -55,7 +55,7 @@ use InvalidArgumentException;
*/
class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentInterface, LogWithEventUndoInterface
{
protected $typeString = 'element_created';
protected string $typeString = 'element_created';
public function __construct(AbstractDBElement $new_element)
{

View file

@ -57,7 +57,7 @@ use InvalidArgumentException;
*/
class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInterface, LogWithCommentInterface, LogWithEventUndoInterface
{
protected $typeString = 'element_deleted';
protected string $typeString = 'element_deleted';
public function __construct(AbstractDBElement $deleted_element)
{

View file

@ -54,7 +54,7 @@ use InvalidArgumentException;
*/
class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterface, LogWithCommentInterface, LogWithEventUndoInterface
{
protected $typeString = 'element_edited';
protected string $typeString = 'element_edited';
public function __construct(AbstractDBElement $changed_element)
{

View file

@ -50,7 +50,7 @@ use Doctrine\ORM\Mapping as ORM;
*/
class ExceptionLogEntry extends AbstractLogEntry
{
protected $typeString = 'exception';
protected string $typeString = 'exception';
public function __construct()
{

View file

@ -49,7 +49,7 @@ use Doctrine\ORM\Mapping as ORM;
*/
class InstockChangedLogEntry extends AbstractLogEntry
{
protected $typeString = 'instock_changed';
protected string $typeString = 'instock_changed';
/**
* Get the old instock.

View file

@ -52,7 +52,7 @@ use Symfony\Component\HttpFoundation\IpUtils;
*/
class UserLoginLogEntry extends AbstractLogEntry
{
protected $typeString = 'user_login';
protected string $typeString = 'user_login';
public function __construct(string $ip_address, bool $anonymize = true)
{

View file

@ -50,7 +50,7 @@ use Symfony\Component\HttpFoundation\IpUtils;
*/
class UserLogoutLogEntry extends AbstractLogEntry
{
protected $typeString = 'user_logout';
protected string $typeString = 'user_logout';
public function __construct(string $ip_address, bool $anonymize = true)
{

View file

@ -49,7 +49,7 @@ use Doctrine\ORM\Mapping as ORM;
*/
class UserNotAllowedLogEntry extends AbstractLogEntry
{
protected $typeString = 'user_not_allowed';
protected string $typeString = 'user_not_allowed';
public function __construct(string $path)
{

View file

@ -63,7 +63,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
* @Assert\Length(max=20)
* @ORM\Column(type="string", nullable=false)
*/
protected $symbol = '';
protected string $symbol = '';
/**
* @var float|null the guaranteed minimum value of this property
@ -72,14 +72,14 @@ abstract class AbstractParameter extends AbstractNamedDBElement
* @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max")
* @ORM\Column(type="float", nullable=true)
*/
protected $value_min;
protected ?float $value_min = null;
/**
* @var float|null the typical value of this property
* @Assert\Type({"null", "float"})
* @ORM\Column(type="float", nullable=true)
*/
protected $value_typical;
protected ?float $value_typical = null;
/**
* @var float|null the maximum value of this property
@ -87,26 +87,26 @@ abstract class AbstractParameter extends AbstractNamedDBElement
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
* @ORM\Column(type="float", nullable=true)
*/
protected $value_max;
protected ?float $value_max = null;
/**
* @var string The unit in which the value values are given (e.g. V)
* @Assert\Length(max=5)
* @ORM\Column(type="string", nullable=false)
*/
protected $unit = '';
protected string $unit = '';
/**
* @var string a text value for the given property
* @ORM\Column(type="string", nullable=false)
*/
protected $value_text = '';
protected string $value_text = '';
/**
* @var string the group this parameter belongs to
* @ORM\Column(type="string", nullable=false, name="param_group")
*/
protected $group = '';
protected string $group = '';
/**
* Mapping is done in sub classes.

View file

@ -54,49 +54,49 @@ class Category extends AbstractPartsContainingDBElement
* @var string
* @ORM\Column(type="text")
*/
protected $partname_hint = '';
protected string $partname_hint = '';
/**
* @var string
* @ORM\Column(type="text")
*/
protected $partname_regex = '';
protected string $partname_regex = '';
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $disable_footprints = false;
protected bool $disable_footprints = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $disable_manufacturers = false;
protected bool $disable_manufacturers = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $disable_autodatasheets = false;
protected bool $disable_autodatasheets = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $disable_properties = false;
protected bool $disable_properties = false;
/**
* @var string
* @ORM\Column(type="text")
*/
protected $default_description = '';
protected string $default_description = '';
/**
* @var string
* @ORM\Column(type="text")
*/
protected $default_comment = '';
protected string $default_comment = '';
/**
* @var Collection<int, CategoryAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)

View file

@ -91,7 +91,7 @@ class Footprint extends AbstractPartsContainingDBElement
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\FootprintAttachment")
* @ORM\JoinColumn(name="id_footprint_3d", referencedColumnName="id")
*/
protected $footprint_3d;
protected ?FootprintAttachment $footprint_3d = null;
/** @var Collection<int, FootprintParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)

View file

@ -66,14 +66,14 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @ORM\Column(type="string", name="unit", nullable=true)
* @Assert\Length(max=10)
*/
protected $unit;
protected string $unit;
/**
* @var bool Determines if the amount value associated with this unit should be treated as integer.
* Set to false, to measure continuous sizes likes masses or lengths.
* @ORM\Column(type="boolean", name="is_integer")
*/
protected $is_integer = false;
protected bool $is_integer = false;
/**
* @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.).
@ -81,7 +81,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @ORM\Column(type="boolean", name="use_si_prefix")
* @Assert\Expression("this.isUseSIPrefix() == false or this.getUnit() != null", message="validator.measurement_unit.use_si_prefix_needs_unit")
*/
protected $use_si_prefix = false;
protected bool $use_si_prefix = false;
/**
* @ORM\OneToMany(targetEntity="MeasurementUnit", mappedBy="parent", cascade={"persist"})

View file

@ -103,7 +103,7 @@ class Part extends AttachmentContainingDBElement
* @ColumnSecurity(type="datetime")
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
*/
protected $addedDate;
protected ?DateTime $addedDate = null;
/** *************************************************************
* Overridden properties
@ -115,7 +115,7 @@ class Part extends AttachmentContainingDBElement
* @ORM\Column(type="string")
* @ColumnSecurity(prefix="name")
*/
protected $name = '';
protected string $name = '';
/**
* @var Collection<int, PartAttachment>
@ -131,7 +131,7 @@ class Part extends AttachmentContainingDBElement
* @ColumnSecurity(type="datetime")
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
*/
protected $lastModified;
protected ?DateTime $lastModified = null;
/**
* @var Attachment
@ -139,7 +139,7 @@ class Part extends AttachmentContainingDBElement
* @ORM\JoinColumn(name="id_preview_attachement", referencedColumnName="id")
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
*/
protected $master_picture_attachment;
protected ?Attachment $master_picture_attachment = null;
public function __construct()
{

View file

@ -70,20 +70,20 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var string A short description about this lot, shown in table
* @ORM\Column(type="text")
*/
protected $description = '';
protected string $description = '';
/**
* @var string a comment stored with this lot
* @ORM\Column(type="text")
*/
protected $comment = '';
protected string $comment = '';
/**
* @var ?DateTime Set a time until when the lot must be used.
* Set to null, if the lot can be used indefinitely.
* @ORM\Column(type="datetime", name="expiration_date", nullable=true)
*/
protected $expiration_date;
protected ?DateTime $expiration_date = null;
/**
* @var Storelocation|null The storelocation of this lot
@ -91,26 +91,26 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true)
* @Selectable()
*/
protected $storage_location;
protected ?Storelocation $storage_location = null;
/**
* @var bool If this is set to true, the instock amount is marked as not known
* @ORM\Column(type="boolean")
*/
protected $instock_unknown = false;
protected bool $instock_unknown = false;
/**
* @var float For continuous sizes (length, volume, etc.) the instock is saved here.
* @ORM\Column(type="float")
* @Assert\PositiveOrZero()
*/
protected $amount = 0;
protected float $amount = 0.0;
/**
* @var bool determines if this lot was manually marked for refilling
* @ORM\Column(type="boolean")
*/
protected $needs_refill = false;
protected bool $needs_refill = false;
/**
* @var Part The part that is stored in this lot
@ -118,7 +118,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $part;
protected Part $part;
public function __clone()
{

View file

@ -57,14 +57,14 @@ trait AdvancedPropertyTrait
* @ORM\Column(type="boolean")
* @ColumnSecurity(type="boolean")
*/
protected $needs_review = false;
protected bool $needs_review = false;
/**
* @var string a comma separated list of tags, associated with the part
* @ORM\Column(type="text")
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
*/
protected $tags = '';
protected string $tags = '';
/**
* @var float|null how much a single part unit weighs in grams
@ -72,7 +72,7 @@ trait AdvancedPropertyTrait
* @ColumnSecurity(type="float", placeholder=null)
* @Assert\PositiveOrZero()
*/
protected $mass;
protected ?float $mass = null;
/**
* Checks if this part is marked, for that it needs further review.

View file

@ -56,27 +56,27 @@ trait BasicPropertyTrait
* @ORM\Column(type="text")
* @ColumnSecurity(prefix="description")
*/
protected $description = '';
protected string $description = '';
/**
* @var string A comment/note related to this part
* @ORM\Column(type="text")
* @ColumnSecurity(prefix="comment")
*/
protected $comment = '';
protected string $comment = '';
/**
* @var bool Kept for compatibility (it is not used now, and I dont think it was used in old versions)
* @ORM\Column(type="boolean")
*/
protected $visible = true;
protected bool $visible = true;
/**
* @var bool true, if the part is marked as favorite
* @ORM\Column(type="boolean")
* @ColumnSecurity(type="boolean")
*/
protected $favorite = false;
protected bool $favorite = false;
/**
* @var Category The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
@ -87,7 +87,7 @@ trait BasicPropertyTrait
* @Selectable()
* @Assert\NotNull(message="validator.select_valid_category")
*/
protected $category;
protected ?Category $category = null;
/**
* @var Footprint|null The footprint of this part (e.g. DIP8)
@ -96,7 +96,7 @@ trait BasicPropertyTrait
* @ColumnSecurity(prefix="footprint", type="App\Entity\Parts\Footprint")
* @Selectable()
*/
protected $footprint;
protected ?Footprint $footprint = null;
/**
* Get the description string like it is saved in the database.

View file

@ -70,7 +70,7 @@ trait InstockTrait
* @Assert\PositiveOrZero()
* @ColumnSecurity(prefix="minamount", type="integer")
*/
protected $minamount = 0;
protected float $minamount = 0;
/**
* @var ?MeasurementUnit the unit in which the part's amount is measured
@ -78,7 +78,7 @@ trait InstockTrait
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
* @ColumnSecurity(type="object", prefix="unit")
*/
protected $partUnit;
protected ?MeasurementUnit $partUnit = null;
/**
* Get all part lots where this part is stored.

View file

@ -61,7 +61,7 @@ trait ManufacturerTrait
* @ColumnSecurity(prefix="manufacturer", type="App\Entity\Parts\Manufacturer")
* @Selectable()
*/
protected $manufacturer;
protected ?Manufacturer $manufacturer = null;
/**
* @var string the url to the part on the manufacturer's homepage
@ -69,14 +69,14 @@ trait ManufacturerTrait
* @Assert\Url()
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
*/
protected $manufacturer_product_url = '';
protected string $manufacturer_product_url = '';
/**
* @var string The product number used by the manufacturer. If this is set to "", the name field is used.
* @ORM\Column(type="string")
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
*/
protected $manufacturer_product_number = '';
protected string $manufacturer_product_number = '';
/**
* @var string The production status of this part. Can be one of the specified ones.
@ -84,7 +84,7 @@ trait ManufacturerTrait
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
* @ColumnSecurity(type="string", prefix="status", placeholder="")
*/
protected $manufacturing_status = '';
protected string $manufacturing_status = '';
/**
* Get the link to the website of the article on the manufacturers website

View file

@ -69,14 +69,14 @@ trait OrderTrait
* @ORM\Column(type="integer")
* @ColumnSecurity(prefix="order", type="integer")
*/
protected $order_quantity = 0;
protected int $order_quantity = 0;
/**
* @var bool
* @ORM\Column(type="boolean")
* @ColumnSecurity(prefix="order", type="boolean")
*/
protected $manual_order = false;
protected bool $manual_order = false;
/**
* @var Orderdetail
@ -85,7 +85,7 @@ trait OrderTrait
*
* @ColumnSecurity(prefix="order", type="object")
*/
protected $order_orderdetail;
protected Orderdetail $order_orderdetail;
/**
* Get the selected order orderdetails of this part.

View file

@ -83,7 +83,7 @@ class Storelocation extends AbstractPartsContainingDBElement
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
* @ORM\JoinColumn(name="storage_type_id", referencedColumnName="id")
*/
protected $storage_type;
protected ?MeasurementUnit $storage_type = null;
/** @var Collection<int, StorelocationParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
@ -96,19 +96,19 @@ class Storelocation extends AbstractPartsContainingDBElement
* @var bool
* @ORM\Column(type="boolean")
*/
protected $is_full = false;
protected bool $is_full = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $only_single_part = false;
protected bool $only_single_part = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $limit_to_existing_parts = false;
protected bool $limit_to_existing_parts = false;
/**
* @var Collection<int, StorelocationAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)

View file

@ -94,14 +94,14 @@ class Supplier extends AbstractCompany
* @ORM\JoinColumn(name="default_currency_id", referencedColumnName="id", nullable=true)
* @Selectable()
*/
protected $default_currency;
protected ?Currency $default_currency = null;
/**
* @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier
* @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5)
* @BigDecimalPositiveOrZero()
*/
protected $shipping_costs;
protected ?BigDecimal $shipping_costs = null;
/**
* @var Collection<int, SupplierAttachment>

View file

@ -71,14 +71,14 @@ class Currency extends AbstractStructuralDBElement
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
* @BigDecimalPositive()
*/
protected $exchange_rate;
protected ?BigDecimal $exchange_rate = null;
/**
* @var string the 3 letter ISO code of the currency
* @ORM\Column(type="string")
* @Assert\Currency()
*/
protected $iso_code;
protected string $iso_code;
/**
* @ORM\OneToMany(targetEntity="Currency", mappedBy="parent", cascade={"persist"})

View file

@ -86,20 +86,20 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @var string
* @ORM\Column(type="string")
*/
protected $supplierpartnr = '';
protected string $supplierpartnr = '';
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $obsolete = false;
protected bool $obsolete = false;
/**
* @var string
* @ORM\Column(type="string")
* @Assert\Url()
*/
protected $supplier_product_url = '';
protected string $supplier_product_url = '';
/**
* @var Part
@ -107,7 +107,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $part;
protected ?Part $part = null;
/**
* @var Supplier
@ -115,7 +115,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
* @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null")
*/
protected $supplier;
protected ?Supplier $supplier = null;
public function __construct()
{

View file

@ -81,7 +81,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @ORM\Column(type="big_decimal", precision=11, scale=5)
* @BigDecimalPositive()
*/
protected $price;
protected BigDecimal $price;
/**
* @var ?Currency The currency used for the current price information.
@ -90,27 +90,27 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true)
* @Selectable()
*/
protected $currency;
protected ?Currency $currency = null;
/**
* @var float
* @ORM\Column(type="float")
* @Assert\Positive()
*/
protected $price_related_quantity = 1.0;
protected float $price_related_quantity = 1.0;
/**
* @var float
* @ORM\Column(type="float")
* @Assert\Positive()
*/
protected $min_discount_quantity = 1.0;
protected float $min_discount_quantity = 1.0;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $manual_input = true;
protected bool $manual_input = true;
/**
* @var Orderdetail|null
@ -118,7 +118,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
protected $orderdetail;
protected ?Orderdetail $orderdetail = null;
public function __construct()
{

View file

@ -76,7 +76,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
/**
* @ORM\OneToMany(targetEntity="User", mappedBy="group")
*/
protected $users;
protected Collection $users;
/**
* @var bool If true all users associated with this group must have enabled some kind of 2 factor authentication

View file

@ -68,49 +68,47 @@ class U2FKey implements TwoFactorKeyInterface
*
* @var string
**/
public $keyHandle;
public string $keyHandle;
/**
* @ORM\Column(type="string")
*
* @var string
**/
public $publicKey;
public string $publicKey;
/**
* @ORM\Column(type="text")
*
* @var string
**/
public $certificate;
public string $certificate;
/**
* @ORM\Column(type="string")
*
* @var int
**/
public $counter;
public int $counter;
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
protected int $id;
/**
* @ORM\Column(type="string")
*
* @var string
**/
protected $name;
protected string $name;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="u2fKeys")
*
* @var User
**/
protected $user;
protected ?User $user = null;
public function fromRegistrationData(Registration $data): void
{

View file

@ -101,48 +101,48 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @var bool Determines if the user is disabled (user can not log in)
* @ORM\Column(type="boolean")
*/
protected $disabled = false;
protected bool $disabled = false;
/**
* @var string|null The theme
* @ORM\Column(type="string", name="config_theme", nullable=true)
* @Assert\Choice(choices=User::AVAILABLE_THEMES)
*/
protected $theme = '';
protected ?string $theme = '';
/**
* @var string|null the hash of a token the user must provide when he wants to reset his password
* @ORM\Column(type="string", nullable=true)
*/
protected $pw_reset_token;
protected ?string $pw_reset_token = null;
/**
* @ORM\Column(type="text", name="config_instock_comment_a")
*/
protected $instock_comment_a = '';
protected string $instock_comment_a = '';
/**
* @ORM\Column(type="text", name="config_instock_comment_w")
*/
protected $instock_comment_w = '';
protected string $instock_comment_w = '';
/** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once.
* @ORM\Column(type="integer")
*/
protected $trustedDeviceCookieVersion = 0;
protected int $trustedDeviceCookieVersion = 0;
/**
* @var string[]|null A list of backup codes that can be used, if the user has no access to its Google Authenticator device
* @ORM\Column(type="json")
*/
protected $backupCodes = [];
protected ?array $backupCodes = [];
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;
protected ?int $id = null;
/**
* @var Group|null the group this user belongs to
@ -150,58 +150,58 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* @Selectable()
*/
protected $group;
protected ?Group $group = null;
/**
* @var string|null The secret used for google authenticator
* @ORM\Column(name="google_authenticator_secret", type="string", nullable=true)
*/
protected $googleAuthenticatorSecret;
protected ?string $googleAuthenticatorSecret = null;
/**
* @var string|null The timezone the user prefers
* @ORM\Column(type="string", name="config_timezone", nullable=true)
* @Assert\Timezone()
*/
protected $timezone = '';
protected ?string $timezone = '';
/**
* @var string|null The language/locale the user prefers
* @ORM\Column(type="string", name="config_language", nullable=true)
* @Assert\Language()
*/
protected $language = '';
protected ?string $language = '';
/**
* @var string|null The email address of the user
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Email()
*/
protected $email = '';
protected ?string $email = '';
/**
* @var string|null The department the user is working
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $department = '';
protected ?string $department = '';
/**
* @var string|null The last name of the User
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $last_name = '';
protected ?string $last_name = '';
/**
* @var string|null The first name of the User
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $first_name = '';
protected ?string $first_name = '';
/**
* @var bool True if the user needs to change password after log in
* @ORM\Column(type="boolean")
*/
protected $need_pw_change = true;
protected bool $need_pw_change = true;
/**
* //@ORM\Column(type="json").
@ -212,20 +212,20 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @var string|null The hashed password
* @ORM\Column(type="string", nullable=true)
*/
protected $password;
protected ?string $password = null;
/**
* @ORM\Column(type="string", length=180, unique=true)
* @Assert\NotBlank
* @Assert\Regex("/^[\w\.\+\-\$]+$/", message="user.invalid_username")
*/
protected $name = '';
protected string $name = '';
/**
* @var array
* @ORM\Column(type="json")
*/
protected $settings = [];
protected ?array $settings = [];
/**
* @var Collection<int, UserAttachment>
@ -237,7 +237,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** @var DateTime|null The time when the backup codes were generated
* @ORM\Column(type="datetime", nullable=true)
*/
protected $backupCodesGenerationDate;
protected ?DateTime $backupCodesGenerationDate = null;
/** @var Collection<int, TwoFactorKeyInterface>
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)