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

@ -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)
{