Merge branch 'master' into acl

This commit is contained in:
IamPersistent 2011-04-27 00:36:43 -07:00
commit 22fd08531c
47 changed files with 127 additions and 281 deletions

View File

@ -9,6 +9,8 @@ timeline closely anyway.
PR12 to beta1
-------------
* The `File::getWebPath()` and `File::rename()` methods have been removed.
* The `session` configuration has been refactored:
* The `class` option has been removed (use the `session.class` parameter

View File

@ -33,7 +33,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
/**
* Returns whether Doctrine 2 metadata exists for that class
*
* @return boolean
* @return Boolean
*/
protected function isMappedClass($class)
{

View File

@ -39,7 +39,6 @@ class Configuration implements ConfigurationInterface
->children()
->scalarNode('cache_warmer')->defaultValue(!$this->debug)->end()
->scalarNode('charset')->end()
->scalarNode('document_root')->end()
->scalarNode('error_handler')->end()
->scalarNode('exception_controller')->defaultValue('Symfony\\Bundle\\FrameworkBundle\\Controller\\ExceptionController::showAction')->end()
->scalarNode('ide')->defaultNull()->end()

View File

@ -65,10 +65,6 @@ class FrameworkExtension extends Extension
$container->setParameter('kernel.charset', $config['charset']);
}
if (isset($config['document_root'])) {
$container->setParameter('document_root', $config['document_root']);
}
if (isset($config['error_handler'])) {
if (false === $config['error_handler']) {
$container->getDefinition('error_handler')->setMethodCalls(array());

View File

@ -56,10 +56,6 @@ class FrameworkBundle extends Bundle
$this->container->get('error_handler');
}
if ($this->container->hasParameter('document_root')) {
File::setDocumentRoot($this->container->getParameter('document_root'));
}
if (file_exists($this->container->getParameter('kernel.cache_dir').'/autoload.php')) {
$classloader = new MapFileClassLoader($this->container->getParameter('kernel.cache_dir').'/autoload.php');
$classloader->register(true);

View File

@ -105,6 +105,6 @@ class GlobalVariables
*/
public function getDebug()
{
return (bool) $this->container->getParameter('kernel.debug');
return (Boolean) $this->container->getParameter('kernel.debug');
}
}

View File

@ -38,8 +38,8 @@ class Cookie
* @param string $expires The time the cookie expires
* @param string $path The path on the server in which the cookie will be available on
* @param string $domain The domain that the cookie is available
* @param bool $secure Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client
* @param bool $httponly The cookie httponly flag
* @param Boolean $secure Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client
* @param Boolean $httponly The cookie httponly flag
*
* @api
*/

View File

@ -126,7 +126,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
/**
* Checks if the node has a default value.
*
* @return boolean
* @return Boolean
*/
public function hasDefaultValue()
{

View File

@ -97,7 +97,7 @@ class PrototypedArrayNode extends ArrayNode
/**
* Checks if the node has a default value.
*
* @return boolean
* @return Boolean
*/
public function hasDefaultValue()
{

View File

@ -26,7 +26,7 @@ class OutputFormatter implements OutputFormatterInterface
/**
* Initializes console output formatter.
*
* @param boolean $decorated Whether this formatter should actually decorate strings
* @param Boolean $decorated Whether this formatter should actually decorate strings
* @param array $styles Array of "name => FormatterStyle" instance
*
* @api
@ -87,7 +87,7 @@ class OutputFormatter implements OutputFormatterInterface
*
* @param string $name
*
* @return boolean
* @return Boolean
*
* @api
*/
@ -217,7 +217,7 @@ class OutputFormatter implements OutputFormatterInterface
*
* @param string $string
*
* @return Symfony\Component\Console\Format\FormatterStyle|boolean false if string is not format string
* @return Symfony\Component\Console\Format\FormatterStyle|Boolean false if string is not format string
*/
private function createStyleFromString($string)
{

View File

@ -53,7 +53,7 @@ interface OutputFormatterInterface
*
* @param string $name
*
* @return boolean
* @return Boolean
*
* @api
*/

View File

@ -97,7 +97,7 @@ interface InputInterface
/**
* Is this input means interactive?
*
* @return bool
* @return Boolean
*/
function isInteractive();
}

View File

@ -20,7 +20,7 @@ class Alias
* Constructor.
*
* @param string $id Alias identifier
* @param boolean $public If this alias is public
* @param Boolean $public If this alias is public
*/
public function __construct($id, $public = true)
{
@ -31,7 +31,7 @@ class Alias
/**
* Checks if this DI Alias should be public or not.
*
* @return boolean
* @return Boolean
*/
public function isPublic()
{
@ -41,7 +41,7 @@ class Alias
/**
* Sets if this Alias is public.
*
* @param boolean $boolean If this Alias should be public
* @param Boolean $boolean If this Alias should be public
*/
public function setPublic($boolean)
{

View File

@ -36,7 +36,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
/**
* Constructor.
*
* @param boolean $onlyConstructorArguments Sets this Service Reference pass to ignore method calls
* @param Boolean $onlyConstructorArguments Sets this Service Reference pass to ignore method calls
*/
public function __construct($onlyConstructorArguments = false)
{

View File

@ -106,7 +106,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
* @param ContainerBuilder $container
* @param string $id
* @param Definition $definition
* @return boolean If the definition is inlineable
* @return Boolean If the definition is inlineable
*/
private function isInlinableDefinition(ContainerBuilder $container, $id, Definition $definition)
{

View File

@ -69,7 +69,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
* Processes arguments to determine invalid references.
*
* @param array $arguments An array of Reference objects
* @param boolean $inMethodCall
* @param Boolean $inMethodCall
*/
private function processArguments(array $arguments, $inMethodCall = false)
{

View File

@ -65,7 +65,7 @@ class ServiceReferenceGraphNode
/**
* Checks if the value of this node is an Alias.
*
* @return boolean True if the value is an Alias instance
* @return Boolean True if the value is an Alias instance
*/
public function isAlias()
{
@ -75,7 +75,7 @@ class ServiceReferenceGraphNode
/**
* Checks if the value of this node is a Definition.
*
* @return boolean True if the value is a Definition instance
* @return Boolean True if the value is a Definition instance
*/
public function isDefinition()
{

View File

@ -83,7 +83,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* Checks if we have an extension.
*
* @param string $name The name of the extension
* @return boolean If the extension exists
* @return Boolean If the extension exists
*/
public function hasExtension($name)
{

View File

@ -123,7 +123,7 @@ class GraphvizDumper extends Dumper
*
* @param string $id The service id used to find edges
* @param array $arguments An array of arguments
* @param boolean $required
* @param Boolean $required
* @param string $name
* @return array An array of edges
*/

View File

@ -330,7 +330,7 @@ class PhpDumper extends Dumper
*
* @param string $id
* @param Definition $definition
* @return boolean
* @return Boolean
*/
private function isSimpleInstance($id, $definition)
{
@ -913,7 +913,7 @@ EOF;
*
* @param string $id
* @param array $arguments
* @return boolean
* @return Boolean
*/
private function hasReference($id, array $arguments)
{
@ -936,7 +936,7 @@ EOF;
* Dumps values.
*
* @param array $value
* @param boolean $interpolate
* @param Boolean $interpolate
* @return string
*/
private function dumpValue($value, $interpolate = true)

View File

@ -61,7 +61,7 @@ class Reference
/**
* Returns true when this Reference is strict
*
* @return boolean
* @return Boolean
*/
public function isStrict()
{

View File

@ -16,7 +16,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* Transforms between a boolean and a string.
* Transforms between a Boolean and a string.
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
* @author Florian Eckerstorfer <florian@eckerstorfer.org>

View File

@ -37,7 +37,7 @@ class ResizeFormListener implements EventSubscriberInterface
private $type;
/**
* @var bool
* @var Boolean
*/
private $resizeOnBind;

View File

@ -28,7 +28,7 @@ class CheckboxType extends AbstractType
public function buildView(FormView $view, FormInterface $form)
{
$view->set('value', $form->getAttribute('value'));
$view->set('checked', (bool)$form->getData());
$view->set('checked', (Boolean) $form->getData());
}
public function getDefaultOptions(array $options)

View File

@ -28,7 +28,7 @@ class RadioType extends AbstractType
public function buildView(FormView $view, FormInterface $form)
{
$view->set('value', $form->getAttribute('value'));
$view->set('checked', (bool)$form->getData());
$view->set('checked', (Boolean) $form->getData());
if ($view->hasParent()) {
$view->set('name', $view->getParent()->get('name'));

View File

@ -44,7 +44,7 @@ interface CsrfProviderInterface
*
* @param string $pageId The page ID used when generating the CSRF token
* @param string $token The token supplied by the browser
* @return boolean Whether the token supplied by the browser is
* @return Boolean Whether the token supplied by the browser is
* correct
*/
public function isCsrfTokenValid($pageId, $token);

View File

@ -104,7 +104,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
/**
* Returns whether the form is empty
*
* @return boolean
* @return Boolean
*/
function isEmpty();

View File

@ -440,13 +440,6 @@ class File
'x-world/x-vrml' => 'wrl',
);
/**
* Stores the absolute path to the document root directory.
*
* @var string
*/
static protected $documentRoot;
/**
* The absolute path to the file without dots.
*
@ -454,30 +447,6 @@ class File
*/
protected $path;
/**
* Sets the path to the document root directory.
*
* @param string $documentRoot
*/
static public function setDocumentRoot($documentRoot)
{
if (!is_dir($documentRoot)) {
throw new \LogicException($documentRoot . ' is not a directory.');
}
self::$documentRoot = realpath($documentRoot);
}
/**
* Returns the path to the document root directory.
*
* @return string
*/
static public function getDocumentRoot()
{
return self::$documentRoot;
}
/**
* Constructs a new file from the given path.
*
@ -491,7 +460,7 @@ class File
throw new FileNotFoundException($path);
}
$this->path = $path;
$this->path = realpath($path);
}
/**
@ -501,7 +470,7 @@ class File
*/
public function __toString()
{
return null === $this->path ? '' : $this->path;
return (string) $this->path;
}
/**
@ -522,7 +491,7 @@ class File
public function getExtension()
{
if ($ext = pathinfo($this->getName(), PATHINFO_EXTENSION)) {
return '.' . $ext;
return '.'.$ext;
}
return '';
@ -531,19 +500,19 @@ class File
/**
* Returns the extension based on the mime type (with dot).
*
* If the mime type is unknown, the actual extension is returned instead.
* If the mime type is unknown, returns null.
*
* @return string
* @return string|null The guessed extension or null if it cannot be guessed
*/
public function getDefaultExtension()
public function guessExtension()
{
$type = $this->getMimeType();
if (isset(self::$defaultExtensions[$type])) {
return '.' . self::$defaultExtensions[$type];
return '.'.self::$defaultExtensions[$type];
}
return $this->getExtension();
return null;
}
/**
@ -566,26 +535,6 @@ class File
return $this->path;
}
/**
* Returns the path relative to the document root.
*
* You can set the document root using the static method setDocumentRoot().
* If the file is outside of the document root, this method returns an
* empty string.
*
* @return string The relative file path
*/
public function getWebPath()
{
$root = self::$documentRoot;
if (false === strpos($this->path, $root)) {
return '';
}
return str_replace(array($root, DIRECTORY_SEPARATOR), array('', '/'), $this->path);
}
/**
* Returns the mime type of the file.
*
@ -618,16 +567,14 @@ class File
}
/**
* Moves the file to a new directory and gives it a new filename
* Moves the file to a new location.
*
* @param string $directory The new directory
* @param string $filename The new file name
*
* @throws FileException When the file could not be moved
* @param string $directory The destination folder
* @param string $name The new file name
*/
protected function doMove($directory, $filename)
public function move($directory, $name = null)
{
$newPath = $directory . DIRECTORY_SEPARATOR . $filename;
$newPath = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getName() : $name);
if (!@rename($this->getPath(), $newPath)) {
$error = error_get_last();
@ -636,29 +583,4 @@ class File
$this->path = realpath($newPath);
}
/**
* Moves the file to a new location.
*
* @param string $directory The destination folder
* @param string $name The new file name
*/
public function move($directory, $name = null)
{
$this->doMove($directory, $this->getName());
if (null !== $name) {
$this->rename($name);
}
}
/**
* Renames the file.
*
* @param string $name The new file name
*/
public function rename($name)
{
$this->doMove($this->getDirectory(), $name);
}
}

View File

@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
* @author Florian Eckerstorfer <florian@eckerstorfer.org>
* @author Fabien Potencier <fabien@symfony.com>
*/
class UploadedFile extends File
{
@ -105,13 +106,33 @@ class UploadedFile extends File
}
/**
* Returns the absolute file name without dots.
*
* @return string The file path
* @inheritDoc
*/
public function getName()
public function getExtension()
{
return $this->moved ? parent::getName() : $this->originalName;
if ($this->moved) {
return parent::getExtension();
}
if ($ext = pathinfo($this->getOriginalName(), PATHINFO_EXTENSION)) {
return '.'.$ext;
}
return '';
}
/**
* Gets the original uploaded name.
*
* Warning: This name is not safe as it can have been manipulated by the end-user.
* Moreover, it can contain characters that are not allowed in file names.
* Never use it in a path.
*
* @return string
*/
public function getOriginalName()
{
return $this->originalName;
}
/**
@ -137,70 +158,23 @@ class UploadedFile extends File
return $this->error === UPLOAD_ERR_OK;
}
/**
* Returns true if the size of the uploaded file exceeds the
* upload_max_filesize directive in php.ini
*
* @return Boolean
*/
protected function isIniSizeExceeded()
{
return $this->error === UPLOAD_ERR_INI_SIZE;
}
/**
* Returns true if the size of the uploaded file exceeds the
* MAX_FILE_SIZE directive specified in the HTML form
*
* @return Boolean
*/
protected function isFormSizeExceeded()
{
return $this->error === UPLOAD_ERR_FORM_SIZE;
}
/**
* Returns true if the file was completely uploaded
*
* @return Boolean
*/
protected function isUploadComplete()
{
return $this->error !== UPLOAD_ERR_PARTIAL;
}
/**
* @inheritDoc
*/
protected function doMove($directory, $filename)
{
if ($this->moved) {
return parent::doMove($directory, $filename);
}
$newPath = $directory . DIRECTORY_SEPARATOR . $filename;
if (!move_uploaded_file($this->getPath(), $newPath)) {
throw new FileException(sprintf('Could not move file %s to %s', $this->getPath(), $newPath));
}
$this->moved = true;
$this->path = realpath($newPath);
}
/**
* @inheritDoc
*/
public function move($directory, $name = null)
{
if ($this->moved) {
return parent::move($directory, $name);
return parent::doMove($directory, $name);
}
$this->doMove($directory, $this->originalName);
$newPath = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getName() : $name);
if (null !== $name) {
$this->rename($name);
if (!@move_uploaded_file($this->getPath(), $newPath)) {
$error = error_get_last();
throw new FileException(sprintf('Could not move file %s to %s (%s)', $this->getPath(), $newPath, strip_tags($error['message'])));
}
$this->moved = true;
$this->path = realpath($newPath);
}
}

View File

@ -133,7 +133,8 @@ class FileBag extends ParameterBag
foreach (array_keys($data['name']) as $key) {
$files[$key] = $this->fixPhpFilesArray(array(
'error' => $data['error'][$key],
'name' => $data['name'][$key], 'type' => $data['type'][$key],
'name' => $data['name'][$key],
'type' => $data['type'][$key],
'tmp_name' => $data['tmp_name'][$key],
'size' => $data['size'][$key]
));

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation;
use Symfony\Component\HttpFoundation\SessionStorage\NativeSessionStorage;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Request represents an HTTP request.

View File

@ -188,7 +188,7 @@ class FullTransformer
* Check if the first char of a string is a single quote
*
* @param string $quoteMatch The string to check
* @return bool true if matches, false otherwise
* @return Boolean true if matches, false otherwise
*/
public function isQuoteMatch($quoteMatch)
{
@ -257,7 +257,7 @@ class FullTransformer
*
* @param DateTime $dateTime The DateTime object to be used to calculate the timestamp
* @param array $options An array with the matched values to be used to calculate the timestamp
* @return bool|int The calculated timestamp or false if matched date is invalid
* @return Boolean|int The calculated timestamp or false if matched date is invalid
*/
protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
{

View File

@ -98,7 +98,7 @@ class StubCollator
* StubCollator::SORT_REGULAR - compare items normally (don't change types)
* StubCollator::SORT_NUMERIC - compare items numerically
* StubCollator::SORT_STRING - compare items as strings
* @return bool True on success or false on failure
* @return Boolean True on success or false on failure
*/
public function asort(&$array, $sortFlag = self::SORT_REGULAR)
{
@ -118,7 +118,7 @@ class StubCollator
*
* @param string $str1 The first string to compare
* @param string $str2 The second string to compare
* @return bool|int Return the comparison result or false on failure:
* @return Boolean|int Return the comparison result or false on failure:
* 1 if $str1 is greater than $str2
* 0 if $str1 is equal than $str2
* -1 if $str1 is less than $str2
@ -134,7 +134,7 @@ class StubCollator
* Get a value of an integer collator attribute
*
* @param int $attr An attribute specifier, one of the attribute constants
* @return bool|int The attribute value on success or false on error
* @return Boolean|int The attribute value on success or false on error
* @see http://www.php.net/manual/en/collator.getattribute.php
* @throws MethodNotImplementedException
*/
@ -190,7 +190,7 @@ class StubCollator
/**
* Get current collator's strenght
*
* @return bool|int The current collator's strenght or false on failure
* @return Boolean|int The current collator's strenght or false on failure
* @see http://www.php.net/manual/en/collator.getstrength.php
* @throws MethodNotImplementedException
*/
@ -204,7 +204,7 @@ class StubCollator
*
* @param int $attr An attribute specifier, one of the attribute constants
* @param int $val The attribute value, one of the attribute value constants
* @return bool True on success or false on failure
* @return Boolean True on success or false on failure
* @see http://www.php.net/manual/en/collator.setattribute.php
* @throws MethodNotImplementedException
*/
@ -223,7 +223,7 @@ class StubCollator
* StubCollator::QUATERNARY
* StubCollator::IDENTICAL
* StubCollator::DEFAULT
* @return bool True on success or false on failure
* @return Boolean True on success or false on failure
* @see http://www.php.net/manual/en/collator.setstrength.php
* @throws MethodNotImplementedException
*/
@ -236,7 +236,7 @@ class StubCollator
* Sort array using specified collator and sort keys
*
* @param array &$arr Array of strings to sort
* @return bool True on success or false on failure
* @return Boolean True on success or false on failure
* @see http://www.php.net/manual/en/collator.sortwithsortkeys.php
* @throws MethodNotImplementedException
*/
@ -253,7 +253,7 @@ class StubCollator
* StubCollator::SORT_REGULAR
* StubCollator::SORT_NUMERIC
* StubCollator::SORT_STRING
* @return bool True on success or false on failure
* @return Boolean True on success or false on failure
* @see http://www.php.net/manual/en/collator.sort.php
* @throws MethodNotImplementedException
*/

View File

@ -90,7 +90,7 @@ class StubIntlDateFormatter
private $dateTimeZone;
/**
* @var bool
* @var Boolean
*/
private $unitializedTimeZoneId = false;
@ -320,7 +320,7 @@ class StubIntlDateFormatter
* Set the formatter's calendar
*
* @param string $calendar The calendar to use. Default is IntlDateFormatter::GREGORIAN.
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/intldateformatter.setcalendar.php
* @throws MethodNotImplementedException
*/
@ -337,8 +337,8 @@ class StubIntlDateFormatter
* patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or
* invalid values ("February 30th") are not accepted.
*
* @param bool $lenient Sets whether the parser is lenient or not, default is false (strict)
* @return bool true on success or false on failure
* @param Boolean $lenient Sets whether the parser is lenient or not, default is false (strict)
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/intldateformatter.setlenient.php
* @throws MethodNotImplementedException
*/
@ -351,7 +351,7 @@ class StubIntlDateFormatter
* Set the formatter's pattern
*
* @param string $pattern A pattern string in conformance with the ICU IntlDateFormatter documentation
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/intldateformatter.setpattern.php
* @see http://userguide.icu-project.org/formatparse/datetime
*/
@ -370,7 +370,7 @@ class StubIntlDateFormatter
* @param string $timeZoneId The time zone ID string of the time zone to use.
* If NULL or the empty string, the default time zone for the
* runtime is used.
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/intldateformatter.settimezoneid.php
*/
public function setTimeZoneId($timeZoneId)

View File

@ -369,7 +369,7 @@ class StubLocale
*
* @param array $langtag A list of the language tags to compare to locale
* @param string $locale The locale to use as the language range when matching
* @param bool $canonicalize If true, the arguments will be converted to canonical form before matching
* @param Boolean $canonicalize If true, the arguments will be converted to canonical form before matching
* @param string $default The locale to use if no match is found
* @see http://www.php.net/manual/en/locale.lookup.php
* @throws RuntimeException When the intl extension is not loaded
@ -396,7 +396,7 @@ class StubLocale
* Sets the default runtime locale
*
* @param string $locale The locale code
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/locale.parselocale.php
* @throws MethodNotImplementedException
*/

View File

@ -292,7 +292,7 @@ class StubNumberFormatter
*
* @param number $value The value to format
* @param int $type Type of the formatting, one of the format type constants
* @return bool|string The formatted value or false on error
* @return Boolean|string The formatted value or false on error
* @see http://www.php.net/manual/en/numberformatter.format.php
* @throws RuntimeException If the method is called with the class $style 'CURRENCY'
* @throws MethodArgumentNotImplementedException If the $type is different than TYPE_DEFAULT
@ -327,7 +327,7 @@ class StubNumberFormatter
* Returns an attribute value
*
* @param int $attr An attribute specifier, one of the numeric attribute constants
* @return bool|int The attribute value on success or false on error
* @return Boolean|int The attribute value on success or false on error
* @see http://www.php.net/manual/en/numberformatter.getattribute.php
*/
public function getAttribute($attr)
@ -372,7 +372,7 @@ class StubNumberFormatter
/**
* Returns the formatter's pattern
*
* @return bool|string The pattern string used by the formatter or false on error
* @return Boolean|string The pattern string used by the formatter or false on error
* @see http://www.php.net/manual/en/numberformatter.getpattern.php
* @throws MethodNotImplementedException
*/
@ -385,7 +385,7 @@ class StubNumberFormatter
* Returns a formatter symbol value
*
* @param int $attr A symbol specifier, one of the format symbol constants
* @return bool|string The symbol value or false on error
* @return Boolean|string The symbol value or false on error
* @see http://www.php.net/manual/en/numberformatter.getsymbol.php
* @throws MethodNotImplementedException
*/
@ -398,7 +398,7 @@ class StubNumberFormatter
* Returns a formatter text attribute value
*
* @param int $attr An attribute specifier, one of the text attribute constants
* @return bool|string The attribute value or false on error
* @return Boolean|string The attribute value or false on error
* @see http://www.php.net/manual/en/numberformatter.gettextattribute.php
* @throws MethodNotImplementedException
*/
@ -413,7 +413,7 @@ class StubNumberFormatter
* @param string $value The value to parse
* @param string $currency Parameter to receive the currency name (reference)
* @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended
* @return bool|string The parsed numeric value of false on error
* @return Boolean|string The parsed numeric value of false on error
* @see http://www.php.net/manual/en/numberformatter.parsecurrency.php
* @throws MethodNotImplementedException
*/
@ -428,7 +428,7 @@ class StubNumberFormatter
* @param string $value The value to parse
* @param string $type Type of the formatting, one of the format type constants. NumberFormatter::TYPE_DOUBLE by default
* @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended
* @return bool|string The parsed value of false on error
* @return Boolean|string The parsed value of false on error
* @see http://www.php.net/manual/en/numberformatter.parse.php
* @throws MethodArgumentValueNotImplementedException When $type equals to TYPE_INT64, behavior not implemented
* @throws MethodArgumentNotImplementedException When $position different than null, behavior not implemented
@ -468,7 +468,7 @@ class StubNumberFormatter
*
* @param int $attr An attribute specifier, one of the numeric attribute constants
* @param int $value The attribute value
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/numberformatter.setattribute.php
* @throws MethodArgumentValueNotImplementedException When the $attr is not supported
* @throws MethodArgumentValueNotImplementedException When the $value is not supported
@ -510,7 +510,7 @@ class StubNumberFormatter
* Set the formatter's pattern
*
* @param string $pattern A pattern string in conformance with the ICU DecimalFormat documentation
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/numberformatter.setpattern.php
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
* @throws MethodNotImplementedException
@ -525,7 +525,7 @@ class StubNumberFormatter
*
* @param int $attr A symbol specifier, one of the format symbol constants
* @param string $value The value for the symbol
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/numberformatter.setsymbol.php
* @throws MethodNotImplementedException
*/
@ -539,7 +539,7 @@ class StubNumberFormatter
*
* @param int $attr An attribute specifier, one of the text attribute constants
* @param int $value The attribute value
* @return bool true on success or false on failure
* @return Boolean true on success or false on failure
* @see http://www.php.net/manual/en/numberformatter.settextattribute.php
* @throws MethodNotImplementedException
*/
@ -674,7 +674,7 @@ class StubNumberFormatter
* Check if the attribute is initialized (value set by client code).
*
* @param string $attr The attribute name
* @return bool true if the value was set by cliente, false otherwise
* @return Boolean true if the value was set by cliente, false otherwise
*/
private function isInitializedAttribute($attr)
{
@ -719,7 +719,7 @@ class StubNumberFormatter
* Check if the rounding mode is invalid.
*
* @param int $value The rounding mode value to check
* @return bool true if the rounding mode is invalid, false otherwise
* @return Boolean true if the rounding mode is invalid, false otherwise
*/
private function isInvalidRoundingMode($value)
{
@ -732,13 +732,13 @@ class StubNumberFormatter
/**
* Returns the normalized value for the GROUPING_USED attribute. Any value that can be converted to int will be
* cast to boolean and then to int again. This way, negative values are converted to 1 and string values to 0.
* cast to Boolean and then to int again. This way, negative values are converted to 1 and string values to 0.
*
* @param mixed $value The value to be normalized
* @return int The normalized value for the attribute (0 or 1)
*/
private function normalizeGroupingUsedValue($value) {
return (int) (bool) (int) $value;
return (int) (Boolean) (int) $value;
}
/**

View File

@ -53,7 +53,7 @@ class SecurityContext implements SecurityContextInterface
* @throws AuthenticationCredentialsNotFoundException when the security context has no authentication token.
* @param mixed $attributes
* @param mixed|null $object
* @return boolean
* @return Boolean
*/
public final function isGranted($attributes, $object = null)
{

View File

@ -35,7 +35,7 @@ interface SecurityContextInterface
*
* @param array $attributes
* @param mixed $object
* @return boolean
* @return Boolean
*/
function isGranted($attributes, $object = null);
}

View File

@ -201,7 +201,7 @@ class XmlEncoder extends AbstractEncoder implements DecoderInterface
*
* @param DOMNode $parentNode
* @param array|object $data data
* @return bool
* @return Boolean
*/
private function buildXml($parentNode, $data)
{

View File

@ -87,7 +87,7 @@ class ValidatorFactory implements ValidatorContextInterface
* @param array $mappingFiles A list of XML or YAML file names
* where mapping information can be
* found. Can be empty.
* @param boolean $annotations Whether to use annotations for
* @param Boolean $annotations Whether to use annotations for
* retrieving mapping information
* @param array $annotationNamespaces The annotation namespaces used
* for finding the annotation classes.

View File

@ -227,7 +227,7 @@ class ChoiceTypeTest extends TypeTestCase
}
/*
* We need this functionality to create choice fields for boolean types,
* We need this functionality to create choice fields for Boolean types,
* e.g. false => 'No', true => 'Yes'
*/
public function testSetDataSingleNonExpandedAcceptsBoolean()

View File

@ -23,7 +23,6 @@ use Symfony\Component\Form\HiddenField;
use Symfony\Component\Form\Util\PropertyPath;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\ExecutionView;

View File

@ -33,28 +33,6 @@ class FileTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(__DIR__.'/Fixtures/test.gif', (string) $this->file);
}
public function testGetWebPathReturnsPathRelativeToDocumentRoot()
{
File::setDocumentRoot(__DIR__);
$this->assertEquals(__DIR__, File::getDocumentRoot());
$this->assertEquals('/Fixtures/test.gif', $this->file->getWebPath());
}
public function testGetWebPathReturnsEmptyPathIfOutsideDocumentRoot()
{
File::setDocumentRoot(__DIR__.'/Fixtures/directory');
$this->assertEquals('', $this->file->getWebPath());
}
public function testSetDocumentRootThrowsLogicExceptionWhenNotExists()
{
$this->setExpectedException('LogicException');
File::setDocumentRoot(__DIR__.'/Fixtures/not_here');
}
public function testGetNameReturnsNameWithExtension()
{
$this->assertEquals('test.gif', $this->file->getName());
@ -85,21 +63,21 @@ class FileTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('image/gif', $this->file->getMimeType());
}
public function testGetDefaultExtensionWithoutGuesser()
public function testGuessExtensionWithoutGuesser()
{
$file = new File(__DIR__.'/Fixtures/directory/.empty');
$this->assertEquals('.empty', $file->getDefaultExtension());
$this->assertEquals(null, $file->guessExtension());
}
public function testGetDefaultExtensionIsBasedOnMimeType()
public function testGuessExtensionIsBasedOnMimeType()
{
$file = new File(__DIR__.'/Fixtures/test');
$guesser = $this->createMockGuesser($file->getPath(), 'image/gif');
MimeTypeGuesser::getInstance()->register($guesser);
$this->assertEquals('.gif', $file->getDefaultExtension());
$this->assertEquals('.gif', $file->guessExtension());
}
public function testConstructWhenFileNotExists()
@ -189,25 +167,6 @@ class FileTest extends \PHPUnit_Framework_TestCase
@unlink($targetPath);
}
public function testRename()
{
$path = __DIR__.'/Fixtures/test.copy.gif';
$targetPath = realpath(__DIR__.'/Fixtures').DIRECTORY_SEPARATOR.'test.target.gif';
@unlink($path);
@unlink($targetPath);
copy(realpath(__DIR__.'/Fixtures/test.gif'), $path);
$file = new File($path);
$file->rename('test.target.gif');
$this->assertTrue(file_exists($targetPath));
$this->assertFalse(file_exists($path));
$this->assertEquals($targetPath, $file->getPath());
@unlink($path);
@unlink($targetPath);
}
protected function createMockGuesser($path, $mimeType)
{
$guesser = $this->getMock('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface');

View File

@ -77,6 +77,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase
null
);
$this->assertEquals('original.gif', $file->getName());
$this->assertEquals('test.gif', $file->getName());
}
}

View File

@ -12,7 +12,6 @@
namespace Symfony\Tests\Component\HttpFoundation;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class RequestTest extends \PHPUnit_Framework_TestCase
{

View File

@ -737,7 +737,7 @@ class KernelForTest extends Kernel
public function setIsBooted($value)
{
$this->booted = (bool) $value;
$this->booted = (Boolean) $value;
}
}

View File

@ -157,7 +157,7 @@ php: |
---
test: Boolean
brief: >
You can use 'true' and 'false' for boolean values.
You can use 'true' and 'false' for Boolean values.
yaml: |
Is Gus a Liar?: true
Do I rely on Gus for Sustenance?: false