Skip to content

Commit 2a9c975

Browse files
Serializable is banned
1 parent 58822bd commit 2a9c975

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/lint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: "Composer install"
5656
id: install
57-
run: composer install --no-interaction --no-progress --no-scripts
57+
run: composer install --no-interaction --no-progress
5858

5959
- name: Lint YAML files
6060
if: always() && steps.install.outcome == 'success'

src/Entity/User.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @author Ryan Weaver <[email protected]>
3030
* @author Javier Eguiluz <[email protected]>
3131
*/
32-
class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serializable
32+
class User implements UserInterface, PasswordAuthenticatedUserInterface
3333
{
3434
/**
3535
* @var int
@@ -177,18 +177,18 @@ public function eraseCredentials(): void
177177
/**
178178
* {@inheritdoc}
179179
*/
180-
public function serialize(): string
180+
public function __serialize(): array
181181
{
182182
// add $this->salt too if you don't use Bcrypt or Argon2i
183-
return serialize([$this->id, $this->username, $this->password]);
183+
return [$this->id, $this->username, $this->password];
184184
}
185185

186186
/**
187187
* {@inheritdoc}
188188
*/
189-
public function unserialize($serialized): void
189+
public function __unserialize(array $data): void
190190
{
191191
// add $this->salt too if you don't use Bcrypt or Argon2i
192-
[$this->id, $this->username, $this->password] = unserialize($serialized, ['allowed_classes' => false]);
192+
[$this->id, $this->username, $this->password] = $data;
193193
}
194194
}

0 commit comments

Comments
 (0)