Fix double casting, add property types

pull/3768/head
Julio Montoya 5 years ago
parent 25f4ca75aa
commit f18e52bee9
  1. 4
      public/main/admin/filler.php
  2. 2
      public/main/admin/statistics/index.php
  3. 1
      public/main/exercise/exercise.class.php
  4. 2
      public/main/forum/forumfunction.inc.php
  5. 1
      public/main/gradebook/gradebook_flatview.php
  6. 22
      src/CoreBundle/Entity/Message.php
  7. 7
      src/CoreBundle/Entity/PortfolioCategory.php
  8. 12
      src/CoreBundle/Entity/SessionCategory.php

@ -29,11 +29,11 @@ $output = [];
if (!empty($_GET['fill'])) { if (!empty($_GET['fill'])) {
switch ($_GET['fill']) { switch ($_GET['fill']) {
case 'users': case 'users':
require api_get_path(SYS_TEST_PATH).'datafiller/fill_users.php'; require __DIR__.'/../../../tests/datafiller/fill_users.php';
$output = fill_users(); $output = fill_users();
break; break;
case 'courses': case 'courses':
require api_get_path(SYS_TEST_PATH).'datafiller/fill_courses.php'; require __DIR__.'/../../../tests/datafiller/fill_courses.php';
$output = fill_courses(); $output = fill_courses();
break; break;
default: default:

@ -1132,7 +1132,7 @@ switch ($report) {
if ($validDate) { if ($validDate) {
$date1 = new DateTime($row['value']); $date1 = new DateTime($row['value']);
$interval = $now->diff($date1); $interval = $now->diff($date1);
$years = (int) $interval->y; $years = $interval->y;
if ($years >= 16 && $years <= 17) { if ($years >= 16 && $years <= 17) {
$all['16-17']++; $all['16-17']++;

@ -6020,6 +6020,7 @@ class Exercise
); );
} elseif (ORAL_EXPRESSION == $answerType) { } elseif (ORAL_EXPRESSION == $answerType) {
$answer = $choice; $answer = $choice;
/** @var OralExpression $objQuestionTmp */
Event::saveQuestionAttempt( Event::saveQuestionAttempt(
$questionScore, $questionScore,
$answer, $answer,

@ -6394,7 +6394,7 @@ function giveRevisionButton($postId, $threadInfo)
[ [
'forum' => $threadInfo['forum_id'], 'forum' => $threadInfo['forum_id'],
'thread' => $threadInfo['thread_id'], 'thread' => $threadInfo['thread_id'],
'post' => $postId = (int) $postId, 'post' => $postId,
'action' => 'replymessage', 'action' => 'replymessage',
'give_revision' => 1, 'give_revision' => 1,
] ]

@ -51,6 +51,7 @@ if ($showlink) {
$alllinks = $cat[0]->get_links($userId, true); $alllinks = $cat[0]->get_links($userId, true);
} }
global $file_type;
if (isset($export_flatview_form) && 'pdf' === !$file_type) { if (isset($export_flatview_form) && 'pdf' === !$file_type) {
Display::addFlash( Display::addFlash(
Display::return_message( Display::return_message(

@ -35,27 +35,21 @@ class Message
protected $id; protected $id;
/** /**
* @var User
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sentMessages") * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sentMessages")
* @ORM\JoinColumn(name="user_sender_id", referencedColumnName="id", nullable=false) * @ORM\JoinColumn(name="user_sender_id", referencedColumnName="id", nullable=false)
*/ */
protected $userSender; protected User $userSender;
/** /**
* @var User
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="receivedMessages") * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="receivedMessages")
* @ORM\JoinColumn(name="user_receiver_id", referencedColumnName="id", nullable=true) * @ORM\JoinColumn(name="user_receiver_id", referencedColumnName="id", nullable=true)
*/ */
protected $userReceiver; protected User $userReceiver;
/** /**
* @var bool
*
* @ORM\Column(name="msg_status", type="smallint", nullable=false) * @ORM\Column(name="msg_status", type="smallint", nullable=false)
*/ */
protected $msgStatus; protected int $msgStatus;
/** /**
* @var \DateTime * @var \DateTime
@ -176,12 +170,8 @@ class Message
/** /**
* Set msgStatus. * Set msgStatus.
*
* @param bool $msgStatus
*
* @return Message
*/ */
public function setMsgStatus($msgStatus) public function setMsgStatus(int $msgStatus): self
{ {
$this->msgStatus = $msgStatus; $this->msgStatus = $msgStatus;
@ -190,10 +180,8 @@ class Message
/** /**
* Get msgStatus. * Get msgStatus.
*
* @return bool
*/ */
public function getMsgStatus() public function getMsgStatus(): int
{ {
return $this->msgStatus; return $this->msgStatus;
} }

@ -210,12 +210,7 @@ class PortfolioCategory
return $this->items->matching($criteria); return $this->items->matching($criteria);
} }
/** public function setItems(ArrayCollection $items): self
* Set items.
*
* @return PortfolioCategory
*/
public function setItems(Collection $items)
{ {
$this->items = $items; $this->items = $items;

@ -36,20 +36,19 @@ class SessionCategory
* @ORM\ManyToOne(targetEntity="AccessUrl", inversedBy="sessionCategories", cascade={"persist"}) * @ORM\ManyToOne(targetEntity="AccessUrl", inversedBy="sessionCategories", cascade={"persist"})
* @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id")
*/ */
protected $url; protected AccessUrl $url;
/** /**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="category") * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="category")
*/ */
protected $session; protected Session $session;
/** /**
* @var string
* @Assert\NotBlank * @Assert\NotBlank
* @Groups({"session_category:read", "session_category:write"}) * @Groups({"session_category:read", "session_category:write"})
* @ORM\Column(name="name", type="string", length=100, nullable=true, unique=false) * @ORM\Column(name="name", type="string", length=100, nullable=true, unique=false)
*/ */
protected $name; protected string $name;
/** /**
* @var \DateTime * @var \DateTime
@ -65,10 +64,7 @@ class SessionCategory
*/ */
protected $dateEnd; protected $dateEnd;
/** public function __toString(): string
* @return string
*/
public function __toString()
{ {
return (string) $this->name; return (string) $this->name;
} }

Loading…
Cancel
Save