From a3a7d7ed24f2c07542d708d09ae6a6305732e01f Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 17 Jan 2024 19:02:24 -0500 Subject: [PATCH] Minor: Format code --- src/CoreBundle/Controller/ResourceController.php | 1 - src/CoreBundle/Entity/Session.php | 6 +++--- src/CoreBundle/Entity/SessionRelCourseRelUser.php | 2 +- src/CoreBundle/Entity/TrackEDownloads.php | 3 --- src/CoreBundle/Repository/TrackEDownloadsRepository.php | 2 +- src/CourseBundle/Entity/CQuiz.php | 2 +- .../Repository/CCalendarEventRepositoryTest.php | 4 ++-- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/CoreBundle/Controller/ResourceController.php b/src/CoreBundle/Controller/ResourceController.php index 027202f9fa..e81f4002cf 100644 --- a/src/CoreBundle/Controller/ResourceController.php +++ b/src/CoreBundle/Controller/ResourceController.php @@ -192,7 +192,6 @@ class ResourceController extends AbstractResourceController implements CourseCon // If resource node has a file just download it. Don't download the children. if ($resourceNode->hasResourceFile()) { - /** @var ?User $user */ $user = $this->getUser(); $resourceLinkId = $resourceNode->getResourceLinks()->first()->getId(); diff --git a/src/CoreBundle/Entity/Session.php b/src/CoreBundle/Entity/Session.php index b3b097bc18..a88d23698e 100644 --- a/src/CoreBundle/Entity/Session.php +++ b/src/CoreBundle/Entity/Session.php @@ -767,7 +767,7 @@ class Session implements ResourceWithAccessUrlInterface, Stringable */ public function isActive(): bool { - $now = new Datetime('now'); + $now = new DateTime('now'); return $now > $this->getAccessStartDate(); } @@ -844,7 +844,7 @@ class Session implements ResourceWithAccessUrlInterface, Stringable */ public function isCurrentlyAccessible(): bool { - $now = new Datetime(); + $now = new DateTime(); return (null === $this->accessStartDate || $this->accessStartDate < $now) && (null === $this->accessEndDate || $now < $this->accessEndDate); @@ -1163,7 +1163,7 @@ class Session implements ResourceWithAccessUrlInterface, Stringable protected function compareDates(?DateTime $start, DateTime $end = null): bool { - $now = new Datetime('now'); + $now = new DateTime('now'); if (!empty($start) && !empty($end) && ($now >= $start && $now <= $end)) { return true; diff --git a/src/CoreBundle/Entity/SessionRelCourseRelUser.php b/src/CoreBundle/Entity/SessionRelCourseRelUser.php index baed917003..ad3eb25f1a 100644 --- a/src/CoreBundle/Entity/SessionRelCourseRelUser.php +++ b/src/CoreBundle/Entity/SessionRelCourseRelUser.php @@ -77,7 +77,7 @@ class SessionRelCourseRelUser ])] #[ORM\ManyToOne(targetEntity: UserAlias::class, cascade: ['persist'], inversedBy: 'sessionRelCourseRelUsers')] #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] - protected User $user; + protected UserAlias $user; #[Groups([ 'session_rel_course_rel_user:read', diff --git a/src/CoreBundle/Entity/TrackEDownloads.php b/src/CoreBundle/Entity/TrackEDownloads.php index 0dc9f98899..1b217d1cd2 100644 --- a/src/CoreBundle/Entity/TrackEDownloads.php +++ b/src/CoreBundle/Entity/TrackEDownloads.php @@ -114,9 +114,6 @@ class TrackEDownloads /** * Set resourceLink. - * - * @param ResourceLink|null $resourceLink - * @return TrackEDownloads */ public function setResourceLink(?ResourceLink $resourceLink): self { diff --git a/src/CoreBundle/Repository/TrackEDownloadsRepository.php b/src/CoreBundle/Repository/TrackEDownloadsRepository.php index 760b85a8b8..2e45357147 100644 --- a/src/CoreBundle/Repository/TrackEDownloadsRepository.php +++ b/src/CoreBundle/Repository/TrackEDownloadsRepository.php @@ -26,7 +26,7 @@ class TrackEDownloadsRepository extends ServiceEntityRepository $download->setDownUserId($userId); $download->setDownDate(new DateTime()); - $resourceLink = $this->_em->getRepository(ResourceLink::class)->find($resourceLinkId); + $resourceLink = $this->_em->getRepository(ResourceLink::class)->find($resourceLinkId); if ($resourceLink) { $download->setResourceLink($resourceLink); } diff --git a/src/CourseBundle/Entity/CQuiz.php b/src/CourseBundle/Entity/CQuiz.php index a40d9f0c35..d5bb04d530 100644 --- a/src/CourseBundle/Entity/CQuiz.php +++ b/src/CourseBundle/Entity/CQuiz.php @@ -82,7 +82,7 @@ class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowC #[ORM\Column(name: 'propagate_neg', type: 'integer', nullable: false)] protected int $propagateNeg; - #[ORm\Column(name: 'save_correct_answers', type: 'integer', nullable: true)] + #[ORM\Column(name: 'save_correct_answers', type: 'integer', nullable: true)] protected ?int $saveCorrectAnswers; #[ORM\Column(name: 'review_answers', type: 'integer', nullable: false)] diff --git a/tests/CourseBundle/Repository/CCalendarEventRepositoryTest.php b/tests/CourseBundle/Repository/CCalendarEventRepositoryTest.php index 618b8a8bf2..7db9e2e1cd 100644 --- a/tests/CourseBundle/Repository/CCalendarEventRepositoryTest.php +++ b/tests/CourseBundle/Repository/CCalendarEventRepositoryTest.php @@ -410,7 +410,7 @@ class CCalendarEventRepositoryTest extends AbstractApiTest $event = $calendarRepo->createFromAnnouncement( $announcement, new Datetime('now'), - new DateTime('now +30 days'), + new Datetime('now +30 days'), ['everyone'], $course, ); @@ -430,7 +430,7 @@ class CCalendarEventRepositoryTest extends AbstractApiTest $event = $calendarRepo->createFromAnnouncement( $announcement2, new Datetime('now'), - new DateTime('now +30 days'), + new Datetime('now +30 days'), ['USER:'.$student->getId(), 'GROUP:'.$group->getIid()], $course, );