8000 Remove Serializable implementations · symfony/symfony@b3fb841 · GitHub
[go: up one dir, main page]

Skip to content

Commit b3fb841

Browse files
committed
Remove Serializable implementations
1 parent d131937 commit b3fb841

File tree

14 files changed

+25
-144
lines changed

14 files changed

+25
-144
lines changed

src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
18+
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable
1919
{
2020
private $array;
2121

@@ -63,18 +63,8 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
7166
public function __unserialize(array $data): void
7267
{
7368
$this->array = $data;
7469
}
75-
76-
public function unserialize($serialized)
77-
{
78-
$this->__unserialize((array) unserialize((string) $serialized));
79-
}
8070
}

src/Symfony/Component/Mime/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove `Serializable` interface from `RawMessage`
8+
49
5.2.0
510
-----
611

src/Symfony/Component/Mime/RawMessage.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
*/
19-
class RawMessage implements \Serializable
19+
class RawMessage
2020
{
2121
private $message;
2222

@@ -60,22 +60,6 @@ public function ensureValidity()
6060
{
6161
}
6262

63-
/**
64-
* @internal
65-
*/
66-
final public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
71-
/**
72-
* @internal
73-
*/
74-
final public function unserialize($serialized)
75-
{
76-
$this->__unserialize(unserialize($serialized));
77-
}
78-
7963
public function __serialize(): array
8064
{
8165
return [$this->toString()];

src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class NonTraversableArrayObject implements \ArrayAccess, \Countable, \Serializable
18+
class NonTraversableArrayObject implements \ArrayAccess, \Countable
1919
{
2020
private $array;
2121

@@ -58,18 +58,8 @@ public function __serialize(): array
5858
return $this->array;
5959
}
6060

61-
public function serialize(): string
62-
{
63-
return serialize($this->__serialize());
64-
}
65-
6661
public function __unserialize(array $data): void
6762
{
6863
$this->array = $data;
6964
}
70-
71-
public function unserialize($serialized)
72-
{
73-
$this->__unserialize((array) unserialize((string) $serialized));
74-
}
7565
}

src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
18+
class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable
1919
{
2020
private $array;
2121

@@ -63,18 +63,8 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
7166
public function __unserialize(array $data): void
7267
{
7368
$this->array = $data;
7469
}
75-
76-
public function unserialize($serialized)
77-
{
78-
$this->__unserialize((array) unserialize((string) $serialized));
79-
}
8070
}

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove the `Serializable` interface from `Route` and `CompiledRoute`
8+
49
5.3
510
---
611

src/Symfony/Component/Routing/CompiledRoute.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
*/
19-
class CompiledRoute implements \Serializable
19+
class CompiledRoute
2020
{
2121
private $variables;
2222
private $tokens;
@@ -63,14 +63,6 @@ public function __serialize(): array
6363
];
6464
}
6565

66-
/**
67-
* @internal
68-
*/
69-
final public function serialize(): string
70-
{
71-
return serialize($this->__serialize());
72-
}
73-
7466
public function __unserialize(array $data): void
7567
{
7668
$this->variables = $data['vars'];
@@ -83,14 +75,6 @@ public function __unserialize(array $data): void
8375
$this->hostVariables = $data['host_vars'];
8476
}
8577

86-
/**
87-
* @internal
88-
*/
89-
final public function unserialize($serialized)
90-
{
91-
$this->__unserialize(unserialize($serialized, ['allowed_classes' => false]));
92-
}
93-
9478
/**
9579
* Returns the static prefix.
9680
*

src/Symfony/Component/Routing/Route.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
* @author Tobias Schultze <http://tobion.de>
1919
*/
20-
class Route implements \Serializable
20+
class Route
2121
{
2222
private $path = '/';
2323
private $host = '';
@@ -77,14 +77,6 @@ public function __serialize(): array
7777
];
7878
}
7979

80-
/**
81-
* @internal
82-
*/
83-
final public function serialize(): string
84-
{
85-
return serialize($this->__serialize());
86-
}
87-
8880
public function __unserialize(array $data): void
8981
{
9082
$this->path = $data['path'];
@@ -103,14 +95,6 @@ public function __unserialize(array $data): void
10395
}
10496
}
10597

106-
/**
107-
* @internal
108-
*/
109-
final public function unserialize($serialized)
110-
{
111-
$this->__unserialize(unserialize($serialized));
112-
}
113-
11498
/**
11599
* Returns the pattern for the path.
116100
*

src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,6 @@ public function __toString()
259259
return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUserIdentifier(), json_encode($this->authenticated), implode(', ', $roles));
260260
}
261261

262-
/**
263-
* @internal
264-
*/
265-
final public function serialize(): string
266-
{
267-
return serialize($this->__serialize());
268-
}
269-
270-
/**
271-
* @internal
272-
*/
273-
final public function unserialize($serialized)
274-
{
275-
$this->__unserialize(\is_array($serialized) ? $serialized : unserialize($serialized));
276-
}
277-
278262
private function hasUserChanged(UserInterface $user): bool
279263
{
280264
if (!($this->user instanceof UserInterface)) {

src/Symfony/Component/Security/Core/Authentication/Token/NullToken.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,4 @@ public function __serialize(): array
100100
public function __unserialize(array $data): void
101101
{
102102
}
103-
104-
/**
105-
* @return string
106-
*
107-
* @internal in 5.3
108-
* @final in 5.3
109-
*/
110-
public function serialize()
111-
{
112-
return '';
113-
}
114-
115-
/**
116-
* @return void
117-
*
118-
* @internal in 5.3
119-
* @final in 5.3
120-
*/
121-
public function unserialize($serialized)
122-
{
123-
}
124103
}

src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @author Fabien Potencier <fabien@symfony.com>
2222
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2323
*/
24-
interface TokenInterface extends \Serializable
24+
interface TokenInterface
2525
{
2626
/**
2727
* Returns a string representation of the Token.

src/Symfony/Component/Security/Core/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* `TokenInterface` does not extend `Serializable` anymore
8+
* Remove `serialize()` and `unserialize()` from all token implementations
9+
410
5.3
511
---
612

src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function __toString(): string
232232
}
233233
}
234234

235-
class SerializableUser implements UserInterface, \Serializable
235+
class SerializableUser implements UserInterface
236236
{
237237
private $roles;
238238
private $name;
@@ -275,16 +275,6 @@ public function getSalt()
275275
{
276276
return null;
277277
}
278-
279-
public function serialize(): string
280-
{
281-
return serialize($this->name);
282-
}
283-
284-
public function unserialize($serialized): void
285-
{
286-
$this->name = unserialize($serialized);
287-
}
288278
}
289279

290280
class ConcreteToken extends AbstractToken

src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
18+
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable
1919
{
2020
private $array;
2121

@@ -63,18 +63,8 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
7166
public function __unserialize(array $data): void
7267
{
7368
$this->array = $data;
7469
}
75-
76-
public function unserialize($serialized)
77-
{
78-
$this->__unserialize((array) unserialize((string) $serialized));
79-
}
8070
}

0 commit comments

Comments
 (0)
0