Skip to content

Commit bdf782d

Browse files
authored
Merge pull request #757 from rob-3/issue/753-fix-deprecation-warnings
Issue/753 fix deprecation warnings
2 parents 92d580b + 18e7bc3 commit bdf782d

File tree

11 files changed

+24
-30
lines changed

11 files changed

+24
-30
lines changed

src/Entity/ContentItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ public function __construct()
8888

8989
/**
9090
* Serializes ContentItem into JSON.
91-
* @return array|mixed
91+
* @return array
9292
*/
93-
public function jsonSerialize()
93+
public function jsonSerialize(): array
9494
{
9595
return [
9696
'id' => $this->getId(),

src/Entity/Course.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public function __construct()
9090

9191
/**
9292
* Serializes Course with basic information needed by front-end.
93-
* @return array|mixed
93+
* @return array
9494
*/
95-
public function jsonSerialize()
95+
public function jsonSerialize(): array
9696
{
9797
return [
9898
"id" => $this->id,

src/Entity/FileItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ public function update($file): self
237237

238238
/**
239239
* Serializes ContentItem into JSON.
240-
* @return array|mixed
240+
* @return array
241241
*/
242-
public function jsonSerialize()
242+
public function jsonSerialize(): array
243243
{
244244
return [
245245
'id' => $this->getId(),

src/Entity/Institution.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public function setApiClientSecret(?string $apiClientSecret): self
319319
return $this;
320320
}
321321

322-
public function jsonSerialize()
322+
public function jsonSerialize(): array
323323
{
324324
return [
325325
'id' => $this->id,

src/Entity/Issue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public function __construct()
8787

8888
/**
8989
* Serializes Issue into JSON.
90-
* @return array|mixed
90+
* @return array
9191
*/
92-
public function jsonSerialize()
92+
public function jsonSerialize(): array
9393
{
9494
return [
9595
"id" => $this->id,

src/Entity/LogEntry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function setStatus(?bool $status): self
126126
return $this;
127127
}
128128

129-
public function jsonSerialize()
129+
public function jsonSerialize(): array
130130
{
131131
return [
132132
'message' => $this->getMessage(),

src/Entity/Report.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ public function __construct()
8383
// Public Methods
8484
/**
8585
*
86-
* @return array|mixed
86+
* @return array
8787
*/
88-
public function jsonSerialize()
88+
public function jsonSerialize(): array
8989
{
9090
return $this->toArray();
9191
}
9292

93-
public function toArray()
93+
public function toArray(): array
9494
{
9595
$result = [
9696
"id" => $this->id,

src/Entity/User.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
1414
* @ORM\Table(name="users")
1515
*/
16-
class User implements UserInterface, \Serializable, JsonSerializable
16+
class User implements UserInterface, JsonSerializable
1717
{
1818
/**
1919
* @ORM\Id()
@@ -225,27 +225,21 @@ public function setLastLogin(\DateTimeInterface $lastLogin): self
225225
return $this;
226226
}
227227

228-
/** @see \Serializable::serialize() */
229-
public function serialize()
228+
public function __serialize(): array
230229
{
231-
return serialize(array(
230+
return [
232231
$this->id,
233232
$this->username,
234233
$this->lmsUserId
235-
));
234+
];
236235
}
237236

238-
/** @see \Serializable::unserialize() */
239-
public function unserialize($serialized)
237+
public function __unserialize(array $data): void
240238
{
241-
list(
242-
$this->id,
243-
$this->username,
244-
$this->lmsUserId
245-
) = unserialize($serialized);
239+
[$this->id, $this->username, $this->lmsUserId] = $data;
246240
}
247241

248-
public function jsonSerialize()
242+
public function jsonSerialize(): array
249243
{
250244
$dateFormat = $_ENV['DATE_FORMAT'];
251245
$apiKey = $this->getApiKey();

src/Entity/UserSession.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function setCreated(\DateTimeInterface $created): self
9191
return $this;
9292
}
9393

94-
public function jsonSerialize()
94+
public function jsonSerialize(): array
9595
{
9696
return [
9797
'id' => $this->getUuid(),

src/Lms/LmsResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ public function setResponse(ResponseInterface $response)
9191
$this->contentType = (isset($headers['content-type'][0])) ? $headers['content-type'][0] : false;
9292
}
9393

94-
public function jsonSerialize()
94+
public function jsonSerialize(): array
9595
{
9696
return [
9797
'content' => $this->getContent(),
9898
'errors' => $this->errors,
9999
'headers' => $this->headers,
100100
];
101101
}
102-
}
102+
}

0 commit comments

Comments
 (0)