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

@ -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.