From 796f4d58df3f2233e7e4aa1a1bcaa0f61d396cd7 Mon Sep 17 00:00:00 2001 From: Daniel Molares Date: Wed, 8 Jan 2025 12:47:53 -0500 Subject: [PATCH] Fixed many deprecations seen from symfony/php upgrade --- src/Entity/ContentItem.php | 59 +++++++--------------- src/Entity/Course.php | 72 +++++++++----------------- src/Entity/FileItem.php | 73 ++++++++------------------- src/Entity/Institution.php | 59 +++++++--------------- src/Entity/Issue.php | 57 +++++++-------------- src/Entity/LogEntry.php | 35 ++++--------- src/Entity/Report.php | 57 +++++++-------------- src/Entity/User.php | 61 ++++++++-------------- src/Entity/UserSession.php | 33 ++++++------ src/Lms/Canvas/CanvasApi.php | 2 +- src/Lms/Canvas/CanvasLms.php | 6 +-- src/Lms/D2l/D2lLms.php | 2 +- src/Security/SessionAuthenticator.php | 2 +- src/Services/UtilityService.php | 8 +-- 14 files changed, 172 insertions(+), 354 deletions(-) diff --git a/src/Entity/ContentItem.php b/src/Entity/ContentItem.php index 24e589ec1..0cf03774c 100644 --- a/src/Entity/ContentItem.php +++ b/src/Entity/ContentItem.php @@ -8,73 +8,48 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass="App\Repository\ContentItemRepository") - */ +#[ORM\Entity(repositoryClass: "App\Repository\ContentItemRepository")] class ContentItem implements \JsonSerializable { // Private Members - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type="integer")] private $id; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $title; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\Course", inversedBy="contentItems") - * @ORM\JoinColumn(nullable=false) - */ + #[ORM\ManyToOne(targetEntity: "App\Entity\Course", inversedBy: "contentItems")] + #[ORM\JoinColumn(nullable=false)] private $course; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $contentType; - /** - * @ORM\Column(type="string", length=512) - */ + #[ORM\Column(type: "string", length: 512)] private $lmsContentId; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] private $updated; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $metadata; - /** - * @ORM\OneToMany(targetEntity="App\Entity\Issue", mappedBy="contentItem") - */ + #[ORM\OneToMany(targetEntity: "App\Entity\Issue", mappedBy: "contentItem")] private $issues; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: "boolean")] private $published; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: "boolean")] private $active; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $body; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $url; diff --git a/src/Entity/Course.php b/src/Entity/Course.php index 86d14c22d..fc3da317d 100644 --- a/src/Entity/Course.php +++ b/src/Entity/Course.php @@ -6,76 +6,52 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass="App\Repository\CourseRepository") - */ +#[ORM\Entity(repositoryClass: "App\Repository\CourseRepository")] class Course implements \JsonSerializable { // Private Members - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type="integer")] private $id; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $title; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\Institution", inversedBy="courses") - * @ORM\JoinColumn(nullable=false) - */ + #[ORM\ManyToOne(targetEntity: "App\Entity\Institution", inversedBy: "courses")] + #[ORM\JoinColumn(nullable: false)] private $institution; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + + #[ORM\Column(type: "string", length: 255, nullable: true)] private $lmsAccountId; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $lmsCourseId; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + + #[ORM\Column(type: "datetime", nullable: true)] private $lastUpdated; - /** - * @ORM\Column(type="boolean", nullable=true) - */ + #[ORM\Column(type: "boolean", nullable: true)] private $active; - /** - * @ORM\Column(type="boolean", nullable=true) - */ + #[ORM\Column(type: "boolean", nullable: true)] private $dirty; - /** - * @ORM\OneToMany(targetEntity="App\Entity\ContentItem", mappedBy="course", orphanRemoval=true) - */ + #[ORM\OneToMany(targetEntity: "App\Entity\ContentItem", mappedBy: "course", orphanRemoval: true)] + private $contentItems; - /** - * @ORM\OneToMany(targetEntity="App\Entity\Report", mappedBy="course", orphanRemoval=true) - */ + #[ORM\OneToMany(targetEntity: "App\Entity\Report", mappedBy: "course", orphanRemoval: true)] private $reports; - /** - * @ORM\OneToMany(targetEntity=FileItem::class, mappedBy="course") - */ + #[ORM\OneToMany(targetEntity: FileItem::class, mappedBy: "course")] private $fileItems; - /** - * @ORM\Column(type="integer", nullable=true) - */ + #[ORM\Column(type: "integer", nullable: true)] private $lmsTermId; - // Constructor public function __construct() { @@ -260,7 +236,7 @@ public function removeReport(Report $report): self } public function removeAllReports(): self - { + { $this->reports->clear(); return $this; } @@ -269,10 +245,10 @@ public function getPreviousReport(): ?Report { $reports = $this->reports->toArray(); $count = count($reports); - + return ($count > 1) ? $reports[$count-2] : null; } - + public function getLatestReport(): ?Report { return $this->reports->last() ?: null; @@ -314,7 +290,7 @@ public function getUpdatedReport() $report->setContentFixed($fixed); $report->setContentResolved($resolved); $report->setFilesReviewed($filesReviewed); - + return $report; } @@ -386,7 +362,7 @@ public function getAllIssues() return $allIssues; } - protected function sortContentItems(ContentItem $a, ContentItem $b) + protected function sortContentItems(ContentItem $a, ContentItem $b) { return (strtolower($a->getTitle()) > strtolower($b->getTitle())) ? 1 : -1; } diff --git a/src/Entity/FileItem.php b/src/Entity/FileItem.php index bb9c7904d..eea58fa2e 100644 --- a/src/Entity/FileItem.php +++ b/src/Entity/FileItem.php @@ -6,91 +6,58 @@ use App\Services\UtilityService; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass=FileItemRepository::class) - */ + +#[ORM\Entity(repositoryClass: FileItemRepository::class)] class FileItem implements \JsonSerializable { - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] private $id; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $fileName; - /** - * @ORM\ManyToOne(targetEntity=Course::class, inversedBy="fileItems") - */ + #[ORM\ManyToOne(targetEntity: Course::class, inversedBy: "fileItems")] private $course; - /** - * @ORM\Column(type="string", length=32) - */ + #[ORM\Column(type: "string", length: 32)] private $fileType; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $lmsFileId; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: "datetime", nullable: true)] private $updated; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $metadata; - /** - * @ORM\Column(type="boolean", nullable=true) - */ + #[ORM\Column(type: "boolean", nullable: true)] private $status; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $fileSize; - /** - * @ORM\Column(type="boolean", nullable=true) - */ + #[ORM\Column(type: "boolean", nullable: true)] private $hidden; - /** - * @ORM\Column(type="boolean", nullable=true) - */ + #[ORM\Column(type: "boolean", nullable: true)] private $reviewed; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $lmsUrl; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $downloadUrl; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private $reviewedBy; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: "datetime", nullable: true)] private $reviewedOn; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: "boolean")] private $active; public function getId(): ?int diff --git a/src/Entity/Institution.php b/src/Entity/Institution.php index 85e50f45b..b1aef6455 100644 --- a/src/Entity/Institution.php +++ b/src/Entity/Institution.php @@ -13,73 +13,48 @@ class Institution implements JsonSerializable { // Private Members - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] private $id; - /** - * @ORM\Column(type="string", length=255) - */ + + #[ORM\Column(type: "string", length: 255)] private $title; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $lmsDomain; - /** - * @ORM\Column(type="string", length=64, nullable=true) - */ + #[ORM\Column(type: "string", length: 64, nullable: true)] private $lmsId; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $lmsAccountId; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] private $created; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: "boolean")] private $status; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $vanityUrl; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $metadata; - /** - * @ORM\OneToMany(targetEntity="App\Entity\Course", mappedBy="institution") - */ + #[ORM\OneToMany(targetEntity: "App\Entity\Course", mappedBy: "institution")] private $courses; - /** - * @ORM\OneToMany(targetEntity="App\Entity\User", mappedBy="institution") - */ + #[ORM\OneToMany(targetEntity: "App\Entity\User", mappedBy: "institution")] private $users; private $encodedKey = 'niLb/WbAODNi7E4ccHHa/pPU3Bd9h6z1NXmjA981D4o='; - /** - * @ORM\Column(type="string", nullable=true) - */ + #[ORM\Column(type: "string", nullable: true)] private $apiClientId; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $apiClientSecret; @@ -116,7 +91,7 @@ private function decryptData($encrypted): bool | string $decoded = base64_decode($encrypted); $nonce = mb_substr($decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); $encrypted_text = mb_substr($decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, NULL, '8bit'); - + return sodium_crypto_secretbox_open($encrypted_text, $nonce, $key); } diff --git a/src/Entity/Issue.php b/src/Entity/Issue.php index b8f5af2d9..c5a4dc49c 100644 --- a/src/Entity/Issue.php +++ b/src/Entity/Issue.php @@ -5,9 +5,8 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass="App\Repository\IssueRepository") - */ + +#[ORM\Entity(repositoryClass: "App\Repository\IssueRepository")] class Issue implements \JsonSerializable { static $issueError = 'error'; @@ -17,62 +16,42 @@ class Issue implements \JsonSerializable static $issueStatusResolved = 2; // Private Members - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] private $id; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\ContentItem", inversedBy="issues") - * @ORM\JoinColumn(nullable=false) - */ + #[ORM\ManyToOne(targetEntity: "App\Entity\ContentItem", inversedBy: "issues")] + #[ORM\JoinColumn(nullable: false)] private $contentItem; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $scanRuleId; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $html; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $type; - /** - * @ORM\Column(type="smallint") - */ + #[ORM\Column(type: "smallint")] private $status; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + + #[ORM\ManyToOne(targetEntity: User::class)] private $fixedBy; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: "datetime", nullable: true)] private $fixedOn; - /** - * @ORM\Column(type="text", nullable=true) - */ + + #[ORM\Column(type: "text", nullable: true)] private $previewHtml; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $newHtml; - /** - * @ORM\Column(type="json", nullable=true) - */ + #[ORM\Column(type: "json", nullable: true)] private $metadata; // Constructor diff --git a/src/Entity/LogEntry.php b/src/Entity/LogEntry.php index 4fcb781d5..fdd80ee2f 100644 --- a/src/Entity/LogEntry.php +++ b/src/Entity/LogEntry.php @@ -9,41 +9,28 @@ */ class LogEntry implements \JsonSerializable { - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] + private $id; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\User") - */ + #[ORM\ManyToOne(targetEntity: "App\Entity\User")] private $user; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\Course") - */ + #[ORM\ManyToOne(targetEntity: "App\Entity\Course")] private $course; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $message; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: "string", length: 255)] private $severity; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] private $created; - /** - * @ORM\Column(type="boolean", nullable=true) - */ + #[ORM\Column(type: "boolean", nullable: true)] private $status; public function getId(): ?int @@ -104,7 +91,7 @@ public function getCreated(): ?\DateTimeInterface return $this->created; } - public function setCreated(\DateTimeInterface $created = null): self + public function setCreated(?\DateTimeInterface $created = null): self { if (!$created) { $created = new \DateTime(); diff --git a/src/Entity/Report.php b/src/Entity/Report.php index de045e6f4..4301ecfff 100644 --- a/src/Entity/Report.php +++ b/src/Entity/Report.php @@ -11,63 +11,44 @@ class Report implements \JsonSerializable { // Private Members - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] private $id; - - /** - * @ORM\ManyToOne(targetEntity="App\Entity\Course", inversedBy="reports") - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: "App\Entity\Course", inversedBy: "reports")] + #[ORM\JoinColumn(nullable: false)] private $course; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: "text", nullable: true)] private $data; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] private $created; - /** - * @ORM\Column(type="integer", nullable=true) - */ + #[ORM\Column(type: "integer", nullable: true)] private $errors; - /** - * @ORM\Column(type="integer", nullable=true) - */ + #[ORM\Column(type: "integer", nullable: true)] private $suggestions; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: "boolean")] private $ready; - /** - * @ORM\ManyToOne(targetEntity=User::class, inversedBy="reports") - * @ORM\JoinColumn(nullable=false) - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: "reports")] + #[ORM\JoinColumn(nullable: false)] private $author; - /** - * @ORM\Column(type="integer", nullable=true) - */ + #[ORM\Column(type: "integer", nullable: true)] + private $contentFixed; - /** - * @ORM\Column(type="integer", nullable=true) - */ + #[ORM\Column(type: "integer", nullable: true)] private $contentResolved; - /** - * @ORM\Column(type="integer", nullable=true) - */ + + #[ORM\Column(type: "integer", nullable: true)] + private $filesReviewed; // Constructor diff --git a/src/Entity/User.php b/src/Entity/User.php index eb32d01dc..c304a28cd 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -8,71 +8,52 @@ use JsonSerializable; use Symfony\Component\Security\Core\User\UserInterface; -/** - * @ORM\Entity(repositoryClass="App\Repository\UserRepository") - * @ORM\Table(name="users") - */ +#[ORM\Entity(repositoryClass: "App\Repository\UserRepository")] +#[ORM\Table(name: "users")] class User implements UserInterface, JsonSerializable { - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] + private $id; /** * $username = || - * @ORM\Column(type="string", length=180, unique=true) - */ + */ + #[ORM\Column(type: "string", length: 180, unique: true)] private string $username; - /** - * @ORM\Column(type="string", length=255, nullable=true) - */ + #[ORM\Column(type: "string", length: 255, nullable: true)] private $name; - /** - * @ORM\Column(type="json", nullable=true) - */ + #[ORM\Column(type: "json", nullable: true)] private $roles = []; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\Institution", inversedBy="users") - * @ORM\JoinColumn(nullable=false) - */ + #[ORM\ManyToOne(targetEntity: "App\Entity\Institution", inversedBy: "users")] + #[ORM\JoinColumn(nullable: false)] private $institution; - /** - * @ORM\Column(type="string", length=128) - */ + #[ORM\Column(type: "string", length: 128)] private $lmsUserId; - /** - * @ORM\Column(type="string", length=2048, nullable=true) - */ + #[ORM\Column(type: "string", length: 2048, nullable: true)] private $apiKey; - /** - * @ORM\Column(type="string", length=512, nullable=true) - */ + #[ORM\Column(type: "string", length: 512, nullable: true)] private $refreshToken; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] private $created; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] private $lastLogin; private $encodedKey = 'niLb/WbAODNi7E4ccHHa/pPU3Bd9h6z1NXmjA981D4o='; - /** - * @ORM\OneToMany(targetEntity=Report::class, mappedBy="author") - */ + + #[ORM\OneToMany(targetEntity: Report::class, mappedBy: "author")] + private $reports; @@ -147,7 +128,7 @@ public function getSalt() /** * @see UserInterface */ - public function eraseCredentials() + public function eraseCredentials(): void { // If you store any temporary, sensitive data on the user, clear it here // $this->plainPassword = null; diff --git a/src/Entity/UserSession.php b/src/Entity/UserSession.php index 6fe9f0652..8227ccc84 100644 --- a/src/Entity/UserSession.php +++ b/src/Entity/UserSession.php @@ -6,31 +6,28 @@ use JsonSerializable; use Symfony\Component\Uid\Uuid; -/** - * @ORM\Entity(repositoryClass=UserSessionRepository::class) - */ + +#[ORM\Entity(repositoryClass: UserSessionRepository::class)] class UserSession implements JsonSerializable { - /** - * @ORM\Id - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: "integer")] + private $id; - /** - * @ORM\Column(type="string", length=255) - */ + + #[ORM\Column(type: "string", length: 255)] + private $uuid; - /** - * @ORM\Column(type="json", nullable=true) - */ + #[ORM\Column(type: "json", nullable: true)] + private $data = []; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: "datetime")] + private $created; public function getId(): ?Uuid @@ -74,7 +71,7 @@ public function set($key, $val): self return $this; } - public function has($key) + public function has($key) { return isset($this->data[$key]); } diff --git a/src/Lms/Canvas/CanvasApi.php b/src/Lms/Canvas/CanvasApi.php index 7415b049e..c644a3ba0 100644 --- a/src/Lms/Canvas/CanvasApi.php +++ b/src/Lms/Canvas/CanvasApi.php @@ -22,7 +22,7 @@ public function __construct($baseUrl, $apiToken) } // API call GET - public function apiGet(string $url, array $options = [], int $perPage = 100, LmsResponse $lmsResponse = null): LmsResponse + public function apiGet(string $url, array $options = [], int $perPage = 100, ?LmsResponse $lmsResponse = null): LmsResponse { $links = []; diff --git a/src/Lms/Canvas/CanvasLms.php b/src/Lms/Canvas/CanvasLms.php index 341d41df6..8e946d1da 100644 --- a/src/Lms/Canvas/CanvasLms.php +++ b/src/Lms/Canvas/CanvasLms.php @@ -15,7 +15,7 @@ use App\Services\SessionService; use App\Services\UtilityService; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; +use Symfony\Bundle\SecurityBundle\Security; class CanvasLms implements LmsInterface { /** @var ContentItemRepository $contentItemRepo */ @@ -494,7 +494,7 @@ public function getContentTypes() protected function getAccountInfo(User $user, $accountId) { - $url = "accounts/${accountId}"; + $url = "accounts/{$accountId}"; $apiDomain = $this->getApiDomain($user); $apiToken = $this->getApiToken($user); @@ -513,7 +513,7 @@ protected function getAccountInfo(User $user, $accountId) protected function getSubAccounts(User $user, $accountId) { - $url = "accounts/${accountId}/sub_accounts?recursive=true"; + $url = "accounts/{$accountId}/sub_accounts?recursive=true"; $apiDomain = $this->getApiDomain($user); $apiToken = $this->getApiToken($user); diff --git a/src/Lms/D2l/D2lLms.php b/src/Lms/D2l/D2lLms.php index 055ff5229..9fee30ef8 100644 --- a/src/Lms/D2l/D2lLms.php +++ b/src/Lms/D2l/D2lLms.php @@ -15,7 +15,7 @@ use App\Services\SessionService; use App\Services\UtilityService; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; +use Symfony\Bundle\SecurityBundle\Security; class D2lLms implements LmsInterface { diff --git a/src/Security/SessionAuthenticator.php b/src/Security/SessionAuthenticator.php index f7e3a11a5..64534a886 100644 --- a/src/Security/SessionAuthenticator.php +++ b/src/Security/SessionAuthenticator.php @@ -57,7 +57,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio return null; } - public function start(Request $request, AuthenticationException $exception = null) + public function start(Request $request, ?AuthenticationException $exception = null) { return new Response('authentication failed'); } diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index 2c807f0fe..65cb229e9 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -8,7 +8,7 @@ use App\Entity\User; use Doctrine\Persistence\ManagerRegistry; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; -use Symfony\Component\Security\Core\Security; +use Symfony\Bundle\SecurityBundle\Security; use Twig\Environment; class UtilityService { @@ -95,7 +95,7 @@ public function getUnreadMessages($markAsRead = true) return $messages; } - public function createMessage($msg, $severity = 'info', Course $course = null, User $user = null, $hideFromUser = false) + public function createMessage($msg, $severity = 'info', ?Course $course = null, ?User $user = null, $hideFromUser = false) { if (!$user) { $user = $this->security->getUser(); @@ -120,8 +120,8 @@ public function createMessage($msg, $severity = 'info', Course $course = null, U $this->doctrine->getManager()->flush(); } - public function exitWithMessage($msg, $severity = 'error', Course $course = null) - { + public function exitWithMessage($msg, $severity = 'error', ?Course $course = null) + { $this->createMessage($msg, $severity, $course); print $this->twig->render('error.html.twig', [