From 10983fcb170e6b207781649c03e006238cfb2725 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 23 Aug 2019 10:36:56 +0200 Subject: [PATCH] Add missing return annotations on magic methods --- src/Symfony/Component/BrowserKit/Cookie.php | 2 ++ .../Loader/Configurator/ReferenceConfigurator.php | 3 +++ src/Symfony/Component/DependencyInjection/Variable.php | 3 +++ src/Symfony/Component/ExpressionLanguage/Node/Node.php | 3 +++ .../Component/HttpKernel/DataCollector/DataCollector.php | 3 +++ src/Symfony/Component/HttpKernel/Kernel.php | 3 +++ src/Symfony/Component/HttpKernel/Profiler/Profile.php | 3 +++ src/Symfony/Component/Mime/Part/DataPart.php | 3 +++ src/Symfony/Component/Mime/Part/TextPart.php | 3 +++ src/Symfony/Component/VarDumper/Caster/ConstStub.php | 3 +++ src/Symfony/Component/VarDumper/Cloner/Data.php | 6 ++++++ 11 files changed, 35 insertions(+) diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 6afdbd970e..606478727e 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -83,6 +83,8 @@ class Cookie /** * Returns the HTTP representation of the Cookie. + * + * @return string */ public function __toString() { diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php index 69e89e11a4..fa042538ce 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php @@ -59,6 +59,9 @@ class ReferenceConfigurator extends AbstractConfigurator return $this; } + /** + * @return string + */ public function __toString() { return $this->id; diff --git a/src/Symfony/Component/DependencyInjection/Variable.php b/src/Symfony/Component/DependencyInjection/Variable.php index 95e28d60ed..21d33ebb28 100644 --- a/src/Symfony/Component/DependencyInjection/Variable.php +++ b/src/Symfony/Component/DependencyInjection/Variable.php @@ -33,6 +33,9 @@ class Variable $this->name = $name; } + /** + * @return string + */ public function __toString() { return $this->name; diff --git a/src/Symfony/Component/ExpressionLanguage/Node/Node.php b/src/Symfony/Component/ExpressionLanguage/Node/Node.php index 7923cb1d64..61bbd0cdae 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/Node.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/Node.php @@ -33,6 +33,9 @@ class Node $this->attributes = $attributes; } + /** + * @return string + */ public function __toString() { $attributes = []; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 52ab90c669..0e040811e1 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -114,6 +114,9 @@ abstract class DataCollector implements DataCollectorInterface return $casters; } + /** + * @return array + */ public function __sleep() { if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) { diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 99c73a9f4b..55f8467faa 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -870,6 +870,9 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $this->__construct($environment, $debug); } + /** + * @return array + */ public function __sleep() { if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) { diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profile.php b/src/Symfony/Component/HttpKernel/Profiler/Profile.php index f896c00e52..9de221fc8f 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profile.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profile.php @@ -288,6 +288,9 @@ class Profile return isset($this->collectors[$name]); } + /** + * @return array + */ public function __sleep() { return ['token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode']; diff --git a/src/Symfony/Component/Mime/Part/DataPart.php b/src/Symfony/Component/Mime/Part/DataPart.php index 128c53eb62..423185fef2 100644 --- a/src/Symfony/Component/Mime/Part/DataPart.php +++ b/src/Symfony/Component/Mime/Part/DataPart.php @@ -125,6 +125,9 @@ class DataPart extends TextPart } } + /** + * @return array + */ public function __sleep() { // converts the body to a string diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Component/Mime/Part/TextPart.php index 77ab980219..a41d91ddec 100644 --- a/src/Symfony/Component/Mime/Part/TextPart.php +++ b/src/Symfony/Component/Mime/Part/TextPart.php @@ -179,6 +179,9 @@ class TextPart extends AbstractPart return 'quoted-printable'; } + /** + * @return array + */ public function __sleep() { // convert resources to strings for serialization diff --git a/src/Symfony/Component/VarDumper/Caster/ConstStub.php b/src/Symfony/Component/VarDumper/Caster/ConstStub.php index 15868b0934..8b0179745f 100644 --- a/src/Symfony/Component/VarDumper/Caster/ConstStub.php +++ b/src/Symfony/Component/VarDumper/Caster/ConstStub.php @@ -26,6 +26,9 @@ class ConstStub extends Stub $this->value = 1 < \func_num_args() ? $value : $name; } + /** + * @return string + */ public function __toString() { return (string) $this->value; diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index fd7a18a752..c4dd5eeb4b 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -137,6 +137,9 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate return null; } + /** + * @return bool + */ public function __isset($key) { return null !== $this->seek($key); @@ -165,6 +168,9 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate throw new \BadMethodCallException(self::class.' objects are immutable.'); } + /** + * @return string + */ public function __toString() { $value = $this->getValue();