8000 Mark some/most implementations of Serializable as `@internal` by nicolas-grekas · Pull Request #30035 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Mark some/most implementations of Serializable as @internal #30035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function isFresh($timestamp)
}

/**
* {@inheritdoc}
* @internal
*/
public function serialize()
{
Expand All @@ -109,7 +109,7 @@ public function serialize()
}

/**
* {@inheritdoc}
* @internal
*/
public function unserialize($serialized)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Config/Resource/ComposerResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,17 @@ public function isFresh($timestamp)
return self::$runtimeVendors === $this->vendors;
}

/**
* @internal
*/
public function serialize()
{
return serialize($this->vendors);
}

/**
* @internal
*/
public function unserialize($serialized)
{
$this->vendors = unserialize($serialized);
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Config/Resource/DirectoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,17 @@ public function isFresh($timestamp)
return true;
}

/**
* @internal
*/
public function serialize()
{
return serialize([$this->resource, $this->pattern]);
}

/**
* @internal
*/
public function unserialize($serialized)
{
list($this->resource, $this->pattern) = unserialize($serialized);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public function isFresh($timestamp)
}

/**
* {@inheritdoc}
* @internal
*/
public function serialize()
{
return serialize([$this->resource, $this->exists]);
}

/**
* {@inheritdoc}
* @internal
*/
public function unserialize($serialized)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Config/Resource/FileResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ public function isFresh($timestamp)
return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;
}

/**
* @internal
*/
public function serialize()
{
return serialize($this->resource);
}

/**
* @internal
*/
public function unserialize($serialized)
{
$this->resource = unserialize($serialized);
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Config/Resource/GlobResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public function isFresh($timestamp)
return $this->hash === $hash;
}

/**
* @internal
*/
public function serialize()
{
if (null === $this->hash) {
Expand All @@ -82,6 +85,9 @@ public function serialize()
return serialize([$this->prefix, $this->pattern, $this->recursive, $this->hash]);
}

/**
* @internal
*/
public function unserialize($serialized)
{
list($this->prefix, $this->pattern, $this->recursive, $this->hash) = unserialize($serialized);
Expand Down
A3E2
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public function __toString()
return 'reflection.'.$this->className;
}

/**
* @internal
*/
public function serialize()
{
if (null === $this->hash) {
Expand All @@ -67,6 +70,9 @@ public function serialize()
return serialize([$this->files, $this->className, $this->hash]);
}

/**
* @internal
*/
public function unserialize($serialized)
{
list($this->files, $this->className, $this->hash) = unserialize($serialized);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ public function __toString()
return 'service.autowire.'.$this->class;
}

/**
* @internal
*/
public function serialize()
{
return serialize([$this->class, $this->filePath, $this->autowiringMetadata]);
}

/**
* @internal
*/
public function unserialize($serialized)
{
if (\PHP_VERSION_ID >= 70000) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function __toString()
}

/**
* {@inheritdoc}
* @internal
*/
public function serialize()
{
return serialize($this->parameters);
}

/**
* {@inheritdoc}
* @internal
*/
public function unserialize($serialized)
{
Expand Down
8 changes: 2 additions & 6 deletions src/Symfony/Component/Form/FormError.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ public function getOrigin()
}

/**
* Serializes this error.
*
* @return string The serialized error
* @internal
*/
public function serialize()
{
Expand All @@ -151,9 +149,7 @@ public function serialize()
}

/**
* Unserializes a serialized error.
*
* @param string $serialized The serialized error
* @internal
*/
public function unserialize($serialized)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ public function isFresh($timestamp)
return $this->findVariables() === $this->variables;
}

/**
* @internal
*/
public function serialize()
{
return serialize(['prefix' => $this->prefix, 'variables' => $this->variables]);
}

/**
* @internal
*/
public function unserialize($serialized)
{
if (\PHP_VERSION_ID >= 70000) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
*/
private $cloner;

/**
* @internal
*/
public function serialize()
{
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
Expand All @@ -48,6 +51,9 @@ public function serialize()
return $isCalledFromOverridingMethod ? $this->data : serialize($this->data);
}

/**
* @internal
*/
public function unserialize($data)
{
$this->data = \is_array($data) ? $data : unserialize($data);
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,17 @@ public function format($file, $line)
return false;
}

/**
* @internal
*/
public function serialize()
{
return serialize($this->getFileLinkFormat());
}

/**
* @internal
*/
public function unserialize($serialized)
{
if (\PHP_VERSION_ID >= 70000) {
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Validator/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ public function getTargets()
*
* @return array The properties to serialize
*
* @internal This method may be replaced by an implementation of
* {@link \Serializable} in the future. Please don't use or
* overwrite it.
* @internal
*/
public function __sleep()
{
Expand Down
0