diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeader.php b/src/Symfony/Component/HttpFoundation/AcceptHeader.php index 3f5fbb8f3b5cd..cead4c488f87c 100644 --- a/src/Symfony/Component/HttpFoundation/AcceptHeader.php +++ b/src/Symfony/Component/HttpFoundation/AcceptHeader.php @@ -44,15 +44,13 @@ public function __construct(array $items) /** * Builds an AcceptHeader instance from a string. * - * @param string $headerValue - * * @return self */ - public static function fromString($headerValue) + public static function fromString(?string $headerValue) { $index = 0; - $parts = HeaderUtils::split((string) $headerValue, ',;='); + $parts = HeaderUtils::split($headerValue ?? '', ',;='); return new self(array_map(function ($subParts) use (&$index) { $part = array_shift($subParts); @@ -78,11 +76,9 @@ public function __toString() /** * Tests if header has given value. * - * @param string $value - * * @return bool */ - public function has($value) + public function has(string $value) { return isset($this->items[$value]); } @@ -90,11 +86,9 @@ public function has($value) /** * Returns given value's item, if exists. * - * @param string $value - * * @return AcceptHeaderItem|null */ - public function get($value) + public function get(string $value) { return $this->items[$value] ?? $this->items[explode('/', $value)[0].'/*'] ?? $this->items['*/*'] ?? $this->items['*'] ?? null; } @@ -127,11 +121,9 @@ public function all() /** * Filters items on their value using given regex. * - * @param string $pattern - * * @return self */ - public function filter($pattern) + public function filter(string $pattern) { return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) { return preg_match($pattern, $item->getValue()); diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php index 954aac6014544..6e31913f14da6 100644 --- a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php +++ b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php @@ -34,11 +34,9 @@ public function __construct(string $value, array $attributes = []) /** * Builds an AcceptHeaderInstance instance from a string. * - * @param string $itemValue - * * @return self */ - public static function fromString($itemValue) + public static function fromString(string $itemValue) { $parts = HeaderUtils::split($itemValue, ';='); @@ -66,11 +64,9 @@ public function __toString() /** * Set the item value. * - * @param string $value - * * @return $this */ - public function setValue($value) + public function setValue(string $value) { $this->value = $value; @@ -90,11 +86,9 @@ public function getValue() /** * Set the item quality. * - * @param float $quality - * * @return $this */ - public function setQuality($quality) + public function setQuality(float $quality) { $this->quality = $quality; @@ -114,11 +108,9 @@ public function getQuality() /** * Set the item index. * - * @param int $index - * * @return $this */ - public function setIndex($index) + public function setIndex(int $index) { $this->index = $index; @@ -138,11 +130,9 @@ public function getIndex() /** * Tests if an attribute exists. * - * @param string $name - * * @return bool */ - public function hasAttribute($name) + public function hasAttribute(string $name) { return isset($this->attributes[$name]); } @@ -150,12 +140,11 @@ public function hasAttribute($name) /** * Returns an attribute by its name. * - * @param string $name - * @param mixed $default + * @param mixed $default * * @return mixed */ - public function getAttribute($name, $default = null) + public function getAttribute(string $name, $default = null) { return isset($this->attributes[$name]) ? $this->attributes[$name] : $default; } @@ -173,12 +162,9 @@ public function getAttributes() /** * Set an attribute. * - * @param string $name - * @param string $value - * * @return $this */ - public function setAttribute($name, $value) + public function setAttribute(string $name, string $value) { if ('q' === $name) { $this->quality = (float) $value; diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 79329e2e2b26d..1c9b614ba75f3 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -66,7 +66,7 @@ public function __construct($file, int $status = 200, array $headers = [], bool * * @return static */ - public static function create($file = null, $status = 200, $headers = [], $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + public static function create($file = null, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true) { return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified); } @@ -74,16 +74,13 @@ public static function create($file = null, $status = 200, $headers = [], $publi /** * Sets the file to stream. * - * @param \SplFileInfo|string $file The file to stream - * @param string $contentDisposition - * @param bool $autoEtag - * @param bool $autoLastModified + * @param \SplFileInfo|string $file The file to stream * * @return $this * * @throws FileException */ - public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + public function setFile($file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true) { if (!$file instanceof File) { if ($file instanceof \SplFileInfo) { @@ -153,7 +150,7 @@ public function setAutoEtag() * * @return $this */ - public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') + public function setContentDisposition(string $disposition, string $filename = '', string $filenameFallback = '') { if ('' === $filename) { $filename = $this->file->getFilename(); @@ -346,11 +343,9 @@ public static function trustXSendfileTypeHeader() * If this is set to true, the file will be unlinked after the request is send * Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used. * - * @param bool $shouldDelete - * * @return $this */ - public function deleteFileAfterSend($shouldDelete = true) + public function deleteFileAfterSend(bool $shouldDelete = true) { $this->deleteFileAfterSend = $shouldDelete; diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index 9391076df8659..c2a67cb0353c6 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -36,12 +36,9 @@ class Cookie /** * Creates cookie from raw header string. * - * @param string $cookie - * @param bool $decode - * * @return static */ - public static function fromString($cookie, $decode = false) + public static function fromString(string $cookie, bool $decode = false) { $data = [ 'expires' => 0, @@ -74,8 +71,6 @@ public static function create(string $name, string $value = null, $expire = 0, ? } /** - * @param string $name The name of the cookie - * @param string|null $value The value of the cookie * @param int|string|\DateTimeInterface $expire The time the cookie expires * @param string $path The path on the server in which the cookie will be available on * @param string|null $domain The domain that the cookie is available to diff --git a/src/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php b/src/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php index c25c3629bb617..136d2a9f51b16 100644 --- a/src/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php +++ b/src/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php @@ -18,9 +18,6 @@ */ class AccessDeniedException extends FileException { - /** - * @param string $path The path to the accessed file - */ public function __construct(string $path) { parent::__construct(sprintf('The file %s could not be accessed', $path)); diff --git a/src/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php b/src/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php index 0f1f3f951d806..31bdf68fef7b5 100644 --- a/src/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php +++ b/src/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php @@ -18,9 +18,6 @@ */ class FileNotFoundException extends FileException { - /** - * @param string $path The path to the file that was not found - */ public function __construct(string $path) { parent::__construct(sprintf('The file "%s" does not exist', $path)); diff --git a/src/Symfony/Component/HttpFoundation/File/File.php b/src/Symfony/Component/HttpFoundation/File/File.php index 396ff3450ed8c..cd8618a985fe9 100644 --- a/src/Symfony/Component/HttpFoundation/File/File.php +++ b/src/Symfony/Component/HttpFoundation/File/File.php @@ -25,9 +25,6 @@ class File extends \SplFileInfo /** * Constructs a new file from the given path. * - * @param string $path The path to the file - * @param bool $checkPath Whether to check the path or not - * * @throws FileNotFoundException If the given path is not a file */ public function __construct(string $path, bool $checkPath = true) @@ -76,14 +73,11 @@ public function getMimeType() /** * Moves the file to a new location. * - * @param string $directory The destination folder - * @param string $name The new file name - * * @return self A File object representing the new file * * @throws FileException if the target file could not be created */ - public function move($directory, $name = null) + public function move(string $directory, string $name = null) { $target = $this->getTargetFile($directory, $name); @@ -117,11 +111,9 @@ protected function getTargetFile($directory, $name = null) /** * Returns locale independent base name of the given path. * - * @param string $name The new file name - * * @return string containing */ - protected function getName($name) + protected function getName(string $name) { $originalName = str_replace('\\', '/', $name); $pos = strrpos($originalName, '/'); diff --git a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php index 3ea8ab55e6aee..a2ed4262d4457 100644 --- a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -164,14 +164,11 @@ public function isValid() /** * Moves the file to a new location. * - * @param string $directory The destination folder - * @param string $name The new file name - * * @return File A File object representing the new file * * @throws FileException if, for any reason, the file could not have been moved */ - public function move($directory, $name = null) + public function move(string $directory, string $name = null) { if ($this->isValid()) { if ($this->test) { diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index efd83ffeb8abd..407b2e30120ce 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -23,9 +23,6 @@ class FileBag extends ParameterBag { private static $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type']; - /** - * @param array $parameters An array of HTTP files - */ public function __construct(array $parameters = []) { $this->replace($parameters); @@ -43,7 +40,7 @@ public function replace(array $files = []) /** * {@inheritdoc} */ - public function set($key, $value) + public function set(string $key, $value) { if (!\is_array($value) && !$value instanceof UploadedFile) { throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index cccfd037839f4..a5a287188b939 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -21,9 +21,6 @@ class HeaderBag implements \IteratorAggregate, \Countable protected $headers = []; protected $cacheControl = []; - /** - * @param array $headers An array of HTTP headers - */ public function __construct(array $headers = []) { foreach ($headers as $key => $values) { @@ -85,8 +82,6 @@ public function keys() /** * Replaces the current HTTP headers by a new set. - * - * @param array $headers An array of HTTP headers */ public function replace(array $headers = []) { @@ -96,8 +91,6 @@ public function replace(array $headers = []) /** * Adds new headers the current HTTP headers set. - * - * @param array $headers An array of HTTP headers */ public function add(array $headers) { @@ -109,12 +102,9 @@ public function add(array $headers) /** * Returns a header value by name. * - * @param string $key The header name - * @param string|null $default The default value - * - * @return string|null The first header value or default value + * @return string|string[]|null The first header value or default value if $first is true, an array of values otherwise */ - public function get($key, $default = null) + public function get(string $key, string $default = null) { $headers = $this->all((string) $key); @@ -124,11 +114,10 @@ public function get($key, $default = null) /** * Sets a header by name. * - * @param string $key The key * @param string|string[] $values The value or an array of values * @param bool $replace Whether to replace the actual value or not (true by default) */ - public function set($key, $values, $replace = true) + public function set(string $key, $values, bool $replace = true) { $key = str_replace('_', '-', strtolower($key)); @@ -156,11 +145,9 @@ public function set($key, $values, $replace = true) /** * Returns true if the HTTP header is defined. * - * @param string $key The HTTP header - * * @return bool true if the parameter exists, false otherwise */ - public function has($key) + public function has(string $key) { return \array_key_exists(str_replace('_', '-', strtolower($key)), $this->all()); } @@ -168,22 +155,17 @@ public function has($key) /** * Returns true if the given HTTP header contains the given value. * - * @param string $key The HTTP header name - * @param string $value The HTTP value - * * @return bool true if the value is contained in the header, false otherwise */ - public function contains($key, $value) + public function contains(string $key, string $value) { return \in_array($value, $this->all((string) $key)); } /** * Removes a header. - * - * @param string $key The HTTP header name */ - public function remove($key) + public function remove(string $key) { $key = str_replace('_', '-', strtolower($key)); @@ -197,14 +179,11 @@ public function remove($key) /** * Returns the HTTP header value converted to a date. * - * @param string $key The parameter key - * @param \DateTime $default The default value - * * @return \DateTime|null The parsed DateTime or the default value if the header does not exist * * @throws \RuntimeException When the HTTP header is not parseable */ - public function getDate($key, \DateTime $default = null) + public function getDate(string $key, \DateTime $default = null) { if (null === $value = $this->get($key)) { return $default; @@ -220,10 +199,9 @@ public function getDate($key, \DateTime $default = null) /** * Adds a custom Cache-Control directive. * - * @param string $key The Cache-Control directive name - * @param mixed $value The Cache-Control directive value + * @param mixed $value The Cache-Control directive value */ - public function addCacheControlDirective($key, $value = true) + public function addCacheControlDirective(string $key, $value = true) { $this->cacheControl[$key] = $value; @@ -233,11 +211,9 @@ public function addCacheControlDirective($key, $value = true) /** * Returns true if the Cache-Control directive is defined. * - * @param string $key The Cache-Control directive - * * @return bool true if the directive exists, false otherwise */ - public function hasCacheControlDirective($key) + public function hasCacheControlDirective(string $key) { return \array_key_exists($key, $this->cacheControl); } @@ -245,21 +221,17 @@ public function hasCacheControlDirective($key) /** * Returns a Cache-Control directive value by name. * - * @param string $key The directive name - * * @return mixed|null The directive value if defined, null otherwise */ - public function getCacheControlDirective($key) + public function getCacheControlDirective(string $key) { return \array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; } /** * Removes a Cache-Control directive. - * - * @param string $key The Cache-Control directive */ - public function removeCacheControlDirective($key) + public function removeCacheControlDirective(string $key) { unset($this->cacheControl[$key]); @@ -296,11 +268,9 @@ protected function getCacheControlHeader() /** * Parses a Cache-Control HTTP header. * - * @param string $header The value of the Cache-Control HTTP header - * * @return array An array representing the attribute values */ - protected function parseCacheControl($header) + protected function parseCacheControl(string $header) { $parts = HeaderUtils::split($header, ',='); diff --git a/src/Symfony/Component/HttpFoundation/HeaderUtils.php b/src/Symfony/Component/HttpFoundation/HeaderUtils.php index 31db1bd0ded90..5866e3b2b53e6 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderUtils.php +++ b/src/Symfony/Component/HttpFoundation/HeaderUtils.php @@ -36,7 +36,6 @@ private function __construct() * HeaderUtils::split("da, en-gb;q=0.8", ",;") * // => ['da'], ['en-gb', 'q=0.8']] * - * @param string $header HTTP header value * @param string $separators List of characters to split on, ordered by * precedence, e.g. ",", ";=", or ",;=" * diff --git a/src/Symfony/Component/HttpFoundation/IpUtils.php b/src/Symfony/Component/HttpFoundation/IpUtils.php index 67d13e57aafce..3c38ff038ea20 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -35,7 +35,7 @@ private function __construct() * * @return bool Whether the IP is valid */ - public static function checkIp($requestIp, $ips) + public static function checkIp(?string $requestIp, $ips) { if (!\is_array($ips)) { $ips = [$ips]; @@ -61,7 +61,7 @@ public static function checkIp($requestIp, $ips) * * @return bool Whether the request IP matches the IP, or whether the request IP is within the CIDR subnet */ - public static function checkIp4($requestIp, $ip) + public static function checkIp4(?string $requestIp, string $ip) { $cacheKey = $requestIp.'-'.$ip; if (isset(self::$checkedIps[$cacheKey])) { @@ -109,7 +109,7 @@ public static function checkIp4($requestIp, $ip) * * @throws \RuntimeException When IPV6 support is not enabled */ - public static function checkIp6($requestIp, $ip) + public static function checkIp6(?string $requestIp, string $ip) { $cacheKey = $requestIp.'-'.$ip; if (isset(self::$checkedIps[$cacheKey])) { diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index 11a0bebf88302..f2a4e60b13b60 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -64,7 +64,7 @@ public function __construct($data = null, int $status = 200, array $headers = [] * * @return static */ - public static function create($data = null, $status = 200, $headers = []) + public static function create($data = null, int $status = 200, array $headers = []) { return new static($data, $status, $headers); } @@ -83,7 +83,7 @@ public static function create($data = null, $status = 200, $headers = []) * * @return static */ - public static function fromJsonString($data = null, $status = 200, $headers = []) + public static function fromJsonString($data = null, int $status = 200, array $headers = []) { return new static($data, $status, $headers, true); } @@ -97,7 +97,7 @@ public static function fromJsonString($data = null, $status = 200, $headers = [] * * @throws \InvalidArgumentException When the callback name is not valid */ - public function setCallback($callback = null) + public function setCallback(string $callback = null) { if (null !== $callback) { // partially taken from https://geekality.net/2011/08/03/valid-javascript-identifier/ @@ -126,13 +126,11 @@ public function setCallback($callback = null) /** * Sets a raw string containing a JSON document to be sent. * - * @param string $json - * * @return $this * * @throws \InvalidArgumentException */ - public function setJson($json) + public function setJson(string $json) { $this->data = $json; @@ -183,13 +181,11 @@ public function getEncodingOptions() /** * Sets options used while encoding data to JSON. * - * @param int $encodingOptions - * * @return $this */ - public function setEncodingOptions($encodingOptions) + public function setEncodingOptions(int $encodingOptions) { - $this->encodingOptions = (int) $encodingOptions; + $this->encodingOptions = $encodingOptions; return $this->setData(json_decode($this->data)); } diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 194ba2c6c57ef..caa275cf14ffa 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -23,9 +23,6 @@ class ParameterBag implements \IteratorAggregate, \Countable */ protected $parameters; - /** - * @param array $parameters An array of parameters - */ public function __construct(array $parameters = []) { $this->parameters = $parameters; @@ -51,21 +48,11 @@ public function keys() return array_keys($this->parameters); } - /** - * Replaces the current parameters by a new set. - * - * @param array $parameters An array of parameters - */ public function replace(array $parameters = []) { $this->parameters = $parameters; } - /** - * Adds parameters. - * - * @param array $parameters An array of parameters - */ public function add(array $parameters = []) { $this->parameters = array_replace($this->parameters, $parameters); @@ -74,12 +61,11 @@ public function add(array $parameters = []) /** * Returns a parameter by name. * - * @param string $key The key - * @param mixed $default The default value if the parameter key does not exist + * @param mixed $default The default value if the parameter key does not exist * * @return mixed */ - public function get($key, $default = null) + public function get(string $key, $default = null) { return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } @@ -87,10 +73,9 @@ public function get($key, $default = null) /** * Sets a parameter by name. * - * @param string $key The key - * @param mixed $value The value + * @param mixed $value The value */ - public function set($key, $value) + public function set(string $key, $value) { $this->parameters[$key] = $value; } @@ -98,21 +83,14 @@ public function set($key, $value) /** * Returns true if the parameter is defined. * - * @param string $key The key - * * @return bool true if the parameter exists, false otherwise */ - public function has($key) + public function has(string $key) { return \array_key_exists($key, $this->parameters); } - /** - * Removes a parameter. - * - * @param string $key The key - */ - public function remove($key) + public function remove(string $key) { unset($this->parameters[$key]); } @@ -120,12 +98,11 @@ public function remove($key) /** * Returns the alphabetic characters of the parameter value. * - * @param string $key The parameter key * @param string $default The default value if the parameter key does not exist * * @return string The filtered value */ - public function getAlpha($key, $default = '') + public function getAlpha(string $key, string $default = '') { return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default)); } @@ -133,12 +110,11 @@ public function getAlpha($key, $default = '') /** * Returns the alphabetic characters and digits of the parameter value. * - * @param string $key The parameter key * @param string $default The default value if the parameter key does not exist * * @return string The filtered value */ - public function getAlnum($key, $default = '') + public function getAlnum(string $key, string $default = '') { return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default)); } @@ -146,12 +122,11 @@ public function getAlnum($key, $default = '') /** * Returns the digits of the parameter value. * - * @param string $key The parameter key * @param string $default The default value if the parameter key does not exist * * @return string The filtered value */ - public function getDigits($key, $default = '') + public function getDigits(string $key, string $default = '') { // we need to remove - and + because they're allowed in the filter return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); @@ -160,25 +135,23 @@ public function getDigits($key, $default = '') /** * Returns the parameter value converted to integer. * - * @param string $key The parameter key - * @param int $default The default value if the parameter key does not exist + * @param int $default The default value if the parameter key does not exist * * @return int The filtered value */ - public function getInt($key, $default = 0) + public function getInt(string $key, int $default = 0) { - return (int) $this->get($key, $default); + return $this->get($key, $default); } /** * Returns the parameter value converted to boolean. * - * @param string $key The parameter key - * @param bool $default The default value if the parameter key does not exist + * @param bool $default The default value if the parameter key does not exist * * @return bool The filtered value */ - public function getBoolean($key, $default = false) + public function getBoolean(string $key, bool $default = false) { return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN); } @@ -186,16 +159,15 @@ public function getBoolean($key, $default = false) /** * Filter key. * - * @param string $key Key - * @param mixed $default Default = null - * @param int $filter FILTER_* constant - * @param mixed $options Filter options + * @param mixed $default Default = null + * @param int $filter FILTER_* constant + * @param mixed $options Filter options * * @see https://php.net/filter-var * * @return mixed */ - public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = []) + public function filter(string $key, $default = null, int $filter = FILTER_DEFAULT, $options = []) { $value = $this->get($key, $default); diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php index 621a3d8d359ca..726008b16fa1d 100644 --- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -50,13 +50,9 @@ public function __construct(string $url, int $status = 302, array $headers = []) /** * Factory method for chainability. * - * @param string $url The url to redirect to - * @param int $status The response status code - * @param array $headers An array of response headers - * * @return static */ - public static function create($url = '', $status = 302, $headers = []) + public static function create(?string $url = '', int $status = 302, array $headers = []) { return new static($url, $status, $headers); } @@ -74,13 +70,11 @@ public function getTargetUrl() /** * Sets the redirect target of this response. * - * @param string $url The URL to redirect to - * * @return $this * * @throws \InvalidArgumentException */ - public function setTargetUrl($url) + public function setTargetUrl(string $url) { if ('' === ($url ?? '')) { throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 55137b51ea366..1b87f712f0a64 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -310,7 +310,7 @@ public static function createFromGlobals() * * @return static */ - public static function create($uri, $method = 'GET', $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + public static function create(string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], $content = null) { $server = array_replace([ 'SERVER_NAME' => 'localhost', @@ -408,10 +408,8 @@ public static function create($uri, $method = 'GET', $parameters = [], $cookies * This is mainly useful when you need to override the Request class * to keep BC with an existing system. It should not be used for any * other purpose. - * - * @param callable|null $callable A PHP callable */ - public static function setFactory($callable) + public static function setFactory(?callable $callable) { self::$requestFactory = $callable; } @@ -563,8 +561,7 @@ public function overrideGlobals() * * You should only list the reverse proxies that you manage directly. * - * @param array $proxies A list of trusted proxies - * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies + * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies * * @throws \InvalidArgumentException When $trustedHeaderSet is invalid */ @@ -598,8 +595,6 @@ public static function getTrustedHeaderSet() * Sets a list of trusted host patterns. * * You should only list the hosts you manage using regexs. - * - * @param array $hostPatterns A list of trusted host patterns */ public static function setTrustedHosts(array $hostPatterns) { @@ -626,11 +621,9 @@ public static function getTrustedHosts() * It builds a normalized query string, where keys/value pairs are alphabetized, * have consistent escaping and unneeded delimiters are removed. * - * @param string $qs Query string - * * @return string A normalized query string for the Request */ - public static function normalizeQueryString($qs) + public static function normalizeQueryString(?string $qs) { if ('' == $qs) { return ''; @@ -677,12 +670,11 @@ public static function getHttpMethodParameterOverride() * * Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY * - * @param string $key The key - * @param mixed $default The default value if the parameter key does not exist + * @param mixed $default The default value if the parameter key does not exist * * @return mixed */ - public function get($key, $default = null) + public function get(string $key, $default = null) { if ($this !== $result = $this->attributes->get($key, $this)) { return $result; @@ -1024,11 +1016,9 @@ public function getUri() /** * Generates a normalized URI for the given path. * - * @param string $path A path to use instead of the current one - * * @return string The normalized URI for the path */ - public function getUriForPath($path) + public function getUriForPath(string $path) { return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; } @@ -1048,11 +1038,9 @@ public function getUriForPath($path) * - "/a/b/c/other" -> "other" * - "/a/x/y" -> "../../x/y" * - * @param string $path The target path - * * @return string The relative target path */ - public function getRelativeUriForPath($path) + public function getRelativeUriForPath(string $path) { // be sure that we are dealing with an absolute path if (!isset($path[0]) || '/' !== $path[0]) { @@ -1190,10 +1178,8 @@ public function getHost() /** * Sets the request method. - * - * @param string $method */ - public function setMethod($method) + public function setMethod(string $method) { $this->method = null; $this->server->set('REQUEST_METHOD', $method); @@ -1264,11 +1250,9 @@ public function getRealMethod() /** * Gets the mime type associated with the format. * - * @param string $format The format - * * @return string|null The associated mime type (null if not found) */ - public function getMimeType($format) + public function getMimeType(string $format) { if (null === static::$formats) { static::initializeFormats(); @@ -1280,11 +1264,9 @@ public function getMimeType($format) /** * Gets the mime types associated with the format. * - * @param string $format The format - * * @return array The associated mime types */ - public static function getMimeTypes($format) + public static function getMimeTypes(string $format) { if (null === static::$formats) { static::initializeFormats(); @@ -1296,11 +1278,9 @@ public static function getMimeTypes($format) /** * Gets the format associated with the mime type. * - * @param string $mimeType The associated mime type - * * @return string|null The format (null if not found) */ - public function getFormat($mimeType) + public function getFormat(?string $mimeType) { $canonicalMimeType = null; if (false !== $pos = strpos($mimeType, ';')) { @@ -1324,10 +1304,9 @@ public function getFormat($mimeType) /** * Associates a format with mime types. * - * @param string $format The format * @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) */ - public function setFormat($format, $mimeTypes) + public function setFormat(?string $format, $mimeTypes) { if (null === static::$formats) { static::initializeFormats(); @@ -1347,11 +1326,9 @@ public function setFormat($format, $mimeTypes) * * @see getPreferredFormat * - * @param string|null $default The default format - * * @return string|null The request format */ - public function getRequestFormat($default = 'html') + public function getRequestFormat(?string $default = 'html') { if (null === $this->format) { $this->format = $this->attributes->get('_format'); @@ -1362,10 +1339,8 @@ public function getRequestFormat($default = 'html') /** * Sets the request format. - * - * @param string $format The request format */ - public function setRequestFormat($format) + public function setRequestFormat(?string $format) { $this->format = $format; } @@ -1382,10 +1357,8 @@ public function getContentType() /** * Sets the default locale. - * - * @param string $locale */ - public function setDefaultLocale($locale) + public function setDefaultLocale(string $locale) { $this->defaultLocale = $locale; @@ -1406,10 +1379,8 @@ public function getDefaultLocale() /** * Sets the locale. - * - * @param string $locale */ - public function setLocale($locale) + public function setLocale(string $locale) { $this->setPhpDefaultLocale($this->locale = $locale); } @@ -1427,11 +1398,9 @@ public function getLocale() /** * Checks if the request method is of specified type. * - * @param string $method Uppercase request method (GET, POST etc) - * * @return bool */ - public function isMethod($method) + public function isMethod(string $method) { return $this->getMethod() === strtoupper($method); } @@ -1497,13 +1466,11 @@ public function getProtocolVersion() /** * Returns the request body content. * - * @param bool $asResource If true, a resource will be returned - * * @return string|resource The request body content or a resource to read the body stream * * @throws \LogicException */ - public function getContent($asResource = false) + public function getContent(bool $asResource = false) { $currentContentIsResource = \is_resource($this->content); @@ -1586,8 +1553,6 @@ public function getPreferredFormat(?string $default = 'html'): ?string /** * Returns the preferred language. * - * @param array $locales An array of ordered available locales - * * @return string|null The preferred locale */ public function getPreferredLanguage(array $locales = null) diff --git a/src/Symfony/Component/HttpFoundation/RequestMatcher.php b/src/Symfony/Component/HttpFoundation/RequestMatcher.php index d79c7f2ea2929..4256c0c870872 100644 --- a/src/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/src/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -54,11 +54,8 @@ class RequestMatcher implements RequestMatcherInterface private $schemes = []; /** - * @param string|null $path - * @param string|null $host * @param string|string[]|null $methods * @param string|string[]|null $ips - * @param array $attributes * @param string|string[]|null $schemes */ public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null, int $port = null) @@ -87,18 +84,14 @@ public function matchScheme($scheme) /** * Adds a check for the URL host name. - * - * @param string|null $regexp A Regexp */ - public function matchHost($regexp) + public function matchHost(string $regexp = null) { $this->host = $regexp; } /** * Adds a check for the the URL port. - * - * @param int|null $port The port number to connect to */ public function matchPort(int $port = null) { @@ -107,10 +100,8 @@ public function matchPort(int $port = null) /** * Adds a check for the URL path info. - * - * @param string|null $regexp A Regexp */ - public function matchPath($regexp) + public function matchPath(string $regexp = null) { $this->path = $regexp; } @@ -120,7 +111,7 @@ public function matchPath($regexp) * * @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 */ - public function matchIp($ip) + public function matchIp(string $ip) { $this->matchIps($ip); } @@ -147,11 +138,8 @@ public function matchMethod($method) /** * Adds a check for request attribute. - * - * @param string $key The request attribute name - * @param string $regexp A Regexp */ - public function matchAttribute($key, $regexp) + public function matchAttribute(string $key, string $regexp) { $this->attributes[$key] = $regexp; } diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 57b90adc49794..aac6d2f00c080 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -191,7 +191,7 @@ class Response /** * @throws \InvalidArgumentException When the HTTP status code is not valid */ - public function __construct($content = '', int $status = 200, array $headers = []) + public function __construct(?string $content = '', int $status = 200, array $headers = []) { $this->headers = new ResponseHeaderBag($headers); $this->setContent($content); @@ -209,11 +209,10 @@ public function __construct($content = '', int $status = 200, array $headers = [ * * @param mixed $content The response content, see setContent() * @param int $status The response status code - * @param array $headers An array of response headers * * @return static */ - public static function create($content = '', $status = 200, $headers = []) + public static function create(?string $content = '', int $status = 200, array $headers = []) { return new static($content, $status, $headers); } @@ -384,19 +383,13 @@ public function send() * * Valid types are strings, numbers, null, and objects that implement a __toString() method. * - * @param mixed $content Content that can be cast to string - * * @return $this * * @throws \UnexpectedValueException */ - public function setContent($content) + public function setContent(?string $content) { - if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable([$content, '__toString'])) { - throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', \gettype($content))); - } - - $this->content = (string) $content; + $this->content = $content; return $this; } diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 377dadb24be8b..9aaf302db9457 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -108,7 +108,7 @@ public function all(string $key = null) /** * {@inheritdoc} */ - public function set($key, $values, $replace = true) + public function set(string $key, $values, bool $replace = true) { $uniqueKey = str_replace('_', '-', strtolower($key)); @@ -139,7 +139,7 @@ public function set($key, $values, $replace = true) /** * {@inheritdoc} */ - public function remove($key) + public function remove(string $key) { $uniqueKey = str_replace('_', '-', strtolower($key)); unset($this->headerNames[$uniqueKey]); @@ -164,7 +164,7 @@ public function remove($key) /** * {@inheritdoc} */ - public function hasCacheControlDirective($key) + public function hasCacheControlDirective(string $key) { return \array_key_exists($key, $this->computedCacheControl); } @@ -172,7 +172,7 @@ public function hasCacheControlDirective($key) /** * {@inheritdoc} */ - public function getCacheControlDirective($key) + public function getCacheControlDirective(string $key) { return \array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; } @@ -185,12 +185,8 @@ public function setCookie(Cookie $cookie) /** * Removes a cookie from the array, but does not unset it in the browser. - * - * @param string $name - * @param string $path - * @param string $domain */ - public function removeCookie($name, $path = '/', $domain = null) + public function removeCookie(string $name, ?string $path = '/', string $domain = null) { if (null === $path) { $path = '/'; @@ -214,13 +210,11 @@ public function removeCookie($name, $path = '/', $domain = null) /** * Returns an array with all cookies. * - * @param string $format - * * @return Cookie[] * * @throws \InvalidArgumentException When the $format is invalid */ - public function getCookies($format = self::COOKIES_FLAT) + public function getCookies(string $format = self::COOKIES_FLAT) { if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) { throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY]))); @@ -244,14 +238,8 @@ public function getCookies($format = self::COOKIES_FLAT) /** * Clears a cookie in the browser. - * - * @param string $name - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly */ - public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true) + public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true) { $this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, null)); } @@ -259,9 +247,9 @@ public function clearCookie($name, $path = '/', $domain = null, $secure = false, /** * @see HeaderUtils::makeDisposition() */ - public function makeDisposition($disposition, $filename, $filenameFallback = '') + public function makeDisposition(string $disposition, string $filename, string $filenameFallback = '') { - return HeaderUtils::makeDisposition((string) $disposition, (string) $filename, (string) $filenameFallback); + return HeaderUtils::makeDisposition($disposition, $filename, $filenameFallback); } /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php index ee33698cf0842..525917bf22a61 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php @@ -61,7 +61,7 @@ public function getStorageKey() /** * {@inheritdoc} */ - public function has($name) + public function has(string $name) { return \array_key_exists($name, $this->attributes); } @@ -69,7 +69,7 @@ public function has($name) /** * {@inheritdoc} */ - public function get($name, $default = null) + public function get(string $name, $default = null) { return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; } @@ -77,7 +77,7 @@ public function get($name, $default = null) /** * {@inheritdoc} */ - public function set($name, $value) + public function set(string $name, $value) { $this->attributes[$name] = $value; } @@ -104,7 +104,7 @@ public function replace(array $attributes) /** * {@inheritdoc} */ - public function remove($name) + public function remove(string $name) { $retval = null; if (\array_key_exists($name, $this->attributes)) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php index 0d8d17991be70..3c04089708b0a 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php @@ -23,29 +23,25 @@ interface AttributeBagInterface extends SessionBagInterface /** * Checks if an attribute is defined. * - * @param string $name The attribute name - * * @return bool true if the attribute is defined, false otherwise */ - public function has($name); + public function has(string $name); /** * Returns an attribute. * - * @param string $name The attribute name - * @param mixed $default The default value if not found + * @param mixed $default The default value if not found * * @return mixed */ - public function get($name, $default = null); + public function get(string $name, $default = null); /** * Sets an attribute. * - * @param string $name - * @param mixed $value + * @param mixed $value */ - public function set($name, $value); + public function set(string $name, $value); /** * Returns attributes. @@ -54,19 +50,12 @@ public function set($name, $value); */ public function all(); - /** - * Sets attributes. - * - * @param array $attributes Attributes - */ public function replace(array $attributes); /** * Removes an attribute. * - * @param string $name - * * @return mixed The removed value or null when it does not exist */ - public function remove($name); + public function remove(string $name); } diff --git a/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php b/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php index 162c4b5295849..9f10907e232e0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php @@ -21,10 +21,6 @@ class NamespacedAttributeBag extends AttributeBag { private $namespaceCharacter; - /** - * @param string $storageKey Session storage key - * @param string $namespaceCharacter Namespace character to use in keys - */ public function __construct(string $storageKey = '_sf2_attributes', string $namespaceCharacter = '/') { $this->namespaceCharacter = $namespaceCharacter; @@ -34,7 +30,7 @@ public function __construct(string $storageKey = '_sf2_attributes', string $name /** * {@inheritdoc} */ - public function has($name) + public function has(string $name) { // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is $attributes = $this->resolveAttributePath($name); @@ -50,7 +46,7 @@ public function has($name) /** * {@inheritdoc} */ - public function get($name, $default = null) + public function get(string $name, $default = null) { // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is $attributes = $this->resolveAttributePath($name); @@ -66,7 +62,7 @@ public function get($name, $default = null) /** * {@inheritdoc} */ - public function set($name, $value) + public function set(string $name, $value) { $attributes = &$this->resolveAttributePath($name, true); $name = $this->resolveKey($name); @@ -76,7 +72,7 @@ public function set($name, $value) /** * {@inheritdoc} */ - public function remove($name) + public function remove(string $name) { $retval = null; $attributes = &$this->resolveAttributePath($name); @@ -94,12 +90,9 @@ public function remove($name) * * This method allows structured namespacing of session attributes. * - * @param string $name Key name - * @param bool $writeContext Write context, default false - * * @return array */ - protected function &resolveAttributePath($name, $writeContext = false) + protected function &resolveAttributePath(string $name, bool $writeContext = false) { $array = &$this->attributes; $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name; @@ -144,11 +137,9 @@ protected function &resolveAttributePath($name, $writeContext = false) * * This is the last part in a dot separated string. * - * @param string $name - * * @return string */ - protected function resolveKey($name) + protected function resolveKey(string $name) { if (false !== $pos = strrpos($name, $this->namespaceCharacter)) { $name = substr($name, $pos + 1); diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php index 6502f3d50155f..04a6dee4dae57 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php @@ -60,7 +60,7 @@ public function initialize(array &$flashes) /** * {@inheritdoc} */ - public function add($type, $message) + public function add(string $type, $message) { $this->flashes['new'][$type][] = $message; } @@ -68,7 +68,7 @@ public function add($type, $message) /** * {@inheritdoc} */ - public function peek($type, array $default = []) + public function peek(string $type, array $default = []) { return $this->has($type) ? $this->flashes['display'][$type] : $default; } @@ -84,7 +84,7 @@ public function peekAll() /** * {@inheritdoc} */ - public function get($type, array $default = []) + public function get(string $type, array $default = []) { $return = $default; @@ -122,7 +122,7 @@ public function setAll(array $messages) /** * {@inheritdoc} */ - public function set($type, $messages) + public function set(string $type, $messages) { $this->flashes['new'][$type] = (array) $messages; } @@ -130,7 +130,7 @@ public function set($type, $messages) /** * {@inheritdoc} */ - public function has($type) + public function has(string $type) { return \array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type]; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php index c6b7ce354cec4..f7bf1daf116e0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php @@ -54,7 +54,7 @@ public function initialize(array &$flashes) /** * {@inheritdoc} */ - public function add($type, $message) + public function add(string $type, $message) { $this->flashes[$type][] = $message; } @@ -62,7 +62,7 @@ public function add($type, $message) /** * {@inheritdoc} */ - public function peek($type, array $default = []) + public function peek(string $type, array $default = []) { return $this->has($type) ? $this->flashes[$type] : $default; } @@ -78,7 +78,7 @@ public function peekAll() /** * {@inheritdoc} */ - public function get($type, array $default = []) + public function get(string $type, array $default = []) { if (!$this->has($type)) { return $default; @@ -105,7 +105,7 @@ public function all() /** * {@inheritdoc} */ - public function set($type, $messages) + public function set(string $type, $messages) { $this->flashes[$type] = (array) $messages; } @@ -121,7 +121,7 @@ public function setAll(array $messages) /** * {@inheritdoc} */ - public function has($type) + public function has(string $type) { return \array_key_exists($type, $this->flashes) && $this->flashes[$type]; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php index 99e8074214b62..8713e71d0f62e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php @@ -23,18 +23,16 @@ interface FlashBagInterface extends SessionBagInterface /** * Adds a flash message for the given type. * - * @param string $type - * @param mixed $message + * @param mixed $message */ - public function add($type, $message); + public function add(string $type, $message); /** * Registers one or more messages for a given type. * - * @param string $type * @param string|array $messages */ - public function set($type, $messages); + public function set(string $type, $messages); /** * Gets flash messages for a given type. @@ -44,7 +42,7 @@ public function set($type, $messages); * * @return array */ - public function peek($type, array $default = []); + public function peek(string $type, array $default = []); /** * Gets all flash messages. @@ -56,12 +54,11 @@ public function peekAll(); /** * Gets and clears flash from the stack. * - * @param string $type - * @param array $default Default value if $type does not exist + * @param array $default Default value if $type does not exist * * @return array */ - public function get($type, array $default = []); + public function get(string $type, array $default = []); /** * Gets and clears flashes from the stack. @@ -78,11 +75,9 @@ public function setAll(array $messages); /** * Has flash messages for a given type? * - * @param string $type - * * @return bool */ - public function has($type); + public function has(string $type); /** * Returns a list of all defined types. diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index eb1dc2af9759e..470bbfc2b2fd0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -55,7 +55,7 @@ public function start() /** * {@inheritdoc} */ - public function has($name) + public function has(string $name) { return $this->getAttributeBag()->has($name); } @@ -63,7 +63,7 @@ public function has($name) /** * {@inheritdoc} */ - public function get($name, $default = null) + public function get(string $name, $default = null) { return $this->getAttributeBag()->get($name, $default); } @@ -71,7 +71,7 @@ public function get($name, $default = null) /** * {@inheritdoc} */ - public function set($name, $value) + public function set(string $name, $value) { $this->getAttributeBag()->set($name, $value); } @@ -95,7 +95,7 @@ public function replace(array $attributes) /** * {@inheritdoc} */ - public function remove($name) + public function remove(string $name) { return $this->getAttributeBag()->remove($name); } @@ -168,7 +168,7 @@ public function isEmpty() /** * {@inheritdoc} */ - public function invalidate($lifetime = null) + public function invalidate(int $lifetime = null) { $this->storage->clear(); @@ -178,7 +178,7 @@ public function invalidate($lifetime = null) /** * {@inheritdoc} */ - public function migrate($destroy = false, $lifetime = null) + public function migrate(bool $destroy = false, int $lifetime = null) { return $this->storage->regenerate($destroy, $lifetime); } @@ -202,7 +202,7 @@ public function getId() /** * {@inheritdoc} */ - public function setId($id) + public function setId(string $id) { if ($this->storage->getId() !== $id) { $this->storage->setId($id); @@ -220,7 +220,7 @@ public function getName() /** * {@inheritdoc} */ - public function setName($name) + public function setName(string $name) { $this->storage->setName($name); } @@ -246,7 +246,7 @@ public function registerBag(SessionBagInterface $bag) /** * {@inheritdoc} */ - public function getBag($name) + public function getBag(string $name) { $bag = $this->storage->getBag($name); diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php index 95fca857e2430..30f794eb365f9 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -38,10 +38,8 @@ public function getId(); /** * Sets the session ID. - * - * @param string $id */ - public function setId($id); + public function setId(string $id); /** * Returns the session name. @@ -52,10 +50,8 @@ public function getName(); /** * Sets the session name. - * - * @param string $name */ - public function setName($name); + public function setName(string $name); /** * Invalidates the current session. @@ -70,7 +66,7 @@ public function setName($name); * * @return bool True if session invalidated, false if error */ - public function invalidate($lifetime = null); + public function invalidate(int $lifetime = null); /** * Migrates the current session to a new session id while maintaining all @@ -84,7 +80,7 @@ public function invalidate($lifetime = null); * * @return bool True if session migrated, false if error */ - public function migrate($destroy = false, $lifetime = null); + public function migrate(bool $destroy = false, int $lifetime = null); /** * Force the session to be saved and closed. @@ -98,29 +94,25 @@ public function save(); /** * Checks if an attribute is defined. * - * @param string $name The attribute name - * * @return bool true if the attribute is defined, false otherwise */ - public function has($name); + public function has(string $name); /** * Returns an attribute. * - * @param string $name The attribute name - * @param mixed $default The default value if not found + * @param mixed $default The default value if not found * * @return mixed */ - public function get($name, $default = null); + public function get(string $name, $default = null); /** * Sets an attribute. * - * @param string $name - * @param mixed $value + * @param mixed $value */ - public function set($name, $value); + public function set(string $name, $value); /** * Returns attributes. @@ -129,21 +121,14 @@ public function set($name, $value); */ public function all(); - /** - * Sets attributes. - * - * @param array $attributes Attributes - */ public function replace(array $attributes); /** * Removes an attribute. * - * @param string $name - * * @return mixed The removed value or null when it does not exist */ - public function remove($name); + public function remove(string $name); /** * Clears all attributes. @@ -165,11 +150,9 @@ public function registerBag(SessionBagInterface $bag); /** * Gets a bag instance by name. * - * @param string $name - * * @return SessionBagInterface */ - public function getBag($name); + public function getBag(string $name); /** * Gets session meta. diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php index defca606efb2d..eaae2d03fe15a 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -42,26 +42,19 @@ public function open($savePath, $sessionName) } /** - * @param string $sessionId - * * @return string */ - abstract protected function doRead($sessionId); + abstract protected function doRead(string $sessionId); /** - * @param string $sessionId - * @param string $data - * * @return bool */ - abstract protected function doWrite($sessionId, $data); + abstract protected function doWrite(string $sessionId, string $data); /** - * @param string $sessionId - * * @return bool */ - abstract protected function doDestroy($sessionId); + abstract protected function doDestroy(string $sessionId); /** * {@inheritdoc} diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index f1bce4a35280c..6f5df61f4d87d 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -40,8 +40,6 @@ class MemcachedSessionHandler extends AbstractSessionHandler * * prefix: The prefix to use for the memcached keys in order to avoid collision * * expiretime: The time to live in seconds. * - * @param \Memcached $memcached A \Memcached instance - * * @throws \InvalidArgumentException When unsupported options are passed */ public function __construct(\Memcached $memcached, array $options = []) @@ -67,7 +65,7 @@ public function close() /** * {@inheritdoc} */ - protected function doRead($sessionId) + protected function doRead(string $sessionId) { return $this->memcached->get($this->prefix.$sessionId) ?: ''; } @@ -85,7 +83,7 @@ public function updateTimestamp($sessionId, $data) /** * {@inheritdoc} */ - protected function doWrite($sessionId, $data) + protected function doWrite(string $sessionId, string $data) { return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl); } @@ -93,7 +91,7 @@ protected function doWrite($sessionId, $data) /** * {@inheritdoc} */ - protected function doDestroy($sessionId) + protected function doDestroy(string $sessionId) { $result = $this->memcached->delete($this->prefix.$sessionId); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 53d9369e8d53b..7ee188acf6443 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -90,7 +90,7 @@ public function close() /** * {@inheritdoc} */ - protected function doDestroy($sessionId) + protected function doDestroy(string $sessionId) { $this->getCollection()->deleteOne([ $this->options['id_field'] => $sessionId, @@ -114,7 +114,7 @@ public function gc($maxlifetime) /** * {@inheritdoc} */ - protected function doWrite($sessionId, $data) + protected function doWrite(string $sessionId, string $data) { $expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000); @@ -154,7 +154,7 @@ public function updateTimestamp($sessionId, $data) /** * {@inheritdoc} */ - protected function doRead($sessionId) + protected function doRead(string $sessionId) { $dbData = $this->getCollection()->findOne([ $this->options['id_field'] => $sessionId, diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php index 8d193155b090f..603b682378777 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php @@ -37,7 +37,7 @@ public function validateId($sessionId) /** * {@inheritdoc} */ - protected function doRead($sessionId) + protected function doRead(string $sessionId) { return ''; } @@ -53,7 +53,7 @@ public function updateTimestamp($sessionId, $data) /** * {@inheritdoc} */ - protected function doWrite($sessionId, $data) + protected function doWrite(string $sessionId, string $data) { return true; } @@ -61,7 +61,7 @@ protected function doWrite($sessionId, $data) /** * {@inheritdoc} */ - protected function doDestroy($sessionId) + protected function doDestroy(string $sessionId) { return true; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 666d7e464de0f..a59ebab5f7929 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -299,7 +299,7 @@ public function gc($maxlifetime) /** * {@inheritdoc} */ - protected function doDestroy($sessionId) + protected function doDestroy(string $sessionId) { // delete the record associated with this id $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; @@ -320,7 +320,7 @@ protected function doDestroy($sessionId) /** * {@inheritdoc} */ - protected function doWrite($sessionId, $data) + protected function doWrite(string $sessionId, string $data) { $maxlifetime = (int) ini_get('session.gc_maxlifetime'); @@ -596,11 +596,9 @@ private function rollback() * We need to make sure we do not return session data that is already considered garbage according * to the session.gc_maxlifetime setting because gc() is called after read() and only sometimes. * - * @param string $sessionId Session ID - * * @return string The session data */ - protected function doRead($sessionId) + protected function doRead(string $sessionId) { if (self::LOCK_ADVISORY === $this->lockMode) { $this->unlockStatements[] = $this->doAdvisoryLock($sessionId); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php index c2e7d34dcfe09..38727fb536750 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php @@ -62,7 +62,7 @@ public function __construct($redis, array $options = []) /** * {@inheritdoc} */ - protected function doRead($sessionId): string + protected function doRead(string $sessionId): string { return $this->redis->get($this->prefix.$sessionId) ?: ''; } @@ -70,7 +70,7 @@ protected function doRead($sessionId): string /** * {@inheritdoc} */ - protected function doWrite($sessionId, $data): bool + protected function doWrite(string $sessionId, string $data): bool { $result = $this->redis->setEx($this->prefix.$sessionId, (int) ini_get('session.gc_maxlifetime'), $data); @@ -80,7 +80,7 @@ protected function doWrite($sessionId, $data): bool /** * {@inheritdoc} */ - protected function doDestroy($sessionId): bool + protected function doDestroy(string $sessionId): bool { $this->redis->del($this->prefix.$sessionId); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php index 83a1f2c063c05..07559fa234cd0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php @@ -43,7 +43,7 @@ public function open($savePath, $sessionName) /** * {@inheritdoc} */ - protected function doRead($sessionId) + protected function doRead(string $sessionId) { return $this->handler->read($sessionId); } @@ -59,7 +59,7 @@ public function updateTimestamp($sessionId, $data) /** * {@inheritdoc} */ - protected function doWrite($sessionId, $data) + protected function doWrite(string $sessionId, string $data) { return $this->handler->write($sessionId, $data); } @@ -78,7 +78,7 @@ public function destroy($sessionId) /** * {@inheritdoc} */ - protected function doDestroy($sessionId) + protected function doDestroy(string $sessionId) { $this->doDestroy = false; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php index ece3ff34f5dc4..f847d95e6960d 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php @@ -100,7 +100,7 @@ public function getLifetime() * to expire with browser session. Time is in seconds, and is * not a Unix timestamp. */ - public function stampNew($lifetime = null) + public function stampNew(int $lifetime = null) { $this->stampCreated($lifetime); } @@ -151,10 +151,8 @@ public function getName() /** * Sets name. - * - * @param string $name */ - public function setName($name) + public function setName(string $name) { $this->name = $name; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 37b6f145b87cc..4662bd864c944 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -94,7 +94,7 @@ public function start() /** * {@inheritdoc} */ - public function regenerate($destroy = false, $lifetime = null) + public function regenerate(bool $destroy = false, int $lifetime = null) { if (!$this->started) { $this->start(); @@ -117,7 +117,7 @@ public function getId() /** * {@inheritdoc} */ - public function setId($id) + public function setId(string $id) { if ($this->started) { throw new \LogicException('Cannot set session ID after the session has started.'); @@ -137,7 +137,7 @@ public function getName() /** * {@inheritdoc} */ - public function setName($name) + public function setName(string $name) { $this->name = $name; } @@ -183,7 +183,7 @@ public function registerBag(SessionBagInterface $bag) /** * {@inheritdoc} */ - public function getBag($name) + public function getBag(string $name) { if (!isset($this->bags[$name])) { throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 7916fa81914d1..d6ecbb93c9308 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -26,10 +26,6 @@ class MockFileSessionStorage extends MockArraySessionStorage { private $savePath; - /** - * @param string $savePath Path of directory to save session files - * @param string $name Session name - */ public function __construct(string $savePath = null, string $name = 'MOCKSESSID', MetadataBag $metaBag = null) { if (null === $savePath) { @@ -68,7 +64,7 @@ public function start() /** * {@inheritdoc} */ - public function regenerate($destroy = false, $lifetime = null) + public function regenerate(bool $destroy = false, int $lifetime = null) { if (!$this->started) { $this->start(); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index e5670f793463f..db47523f32947 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -96,10 +96,8 @@ class NativeSessionStorage implements SessionStorageInterface * sid_bits_per_character, "5" * trans_sid_hosts, $_SERVER['HTTP_HOST'] * trans_sid_tags, "a=href,area=href,frame=src,form=" - * - * @param \SessionHandlerInterface|null $handler */ - public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null) + public function __construct(array $options = [], \SessionHandlerInterface $handler = null, MetadataBag $metaBag = null) { if (!\extension_loaded('session')) { throw new \LogicException('PHP extension "session" is required.'); @@ -175,7 +173,7 @@ public function getId() /** * {@inheritdoc} */ - public function setId($id) + public function setId(string $id) { $this->saveHandler->setId($id); } @@ -191,7 +189,7 @@ public function getName() /** * {@inheritdoc} */ - public function setName($name) + public function setName(string $name) { $this->saveHandler->setName($name); } @@ -199,7 +197,7 @@ public function setName($name) /** * {@inheritdoc} */ - public function regenerate($destroy = false, $lifetime = null) + public function regenerate(bool $destroy = false, int $lifetime = null) { // Cannot regenerate the session ID for non-active sessions. if (\PHP_SESSION_ACTIVE !== session_status()) { @@ -303,7 +301,7 @@ public function registerBag(SessionBagInterface $bag) /** * {@inheritdoc} */ - public function getBag($name) + public function getBag(string $name) { if (!isset($this->bags[$name])) { throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); @@ -404,11 +402,9 @@ public function setOptions(array $options) * @see https://php.net/sessionhandler * @see https://github.com/zikula/NativeSession * - * @param \SessionHandlerInterface|null $saveHandler - * * @throws \InvalidArgumentException */ - public function setSaveHandler($saveHandler = null) + public function setSaveHandler(\SessionHandlerInterface $saveHandler = null) { if (!$saveHandler instanceof AbstractProxy && !$saveHandler instanceof \SessionHandlerInterface && diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index f0fac5843a254..4bee12f275d2b 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -18,10 +18,7 @@ */ class PhpBridgeSessionStorage extends NativeSessionStorage { - /** - * @param \SessionHandlerInterface|null $handler - */ - public function __construct($handler = null, MetadataBag $metaBag = null) + public function __construct(\SessionHandlerInterface $handler = null, MetadataBag $metaBag = null) { if (!\extension_loaded('session')) { throw new \LogicException('PHP extension "session" is required.'); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 09c92483c7575..cc6a5527726a2 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -81,11 +81,9 @@ public function getId() /** * Sets the session ID. * - * @param string $id - * * @throws \LogicException */ - public function setId($id) + public function setId(string $id) { if ($this->isActive()) { throw new \LogicException('Cannot change the ID of an active session'); @@ -107,11 +105,9 @@ public function getName() /** * Sets the session name. * - * @param string $name - * * @throws \LogicException */ - public function setName($name) + public function setName(string $name) { if ($this->isActive()) { throw new \LogicException('Cannot change the name of an active session'); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index eeb396a2f131c..03b7340c32188 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -46,10 +46,8 @@ public function getId(); /** * Sets the session ID. - * - * @param string $id */ - public function setId($id); + public function setId(string $id); /** * Returns the session name. @@ -60,10 +58,8 @@ public function getName(); /** * Sets the session name. - * - * @param string $name */ - public function setName($name); + public function setName(string $name); /** * Regenerates id that represents this storage. @@ -94,7 +90,7 @@ public function setName($name); * * @throws \RuntimeException If an error occurs while regenerating this storage */ - public function regenerate($destroy = false, $lifetime = null); + public function regenerate(bool $destroy = false, int $lifetime = null); /** * Force the session to be saved and closed. @@ -117,13 +113,11 @@ public function clear(); /** * Gets a SessionBagInterface by name. * - * @param string $name - * * @return SessionBagInterface * * @throws \InvalidArgumentException If the bag does not exist */ - public function getBag($name); + public function getBag(string $name); /** * Registers a SessionBagInterface for use. diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 8310ea72d6c12..ea98ef7a92e08 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -30,11 +30,6 @@ class StreamedResponse extends Response protected $streamed; private $headersSent; - /** - * @param callable|null $callback A valid PHP callback or null to set it later - * @param int $status The response status code - * @param array $headers An array of response headers - */ public function __construct(callable $callback = null, int $status = 200, array $headers = []) { parent::__construct(null, $status, $headers); @@ -49,13 +44,9 @@ public function __construct(callable $callback = null, int $status = 200, array /** * Factory method for chainability. * - * @param callable|null $callback A valid PHP callback or null to set it later - * @param int $status The response status code - * @param array $headers An array of response headers - * * @return static */ - public static function create($callback = null, $status = 200, $headers = []) + public static function create($callback = null, int $status = 200, array $headers = []) { return new static($callback, $status, $headers); } @@ -63,8 +54,6 @@ public static function create($callback = null, $status = 200, $headers = []) /** * Sets the PHP callback associated with this Response. * - * @param callable $callback A valid PHP callback - * * @return $this */ public function setCallback(callable $callback) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php index 4e28b9ac97261..54c4fdaa07df6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php @@ -62,13 +62,6 @@ public function testSetTargetUrl() $this->assertEquals('baz.beep', $response->getTargetUrl()); } - public function testSetTargetUrlNull() - { - $this->expectException('InvalidArgumentException'); - $response = new RedirectResponse('foo.bar'); - $response->setTargetUrl(null); - } - public function testCreate() { $response = RedirectResponse::create('foo', 301); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 2ce17647bc037..37af34c423eac 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -901,16 +901,6 @@ public function testSetContent($content) $this->assertEquals((string) $content, $response->getContent()); } - /** - * @dataProvider invalidContentProvider - */ - public function testSetContentInvalid($content) - { - $this->expectException('UnexpectedValueException'); - $response = new Response(); - $response->setContent($content); - } - public function testSettersAreChainable() { $response = new Response(); @@ -952,15 +942,6 @@ public function validContentProvider() ]; } - public function invalidContentProvider() - { - return [ - 'obj' => [new \stdClass()], - 'array' => [[]], - 'bool' => [true, '1'], - ]; - } - protected function createDateTimeOneHourAgo() { return $this->createDateTimeNow()->sub(new \DateInterval('PT1H')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 17f46bef5e1a1..c846248adc6d8 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -199,13 +199,6 @@ public function testSessionOptions() $this->assertSame('200', ini_get('session.cache_expire')); } - public function testSetSaveHandlerException() - { - $this->expectException('InvalidArgumentException'); - $storage = $this->getStorage(); - $storage->setSaveHandler(new \stdClass()); - } - public function testSetSaveHandler() { $this->iniSet('session.save_handler', 'files');