diff --git a/src/CoreBundle/Entity/Message.php b/src/CoreBundle/Entity/Message.php index 89c8a4cb57..a0ea9dc12f 100644 --- a/src/CoreBundle/Entity/Message.php +++ b/src/CoreBundle/Entity/Message.php @@ -59,19 +59,17 @@ class Message protected $sendDate; /** - * @var string * @Assert\NotBlank * @ORM\Column(name="title", type="string", length=255, nullable=false) */ - protected $title; + protected string $title; /** - * @var string * @Assert\NotBlank * * @ORM\Column(name="content", type="text", nullable=false) */ - protected $content; + protected string $content; /** * @var int @@ -120,16 +118,15 @@ class Message */ public function __construct() { + $this->content = ''; $this->attachments = new ArrayCollection(); $this->likes = new ArrayCollection(); } /** * Set userSender. - * - * @return Message */ - public function setUserSender(User $userSender) + public function setUserSender(User $userSender): self { $this->userSender = $userSender; @@ -138,20 +135,16 @@ class Message /** * Get userSender. - * - * @return User */ - public function getUserSender() + public function getUserSender(): User { return $this->userSender; } /** * Set userReceiver. - * - * @return Message */ - public function setUserReceiver(User $userReceiver) + public function setUserReceiver(User $userReceiver): self { $this->userReceiver = $userReceiver; diff --git a/src/CoreBundle/Entity/PersonalAgenda.php b/src/CoreBundle/Entity/PersonalAgenda.php index 51b7fc86f9..5d4cd1744d 100644 --- a/src/CoreBundle/Entity/PersonalAgenda.php +++ b/src/CoreBundle/Entity/PersonalAgenda.php @@ -6,6 +6,7 @@ namespace Chamilo\CoreBundle\Entity; use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert; /** * PersonalAgenda. @@ -28,19 +29,17 @@ class PersonalAgenda protected $id; /** - * @var User - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="personalAgendas") * @ORM\JoinColumn(name="user", referencedColumnName="id", onDelete="CASCADE") */ - protected $user; + protected User $user; /** - * @var string + * @Assert\NotBlank() * * @ORM\Column(name="title", type="text", nullable=true) */ - protected $title; + protected string $title; /** * @var string diff --git a/src/CoreBundle/Entity/PersonalFile.php b/src/CoreBundle/Entity/PersonalFile.php index 2a801f026a..6a96096bf6 100644 --- a/src/CoreBundle/Entity/PersonalFile.php +++ b/src/CoreBundle/Entity/PersonalFile.php @@ -27,11 +27,9 @@ class PersonalFile extends AbstractResource implements ResourceInterface protected $id; /** - * @var string - * * @ORM\Column(name="name", type="string", length=255, nullable=false) */ - protected $name; + protected string $name; public function __construct() { diff --git a/src/CoreBundle/Entity/ResourceFile.php b/src/CoreBundle/Entity/ResourceFile.php index 56ed78b2dc..06c053ca9a 100644 --- a/src/CoreBundle/Entity/ResourceFile.php +++ b/src/CoreBundle/Entity/ResourceFile.php @@ -77,30 +77,24 @@ class ResourceFile protected $id; /** - * @var string - * * @Assert\NotBlank() * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * * @ORM\Column(type="string", length=255) */ - protected $name; + protected string $name; /** - * @var string - * * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * @ORM\Column(type="text", nullable=true) */ - protected $mimeType; + protected string $mimeType; /** - * @var string - * * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * @ORM\Column(type="text", nullable=true) */ - protected $originalName; + protected string $originalName; /** * @var string @@ -142,11 +136,9 @@ class ResourceFile protected $crop; /** - * @var ResourceNode - * * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="resourceFile") */ - protected $resourceNode; + protected ResourceNode $resourceNode; /** * @var array diff --git a/src/CoreBundle/Entity/ResourceNode.php b/src/CoreBundle/Entity/ResourceNode.php index 7f9dfdf3f2..042f7e04d8 100644 --- a/src/CoreBundle/Entity/ResourceNode.php +++ b/src/CoreBundle/Entity/ResourceNode.php @@ -63,7 +63,7 @@ class ResourceNode * * @ORM\Column(name="title", type="string", length=255, nullable=false) */ - protected $title; + protected string $title; /** * @Assert\NotBlank() @@ -71,15 +71,13 @@ class ResourceNode * @Gedmo\Slug(fields={"title"}) * @ORM\Column(name="slug", type="string", length=255, nullable=false) */ - protected $slug; + protected string $slug; /** - * @var ResourceType - * * @ORM\ManyToOne(targetEntity="ResourceType", inversedBy="resourceNodes") * @ORM\JoinColumn(name="resource_type_id", referencedColumnName="id", nullable=false) */ - protected $resourceType; + protected ResourceType $resourceType; /** * @ApiSubresource() @@ -91,14 +89,14 @@ class ResourceNode protected $resourceLinks; /** - * @var ResourceFile available file for this node + * ResourceFile available file for this node * * @Groups({"resource_node:read", "resource_node:write", "document:read", "document:write"}) * * @ORM\OneToOne(targetEntity="ResourceFile", inversedBy="resourceNode", orphanRemoval=true) * @ORM\JoinColumn(name="resource_file_id", referencedColumnName="id", onDelete="CASCADE") */ - protected $resourceFile; + protected ResourceFile $resourceFile; /** * @var User the creator of this node @@ -107,7 +105,7 @@ class ResourceNode * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="resourceNodes") * @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") */ - protected $creator; + protected User $creator; /** * @ApiSubresource() diff --git a/src/CoreBundle/Entity/ResourceType.php b/src/CoreBundle/Entity/ResourceType.php index 8f976d48de..d05e3aeb79 100644 --- a/src/CoreBundle/Entity/ResourceType.php +++ b/src/CoreBundle/Entity/ResourceType.php @@ -28,22 +28,19 @@ class ResourceType * * @Assert\NotBlank() */ - protected $name; + protected string $name; /** * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tool", inversedBy="resourceTypes") * @ORM\JoinColumn(name="tool_id", referencedColumnName="id") */ - protected $tool; + protected Tool $tool; /** * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="resourceType", cascade={"persist", "remove"}) */ protected $resourceNodes; - /** - * Constructor. - */ public function __construct() { } diff --git a/src/CoreBundle/Entity/ScheduledAnnouncement.php b/src/CoreBundle/Entity/ScheduledAnnouncement.php index e1e080f72d..09ce008562 100644 --- a/src/CoreBundle/Entity/ScheduledAnnouncement.php +++ b/src/CoreBundle/Entity/ScheduledAnnouncement.php @@ -24,18 +24,14 @@ class ScheduledAnnouncement protected $id; /** - * @var string - * * @ORM\Column(name="subject", type="string", length=255, nullable=false, unique=false) */ - protected $subject; + protected string $subject; /** - * @var string - * * @ORM\Column(name="message", type="text", unique=false) */ - protected $message; + protected string $message; /** * @var \DateTime @@ -65,9 +61,6 @@ class ScheduledAnnouncement */ protected $cId; - /** - * Constructor. - */ public function __construct() { } diff --git a/src/CoreBundle/Entity/Session.php b/src/CoreBundle/Entity/Session.php index 6c361aeb07..e5f6e74853 100644 --- a/src/CoreBundle/Entity/Session.php +++ b/src/CoreBundle/Entity/Session.php @@ -161,32 +161,27 @@ class Session protected $showDescription; /** - * @var int - * * @ORM\Column(name="duration", type="integer", nullable=true) */ - protected $duration; + protected int $duration; /** - * @var int * @Groups({"session:read"}) * @ORM\Column(name="nbr_courses", type="smallint", nullable=true, unique=false) */ - protected $nbrCourses; + protected int $nbrCourses; /** - * @var int * @Groups({"session:read"}) * @ORM\Column(name="nbr_users", type="integer", nullable=true, unique=false) */ - protected $nbrUsers; + protected int $nbrUsers; /** - * @var int * @Groups({"session:read"}) * @ORM\Column(name="nbr_classes", type="integer", nullable=true, unique=false) */ - protected $nbrClasses; + protected int $nbrClasses; /** * @var User @@ -314,6 +309,7 @@ class Session $this->description = ''; $this->nbrClasses = 0; $this->nbrUsers = 0; + $this->nbrCourses = 0; $this->sendSubscriptionNotification = false; $this->displayStartDate = new \DateTime(); $this->displayEndDate = new \DateTime(); @@ -333,38 +329,24 @@ class Session $this->studentPublications = new ArrayCollection(); } - /** - * @return string - */ - public function __toString() + public function __toString(): string { return (string) $this->getName(); } - /** - * @return int - */ - public function getDuration() + public function getDuration(): int { return $this->duration; } - /** - * @param int $duration - * - * @return $this - */ - public function setDuration($duration) + public function setDuration(int $duration): self { $this->duration = $duration; return $this; } - /** - * @return string - */ - public function getShowDescription() + public function getShowDescription(): bool { return $this->showDescription; } diff --git a/src/CoreBundle/Entity/Skill.php b/src/CoreBundle/Entity/Skill.php index a441cfbb86..385aee3838 100644 --- a/src/CoreBundle/Entity/Skill.php +++ b/src/CoreBundle/Entity/Skill.php @@ -57,30 +57,27 @@ class Skill protected $id; /** - * @var string * @Groups({"skill:read", "skill:write"}) * @Assert\NotBlank() * * @ORM\Column(name="name", type="string", length=255, nullable=false) */ - protected $name; + protected string $name; /** - * @var string * @Assert\NotBlank() * @Groups({"skill:read", "skill:write"}) * * @ORM\Column(name="short_code", type="string", length=100, nullable=false) */ - protected $shortCode; + protected string $shortCode; /** - * @var string * @Groups({"skill:read", "skill:write"}) * * @ORM\Column(name="description", type="text", nullable=false) */ - protected $description; + protected string $description; /** * @var int @@ -119,11 +116,9 @@ class Skill */ protected $updatedAt; - /** - * Constructor. - */ public function __construct() { + $this->description = ''; $this->status = self::STATUS_ENABLED; } diff --git a/src/CourseBundle/Entity/CAttendance.php b/src/CourseBundle/Entity/CAttendance.php index f5721d7f23..43e44ede0e 100644 --- a/src/CourseBundle/Entity/CAttendance.php +++ b/src/CourseBundle/Entity/CAttendance.php @@ -32,18 +32,15 @@ class CAttendance extends AbstractResource implements ResourceInterface protected $iid; /** - * @var string * @Assert\NotBlank * @ORM\Column(name="name", type="text", nullable=false) */ - protected $name; + protected string $name; /** - * @var string - * * @ORM\Column(name="description", type="text", nullable=true) */ - protected $description; + protected string $description; /** * @var int @@ -82,6 +79,7 @@ class CAttendance extends AbstractResource implements ResourceInterface public function __construct() { + $this->description = ''; $this->active = 1; $this->attendanceQualifyMax = 0; $this->locked = 0; @@ -94,12 +92,8 @@ class CAttendance extends AbstractResource implements ResourceInterface /** * Set name. - * - * @param string $name - * - * @return CAttendance */ - public function setName($name) + public function setName(string $name): self { $this->name = $name; @@ -120,10 +114,8 @@ class CAttendance extends AbstractResource implements ResourceInterface * Set description. * * @param string $description - * - * @return CAttendance */ - public function setDescription($description) + public function setDescription($description): self { $this->description = $description; diff --git a/src/CourseBundle/Entity/CCourseDescription.php b/src/CourseBundle/Entity/CCourseDescription.php index 4601bbdced..c5137cf706 100644 --- a/src/CourseBundle/Entity/CCourseDescription.php +++ b/src/CourseBundle/Entity/CCourseDescription.php @@ -36,13 +36,11 @@ class CCourseDescription extends AbstractResource implements ResourceInterface protected $iid; /** - * @var string - * * @Assert\NotBlank * * @ORM\Column(name="title", type="text", nullable=true) */ - protected $title; + protected string $title; /** * @var string @@ -65,11 +63,9 @@ class CCourseDescription extends AbstractResource implements ResourceInterface */ protected $progress; - /** - * CCourseDescription constructor. - */ public function __construct() { + $this->content = ''; $this->progress = 0; $this->descriptionType = 1; } diff --git a/src/CourseBundle/Entity/CCourseSetting.php b/src/CourseBundle/Entity/CCourseSetting.php index 763e308f6b..bc39648500 100644 --- a/src/CourseBundle/Entity/CCourseSetting.php +++ b/src/CourseBundle/Entity/CCourseSetting.php @@ -37,13 +37,11 @@ class CCourseSetting protected $cId; /** - * @var string - * * @Assert\NotBlank() * * @ORM\Column(name="variable", type="string", length=255, nullable=false) */ - protected $variable; + protected string $variable; /** * @var string diff --git a/src/CourseBundle/Entity/CDocument.php b/src/CourseBundle/Entity/CDocument.php index 5281374369..7ebaa25fac 100644 --- a/src/CourseBundle/Entity/CDocument.php +++ b/src/CourseBundle/Entity/CDocument.php @@ -136,27 +136,25 @@ class CDocument extends AbstractResource implements ResourceInterface protected $iid; /** - * @var string * @Assert\NotBlank * @Groups({"document:read", "document:write"}) * @ORM\Column(name="title", type="string", length=255, nullable=true) */ - protected $title; + protected string $title; /** * @var string * @Groups({"document:read", "document:write"}) * @ORM\Column(name="comment", type="text", nullable=true) */ - protected $comment; + protected string $comment; /** - * @var string File type, it can be 'folder' or 'file' * @Groups({"document:read", "document:write"}) * @Assert\Choice({"folder", "file"}, message="Choose a valid filetype.") * @ORM\Column(name="filetype", type="string", length=10, nullable=false) */ - protected $filetype; + protected string $filetype; /** * @var bool @@ -175,6 +173,7 @@ class CDocument extends AbstractResource implements ResourceInterface */ public function __construct() { + $this->comment = ''; $this->filetype = 'folder'; $this->readonly = false; $this->template = false; diff --git a/src/CourseBundle/Entity/CForumCategory.php b/src/CourseBundle/Entity/CForumCategory.php index 9f78ce96ae..9013baec1b 100644 --- a/src/CourseBundle/Entity/CForumCategory.php +++ b/src/CourseBundle/Entity/CForumCategory.php @@ -41,20 +41,18 @@ class CForumCategory extends AbstractResource implements ResourceInterface protected $cId; /** - * @var string - * * @Assert\NotBlank() * * @ORM\Column(name="cat_title", type="string", length=255, nullable=false) */ - protected $catTitle; + protected string $catTitle; /** * @var string * * @ORM\Column(name="cat_comment", type="text", nullable=true) */ - protected $catComment; + protected string $catComment; /** * @var int @@ -93,6 +91,7 @@ class CForumCategory extends AbstractResource implements ResourceInterface public function __construct() { + $this->catComment = ''; $this->locked = 0; $this->catId = 0; $this->forums = new ArrayCollection(); diff --git a/src/CourseBundle/Entity/CForumThread.php b/src/CourseBundle/Entity/CForumThread.php index 6b4f264a33..a815acaa93 100644 --- a/src/CourseBundle/Entity/CForumThread.php +++ b/src/CourseBundle/Entity/CForumThread.php @@ -42,13 +42,11 @@ class CForumThread extends AbstractResource implements ResourceInterface protected $cId; /** - * @var string - * * @Assert\NotBlank() * * @ORM\Column(name="thread_title", type="string", length=255, nullable=true) */ - protected $threadTitle; + protected string $threadTitle; /** * @var CForumForum|null @@ -71,7 +69,7 @@ class CForumThread extends AbstractResource implements ResourceInterface * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") * @ORM\JoinColumn(name="thread_poster_id", referencedColumnName="id") */ - protected $user; + protected User $user; /** * @var int