merged branch adrienbrault/http-foundation-fixes (PR #4483)

Commits
-------

9a74b85 [HttpFoundation] CS and phpdoc fixes

Discussion
----------

[HttpFoundation] CS and phpdoc fixes

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

Hey

---------------------------------------------------------------------------

by travisbot at 2012-06-02T00:30:49Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1504379) (merged 2f0117f2 into 1541fe26).

---------------------------------------------------------------------------

by fabpot at 2012-06-25T14:53:18Z

@adrienbrault Can you have a look at my comments?

---------------------------------------------------------------------------

by adrienbrault at 2012-06-25T16:24:49Z

Done! Sorry for the delay

---------------------------------------------------------------------------

by travisbot at 2012-06-25T17:50:24Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1702850) (merged 9a74b851 into 58436de1).
This commit is contained in:
Fabien Potencier 2012-06-25 22:29:10 +02:00
commit 5a8e20643e
21 changed files with 60 additions and 48 deletions

View File

@ -72,6 +72,11 @@ class Cookie
$this->httpOnly = (Boolean) $httpOnly;
}
/**
* Returns the cookie as a string.
*
* @return string The cookie
*/
public function __toString()
{
$str = urlencode($this->getName()).'=';

View File

@ -30,12 +30,14 @@ class ExtensionGuesser implements ExtensionGuesserInterface
{
/**
* The singleton instance
*
* @var ExtensionGuesser
*/
static private $instance = null;
/**
* All registered ExtensionGuesserInterface instances
*
* @var array
*/
protected $guessers = array();
@ -83,7 +85,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
* value.
*
* @param string $mimeType The mime type
* @return string The guessed extension or NULL, if none could be guessed
* @return string The guessed extension or NULL, if none could be guessed
*/
public function guess($mimeType)
{

View File

@ -20,7 +20,7 @@ interface ExtensionGuesserInterface
* Makes a best guess for a file extension, given a mime type
*
* @param string $mimeType The mime type
* @return string The guessed extension or NULL, if none could be guessed
* @return string The guessed extension or NULL, if none could be guessed
*/
function guess($mimeType);
}

View File

@ -49,9 +49,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
}
/**
* Guesses the mime type of the file with the given path
*
* @see MimeTypeGuesserInterface::guess()
* {@inheritdoc}
*/
public function guess($path)
{

View File

@ -32,9 +32,7 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
}
/**
* Guesses the mime type of the file with the given path
*
* @see MimeTypeGuesserInterface::guess()
* {@inheritdoc}
*/
public function guess($path)
{

View File

@ -730,11 +730,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
);
/**
* Returns the extension based on the mime type.
*
* If the mime type is unknown, returns null.
*
* @return string|null The guessed extension or null if it cannot be guessed
* {@inheritdoc}
*/
public function guess($mimeType)
{

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
@ -34,12 +35,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
{
/**
* The singleton instance
*
* @var MimeTypeGuesser
*/
static private $instance = null;
/**
* All registered MimeTypeGuesserInterface instances
*
* @var array
*/
protected $guessers = array();

View File

@ -11,6 +11,9 @@
namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
/**
* Guesses the mime type of a file
*

View File

@ -199,7 +199,7 @@ class UploadedFile extends File
/**
* Returns the maximum size of an uploaded file as configured in php.ini
*
* @return type The maximum size of an uploaded file in bytes
* @return int The maximum size of an uploaded file in bytes
*/
static public function getMaxFilesize()
{

View File

@ -38,8 +38,7 @@ class FileBag extends ParameterBag
}
/**
* (non-PHPdoc)
* @see Symfony\Component\HttpFoundation\ParameterBag::replace()
* {@inheritdoc}
*
* @api
*/
@ -50,23 +49,21 @@ class FileBag extends ParameterBag
}
/**
* (non-PHPdoc)
* @see Symfony\Component\HttpFoundation\ParameterBag::set()
* {@inheritdoc}
*
* @api
*/
public function set($key, $value)
{
if (is_array($value) || $value instanceof UploadedFile) {
parent::set($key, $this->convertFileInformation($value));
} else {
if (!is_array($value) && !$value instanceof UploadedFile) {
throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
}
parent::set($key, $this->convertFileInformation($value));
}
/**
* (non-PHPdoc)
* @see Symfony\Component\HttpFoundation\ParameterBag::add()
* {@inheritdoc}
*
* @api
*/

View File

@ -94,6 +94,8 @@ class ParameterBag implements \IteratorAggregate, \Countable
* @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep If true, a path like foo[bar] will find deeper items
*
* @return mixed
*
* @api
*/
public function get($path, $default = null, $deep = false)

View File

@ -87,17 +87,17 @@ class Request
protected $content;
/**
* @var string
* @var array
*/
protected $languages;
/**
* @var string
* @var array
*/
protected $charsets;
/**
* @var string
* @var array
*/
protected $acceptableContentTypes;
@ -147,7 +147,7 @@ class Request
protected $defaultLocale = 'en';
/**
* @var string
* @var array
*/
static protected $formats;
@ -335,6 +335,8 @@ class Request
* @param array $files The FILES parameters
* @param array $server The SERVER parameters
*
* @return Request The duplicated request
*
* @api
*/
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
@ -470,9 +472,9 @@ class Request
* It is better to explicity get request parameters from the appropriate
* public property instead (query, request, attributes, ...).
*
* @param string $key the key
* @param mixed $default the default value
* @param type $deep is parameter deep in multidimensional array
* @param string $key the key
* @param mixed $default the default value
* @param Boolean $deep is parameter deep in multidimensional array
*
* @return mixed
*/
@ -555,6 +557,7 @@ class Request
return $cleanIpAddress;
}
}
return '';
}
}
@ -1093,6 +1096,9 @@ class Request
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY);
}
/**
* @return Boolean
*/
public function isNoCache()
{
return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma');

View File

@ -31,7 +31,7 @@ class RequestMatcher implements RequestMatcherInterface
private $host;
/**
* @var string
* @var array
*/
private $methods;

View File

@ -706,7 +706,7 @@ class Response
* When the responses TTL is <= 0, the response may not be served from cache without first
* revalidating with the origin.
*
* @return integer The TTL in seconds
* @return integer|null The TTL in seconds
*
* @api
*/

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\HttpFoundation\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
/**
* Interface for the session.
*

View File

@ -32,6 +32,7 @@ class FileSessionHandler implements \SessionHandlerInterface
* Constructor.
*
* @param string $savePath Path of directory to save session files.
* @param string $prefix
*/
public function __construct($savePath = null, $prefix = 'sess_')
{
@ -48,7 +49,7 @@ class FileSessionHandler implements \SessionHandlerInterface
}
/**
* {@inheritdoc]
* {@inheritdoc}
*/
public function open($savePath, $sessionName)
{
@ -56,7 +57,7 @@ class FileSessionHandler implements \SessionHandlerInterface
}
/**
* {@inheritdoc]
* {@inheritdoc}
*/
public function close()
{
@ -64,7 +65,7 @@ class FileSessionHandler implements \SessionHandlerInterface
}
/**
* {@inheritdoc]
* {@inheritdoc}
*/
public function read($id)
{
@ -74,7 +75,7 @@ class FileSessionHandler implements \SessionHandlerInterface
}
/**
* {@inheritdoc]
* {@inheritdoc}
*/
public function write($id, $data)
{
@ -82,7 +83,7 @@ class FileSessionHandler implements \SessionHandlerInterface
}
/**
* {@inheritdoc]
* {@inheritdoc}
*/
public function destroy($id)
{
@ -95,7 +96,7 @@ class FileSessionHandler implements \SessionHandlerInterface
}
/**
* {@inheritdoc]
* {@inheritdoc}
*/
public function gc($maxlifetime)
{

View File

@ -33,7 +33,6 @@ class MemcachedSessionHandler implements \SessionHandlerInterface
*/
private $ttl;
/**
* @var string Key prefix for shared environments.
*/

View File

@ -91,7 +91,7 @@ class NativeSessionStorage implements SessionStorageInterface
*
* @param array $options Session configuration options.
* @param object $handler SessionHandlerInterface.
* @param MetadataBag $handler MetadataBag.
* @param MetadataBag $metaBag MetadataBag.
*/
public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
{

View File

@ -58,7 +58,7 @@ abstract class AbstractProxy
/**
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
*
* @return bool
* @return Boolean
*/
public function isWrapper()
{
@ -68,7 +68,7 @@ abstract class AbstractProxy
/**
* Has a session started?
*
* @return bool
* @return Boolean
*/
public function isActive()
{
@ -78,7 +78,7 @@ abstract class AbstractProxy
/**
* Sets the active flag.
*
* @param bool $flag
* @param Boolean $flag
*/
public function setActive($flag)
{

View File

@ -32,7 +32,7 @@ class NativeProxy extends AbstractProxy
/**
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
*
* @return bool False.
* @return Boolean False.
*/
public function isWrapper()
{

View File

@ -72,7 +72,7 @@ class StreamedResponse extends Response
}
/**
* @{inheritdoc}
* {@inheritdoc}
*/
public function prepare(Request $request)
{
@ -86,7 +86,7 @@ class StreamedResponse extends Response
}
/**
* @{inheritdoc}
* {@inheritdoc}
*
* This method only sends the content once.
*/
@ -106,7 +106,7 @@ class StreamedResponse extends Response
}
/**
* @{inheritdoc}
* {@inheritdoc}
*
* @throws \LogicException when the content is not null
*/
@ -118,7 +118,7 @@ class StreamedResponse extends Response
}
/**
* @{inheritdoc}
* {@inheritdoc}
*
* @return false
*/