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