Skip to content

Commit

Permalink
Merge pull request #757 from rob-3/issue/753-fix-deprecation-warnings
Browse files Browse the repository at this point in the history
Issue/753 fix deprecation warnings
  • Loading branch information
SimonRothUCF authored Feb 8, 2022
2 parents 92d580b + 18e7bc3 commit bdf782d
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/Entity/ContentItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public function __construct()

/**
* Serializes ContentItem into JSON.
* @return array|mixed
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->getId(),
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Course.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public function __construct()

/**
* Serializes Course with basic information needed by front-end.
* @return array|mixed
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return [
"id" => $this->id,
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/FileItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ public function update($file): self

/**
* Serializes ContentItem into JSON.
* @return array|mixed
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->getId(),
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Institution.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function setApiClientSecret(?string $apiClientSecret): self
return $this;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public function __construct()

/**
* Serializes Issue into JSON.
* @return array|mixed
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return [
"id" => $this->id,
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/LogEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function setStatus(?bool $status): self
return $this;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'message' => $this->getMessage(),
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ public function __construct()
// Public Methods
/**
*
* @return array|mixed
* @return array
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->toArray();
}

public function toArray()
public function toArray(): array
{
$result = [
"id" => $this->id,
Expand Down
20 changes: 7 additions & 13 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Table(name="users")
*/
class User implements UserInterface, \Serializable, JsonSerializable
class User implements UserInterface, JsonSerializable
{
/**
* @ORM\Id()
Expand Down Expand Up @@ -225,27 +225,21 @@ public function setLastLogin(\DateTimeInterface $lastLogin): self
return $this;
}

/** @see \Serializable::serialize() */
public function serialize()
public function __serialize(): array
{
return serialize(array(
return [
$this->id,
$this->username,
$this->lmsUserId
));
];
}

/** @see \Serializable::unserialize() */
public function unserialize($serialized)
public function __unserialize(array $data): void
{
list(
$this->id,
$this->username,
$this->lmsUserId
) = unserialize($serialized);
[$this->id, $this->username, $this->lmsUserId] = $data;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
$dateFormat = $_ENV['DATE_FORMAT'];
$apiKey = $this->getApiKey();
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/UserSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function setCreated(\DateTimeInterface $created): self
return $this;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->getUuid(),
Expand Down
4 changes: 2 additions & 2 deletions src/Lms/LmsResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public function setResponse(ResponseInterface $response)
$this->contentType = (isset($headers['content-type'][0])) ? $headers['content-type'][0] : false;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'content' => $this->getContent(),
'errors' => $this->errors,
'headers' => $this->headers,
];
}
}
}
2 changes: 1 addition & 1 deletion src/Response/ApiResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function setHtml($html)
$this->html = $html;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'messages' => $this->getMessages(),
Expand Down

0 comments on commit bdf782d

Please sign in to comment.