Merge branch '2.8' into 3.1

* 2.8:
  fixed @return when returning this or static
  override property constraints in child class
  removed unneeded comment
  [Console] improved code coverage of Command class
  [FrameworkBundle] Make TemplateController working without the Templating component
  Only count on arrays or countables to avoid warnings in PHP 7.2
This commit is contained in:
Fabien Potencier 2016-12-27 11:43:25 +01:00
commit 4c453f617d
87 changed files with 528 additions and 389 deletions

View File

@ -42,7 +42,7 @@ class Scope
/** /**
* Opens a new child scope. * Opens a new child scope.
* *
* @return Scope * @return self
*/ */
public function enter() public function enter()
{ {
@ -52,7 +52,7 @@ class Scope
/** /**
* Closes current scope and returns parent one. * Closes current scope and returns parent one.
* *
* @return Scope|null * @return self|null
*/ */
public function leave() public function leave()
{ {
@ -67,7 +67,7 @@ class Scope
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
* *
* @return Scope Current scope * @return $this
* *
* @throws \LogicException * @throws \LogicException
*/ */

View File

@ -36,8 +36,13 @@ class TemplateController implements ContainerAwareInterface
*/ */
public function templateAction($template, $maxAge = null, $sharedAge = null, $private = null) public function templateAction($template, $maxAge = null, $sharedAge = null, $private = null)
{ {
/** @var $response \Symfony\Component\HttpFoundation\Response */ if ($this->container->has('templating')) {
$response = $this->container->get('templating')->renderResponse($template); $response = $this->container->get('templating')->renderResponse($template);
} elseif ($this->container->has('twig')) {
$response = new Response($this->container->get('twig')->render($template));
} else {
throw new \LogicException('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
}
if ($maxAge) { if ($maxAge) {
$response->setMaxAge($maxAge); $response->setMaxAge($maxAge);

View File

@ -0,0 +1,69 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\TemplateController;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\HttpFoundation\Response;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class TemplateControllerTest extends TestCase
{
public function testTwig()
{
$twig = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
$twig->expects($this->once())->method('render')->willReturn('bar');
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container->expects($this->at(0))->method('has')->will($this->returnValue(false));
$container->expects($this->at(1))->method('has')->will($this->returnValue(true));
$container->expects($this->at(2))->method('get')->will($this->returnValue($twig));
$controller = new TemplateController();
$controller->setContainer($container);
$this->assertEquals('bar', $controller->templateAction('mytemplate')->getContent());
}
public function testTemplating()
{
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
$templating->expects($this->once())->method('renderResponse')->willReturn(new Response('bar'));
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container->expects($this->at(0))->method('has')->willReturn(true);
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
$controller = new TemplateController();
$controller->setContainer($container);
$this->assertEquals('bar', $controller->templateAction('mytemplate')->getContent());
}
/**
* @expectedException \LogicException
* @expectedExceptionMessage You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.
*/
public function testNoTwigNorTemplating()
{
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
$container->expects($this->at(0))->method('has')->willReturn(false);
$container->expects($this->at(1))->method('has')->willReturn(false);
$controller = new TemplateController();
$controller->setContainer($container);
$controller->templateAction('mytemplate')->getContent();
}
}

View File

@ -121,7 +121,7 @@ class Cookie
* @param string $cookie A Set-Cookie header value * @param string $cookie A Set-Cookie header value
* @param string $url The base URL * @param string $url The base URL
* *
* @return Cookie A Cookie instance * @return static
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */

View File

@ -86,7 +86,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* If this function has been called and the node is not set during the finalization * If this function has been called and the node is not set during the finalization
* phase, it's default value will be derived from its children default values. * phase, it's default value will be derived from its children default values.
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function addDefaultsIfNotSet() public function addDefaultsIfNotSet()
{ {
@ -102,7 +102,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* This method is applicable to prototype nodes only. * This method is applicable to prototype nodes only.
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function addDefaultChildrenIfNoneSet($children = null) public function addDefaultChildrenIfNoneSet($children = null)
{ {
@ -116,7 +116,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* This method is applicable to prototype nodes only. * This method is applicable to prototype nodes only.
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function requiresAtLeastOneElement() public function requiresAtLeastOneElement()
{ {
@ -130,7 +130,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* If used all keys have to be defined in the same configuration file. * If used all keys have to be defined in the same configuration file.
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function disallowNewKeysInSubsequentConfigs() public function disallowNewKeysInSubsequentConfigs()
{ {
@ -145,7 +145,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* @param string $singular The key to remap * @param string $singular The key to remap
* @param string $plural The plural of the key for irregular plurals * @param string $plural The plural of the key for irregular plurals
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function fixXmlConfig($singular, $plural = null) public function fixXmlConfig($singular, $plural = null)
{ {
@ -180,7 +180,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* @param string $name The name of the key * @param string $name The name of the key
* @param bool $removeKeyItem Whether or not the key item should be removed * @param bool $removeKeyItem Whether or not the key item should be removed
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function useAttributeAsKey($name, $removeKeyItem = true) public function useAttributeAsKey($name, $removeKeyItem = true)
{ {
@ -195,7 +195,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* @param bool $allow * @param bool $allow
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function canBeUnset($allow = true) public function canBeUnset($allow = true)
{ {
@ -217,7 +217,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* enableableArrayNode: {enabled: false, ...} # The config is disabled * enableableArrayNode: {enabled: false, ...} # The config is disabled
* enableableArrayNode: false # The config is disabled * enableableArrayNode: false # The config is disabled
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function canBeEnabled() public function canBeEnabled()
{ {
@ -247,7 +247,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* By default, the section is enabled. * By default, the section is enabled.
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function canBeDisabled() public function canBeDisabled()
{ {
@ -267,7 +267,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
/** /**
* Disables the deep merging of the node. * Disables the deep merging of the node.
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function performNoDeepMerging() public function performNoDeepMerging()
{ {
@ -287,7 +287,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* @param bool $remove Whether to remove the extra keys * @param bool $remove Whether to remove the extra keys
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function ignoreExtraKeys($remove = true) public function ignoreExtraKeys($remove = true)
{ {
@ -302,7 +302,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* @param bool $bool Whether to enable key normalization * @param bool $bool Whether to enable key normalization
* *
* @return ArrayNodeDefinition * @return $this
*/ */
public function normalizeKeys($bool) public function normalizeKeys($bool)
{ {
@ -324,7 +324,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* *
* @param NodeDefinition $node A NodeDefinition instance * @param NodeDefinition $node A NodeDefinition instance
* *
* @return ArrayNodeDefinition This node * @return $this
*/ */
public function append(NodeDefinition $node) public function append(NodeDefinition $node)
{ {

View File

@ -25,7 +25,7 @@ class EnumNodeDefinition extends ScalarNodeDefinition
/** /**
* @param array $values * @param array $values
* *
* @return EnumNodeDefinition|$this * @return $this
*/ */
public function values(array $values) public function values(array $values)
{ {

View File

@ -40,7 +40,7 @@ class ExprBuilder
* *
* @param \Closure $then * @param \Closure $then
* *
* @return ExprBuilder * @return $this
*/ */
public function always(\Closure $then = null) public function always(\Closure $then = null)
{ {
@ -60,7 +60,7 @@ class ExprBuilder
* *
* @param \Closure $closure * @param \Closure $closure
* *
* @return ExprBuilder * @return $this
*/ */
public function ifTrue(\Closure $closure = null) public function ifTrue(\Closure $closure = null)
{ {
@ -76,7 +76,7 @@ class ExprBuilder
/** /**
* Tests if the value is a string. * Tests if the value is a string.
* *
* @return ExprBuilder * @return $this
*/ */
public function ifString() public function ifString()
{ {
@ -88,7 +88,7 @@ class ExprBuilder
/** /**
* Tests if the value is null. * Tests if the value is null.
* *
* @return ExprBuilder * @return $this
*/ */
public function ifNull() public function ifNull()
{ {
@ -100,7 +100,7 @@ class ExprBuilder
/** /**
* Tests if the value is an array. * Tests if the value is an array.
* *
* @return ExprBuilder * @return $this
*/ */
public function ifArray() public function ifArray()
{ {
@ -114,7 +114,7 @@ class ExprBuilder
* *
* @param array $array * @param array $array
* *
* @return ExprBuilder * @return $this
*/ */
public function ifInArray(array $array) public function ifInArray(array $array)
{ {
@ -128,7 +128,7 @@ class ExprBuilder
* *
* @param array $array * @param array $array
* *
* @return ExprBuilder * @return $this
*/ */
public function ifNotInArray(array $array) public function ifNotInArray(array $array)
{ {
@ -142,7 +142,7 @@ class ExprBuilder
* *
* @param \Closure $closure * @param \Closure $closure
* *
* @return ExprBuilder * @return $this
*/ */
public function then(\Closure $closure) public function then(\Closure $closure)
{ {
@ -154,7 +154,7 @@ class ExprBuilder
/** /**
* Sets a closure returning an empty array. * Sets a closure returning an empty array.
* *
* @return ExprBuilder * @return $this
*/ */
public function thenEmptyArray() public function thenEmptyArray()
{ {
@ -170,7 +170,7 @@ class ExprBuilder
* *
* @param string $message * @param string $message
* *
* @return ExprBuilder * @return $this
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
@ -184,7 +184,7 @@ class ExprBuilder
/** /**
* Sets a closure unsetting this key of the array at validation time. * Sets a closure unsetting this key of the array at validation time.
* *
* @return ExprBuilder * @return $this
* *
* @throws UnsetKeyException * @throws UnsetKeyException
*/ */

View File

@ -37,7 +37,7 @@ class MergeBuilder
* *
* @param bool $allow * @param bool $allow
* *
* @return MergeBuilder * @return $this
*/ */
public function allowUnset($allow = true) public function allowUnset($allow = true)
{ {
@ -51,7 +51,7 @@ class MergeBuilder
* *
* @param bool $deny Whether the overwriting is forbidden or not * @param bool $deny Whether the overwriting is forbidden or not
* *
* @return MergeBuilder * @return $this
*/ */
public function denyOverwrite($deny = true) public function denyOverwrite($deny = true)
{ {

View File

@ -42,7 +42,7 @@ class NodeBuilder implements NodeParentInterface
* *
* @param ParentNodeDefinitionInterface $parent The parent node * @param ParentNodeDefinitionInterface $parent The parent node
* *
* @return NodeBuilder This node builder * @return $this
*/ */
public function setParent(ParentNodeDefinitionInterface $parent = null) public function setParent(ParentNodeDefinitionInterface $parent = null)
{ {
@ -182,7 +182,7 @@ class NodeBuilder implements NodeParentInterface
* *
* @param NodeDefinition $node * @param NodeDefinition $node
* *
* @return NodeBuilder This node builder * @return $this
*/ */
public function append(NodeDefinition $node) public function append(NodeDefinition $node)
{ {
@ -207,7 +207,7 @@ class NodeBuilder implements NodeParentInterface
* @param string $type The name of the type * @param string $type The name of the type
* @param string $class The fully qualified name the node definition class * @param string $class The fully qualified name the node definition class
* *
* @return NodeBuilder This node builder * @return $this
*/ */
public function setNodeClass($type, $class) public function setNodeClass($type, $class)
{ {

View File

@ -56,7 +56,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param NodeParentInterface $parent The parent * @param NodeParentInterface $parent The parent
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function setParent(NodeParentInterface $parent) public function setParent(NodeParentInterface $parent)
{ {
@ -70,7 +70,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param string $info The info text * @param string $info The info text
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function info($info) public function info($info)
{ {
@ -82,7 +82,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param string|array $example * @param string|array $example
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function example($example) public function example($example)
{ {
@ -95,7 +95,7 @@ abstract class NodeDefinition implements NodeParentInterface
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function attribute($key, $value) public function attribute($key, $value)
{ {
@ -146,7 +146,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param mixed $value The default value * @param mixed $value The default value
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function defaultValue($value) public function defaultValue($value)
{ {
@ -159,7 +159,7 @@ abstract class NodeDefinition implements NodeParentInterface
/** /**
* Sets the node as required. * Sets the node as required.
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function isRequired() public function isRequired()
{ {
@ -173,7 +173,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param mixed $value * @param mixed $value
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function treatNullLike($value) public function treatNullLike($value)
{ {
@ -187,7 +187,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param mixed $value * @param mixed $value
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function treatTrueLike($value) public function treatTrueLike($value)
{ {
@ -201,7 +201,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param mixed $value * @param mixed $value
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function treatFalseLike($value) public function treatFalseLike($value)
{ {
@ -213,7 +213,7 @@ abstract class NodeDefinition implements NodeParentInterface
/** /**
* Sets null as the default value. * Sets null as the default value.
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function defaultNull() public function defaultNull()
{ {
@ -223,7 +223,7 @@ abstract class NodeDefinition implements NodeParentInterface
/** /**
* Sets true as the default value. * Sets true as the default value.
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function defaultTrue() public function defaultTrue()
{ {
@ -233,7 +233,7 @@ abstract class NodeDefinition implements NodeParentInterface
/** /**
* Sets false as the default value. * Sets false as the default value.
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function defaultFalse() public function defaultFalse()
{ {
@ -253,7 +253,7 @@ abstract class NodeDefinition implements NodeParentInterface
/** /**
* Denies the node value being empty. * Denies the node value being empty.
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function cannotBeEmpty() public function cannotBeEmpty()
{ {
@ -281,7 +281,7 @@ abstract class NodeDefinition implements NodeParentInterface
* *
* @param bool $deny Whether the overwriting is forbidden or not * @param bool $deny Whether the overwriting is forbidden or not
* *
* @return NodeDefinition|$this * @return $this
*/ */
public function cannotBeOverwritten($deny = true) public function cannotBeOverwritten($deny = true)
{ {

View File

@ -38,7 +38,7 @@ class NormalizationBuilder
* @param string $key The key to remap * @param string $key The key to remap
* @param string $plural The plural of the key in case of irregular plural * @param string $plural The plural of the key in case of irregular plural
* *
* @return NormalizationBuilder * @return $this
*/ */
public function remap($key, $plural = null) public function remap($key, $plural = null)
{ {
@ -52,7 +52,7 @@ class NormalizationBuilder
* *
* @param \Closure $closure * @param \Closure $closure
* *
* @return ExprBuilder|NormalizationBuilder * @return ExprBuilder|$this
*/ */
public function before(\Closure $closure = null) public function before(\Closure $closure = null)
{ {

View File

@ -28,7 +28,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
* *
* @param mixed $max * @param mixed $max
* *
* @return NumericNodeDefinition * @return $this
* *
* @throws \InvalidArgumentException when the constraint is inconsistent * @throws \InvalidArgumentException when the constraint is inconsistent
*/ */
@ -47,7 +47,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
* *
* @param mixed $min * @param mixed $min
* *
* @return NumericNodeDefinition * @return $this
* *
* @throws \InvalidArgumentException when the constraint is inconsistent * @throws \InvalidArgumentException when the constraint is inconsistent
*/ */

View File

@ -57,7 +57,7 @@ abstract class Loader implements LoaderInterface
* @param mixed $resource A resource * @param mixed $resource A resource
* @param string|null $type The resource type or null if unknown * @param string|null $type The resource type or null if unknown
* *
* @return LoaderInterface A LoaderInterface instance * @return $this|LoaderInterface
* *
* @throws FileLoaderLoadException If no loader is found * @throws FileLoaderLoadException If no loader is found
*/ */

View File

@ -746,7 +746,7 @@ class Application
* @param int $width The width * @param int $width The width
* @param int $height The height * @param int $height The height
* *
* @return Application The current application * @return $this
*/ */
public function setTerminalDimensions($width, $height) public function setTerminalDimensions($width, $height)
{ {

View File

@ -265,7 +265,7 @@ class Command
* *
* @param callable $code A callable(InputInterface $input, OutputInterface $output) * @param callable $code A callable(InputInterface $input, OutputInterface $output)
* *
* @return Command The current instance * @return $this
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
* *
@ -325,7 +325,7 @@ class Command
* *
* @param array|InputDefinition $definition An array of argument and option instances or a definition instance * @param array|InputDefinition $definition An array of argument and option instances or a definition instance
* *
* @return Command The current instance * @return $this
*/ */
public function setDefinition($definition) public function setDefinition($definition)
{ {
@ -373,7 +373,7 @@ class Command
* @param string $description A description text * @param string $description A description text
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only) * @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
* *
* @return Command The current instance * @return $this
*/ */
public function addArgument($name, $mode = null, $description = '', $default = null) public function addArgument($name, $mode = null, $description = '', $default = null)
{ {
@ -391,7 +391,7 @@ class Command
* @param string $description A description text * @param string $description A description text
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE) * @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
* *
* @return Command The current instance * @return $this
*/ */
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null) public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
{ {
@ -410,7 +410,7 @@ class Command
* *
* @param string $name The command name * @param string $name The command name
* *
* @return Command The current instance * @return $this
* *
* @throws InvalidArgumentException When the name is invalid * @throws InvalidArgumentException When the name is invalid
*/ */
@ -433,7 +433,7 @@ class Command
* *
* @param string $title The process title * @param string $title The process title
* *
* @return Command The current instance * @return $this
*/ */
public function setProcessTitle($title) public function setProcessTitle($title)
{ {
@ -457,7 +457,7 @@ class Command
* *
* @param string $description The description for the command * @param string $description The description for the command
* *
* @return Command The current instance * @return $this
*/ */
public function setDescription($description) public function setDescription($description)
{ {
@ -481,7 +481,7 @@ class Command
* *
* @param string $help The help for the command * @param string $help The help for the command
* *
* @return Command The current instance * @return $this
*/ */
public function setHelp($help) public function setHelp($help)
{ {
@ -527,7 +527,7 @@ class Command
* *
* @param string[] $aliases An array of aliases for the command * @param string[] $aliases An array of aliases for the command
* *
* @return Command The current instance * @return $this
* *
* @throws InvalidArgumentException When an alias is invalid * @throws InvalidArgumentException When an alias is invalid
*/ */
@ -579,7 +579,7 @@ class Command
* *
* @param string $usage The usage, it'll be prefixed with the command name * @param string $usage The usage, it'll be prefixed with the command name
* *
* @return Command The current instance * @return $this
*/ */
public function addUsage($usage) public function addUsage($usage)
{ {

View File

@ -208,7 +208,7 @@ class OutputFormatter implements OutputFormatterInterface
* *
* @param string $string * @param string $string
* *
* @return OutputFormatterStyle|bool false if string is not format string * @return OutputFormatterStyle|false false if string is not format string
*/ */
private function createStyleFromString($string) private function createStyleFromString($string)
{ {

View File

@ -104,7 +104,7 @@ class OutputFormatterStyleStack
/** /**
* @param OutputFormatterStyleInterface $emptyStyle * @param OutputFormatterStyleInterface $emptyStyle
* *
* @return OutputFormatterStyleStack * @return $this
*/ */
public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle) public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
{ {

View File

@ -78,7 +78,7 @@ class DescriptorHelper extends Helper
* @param string $format * @param string $format
* @param DescriptorInterface $descriptor * @param DescriptorInterface $descriptor
* *
* @return DescriptorHelper * @return $this
*/ */
public function register($format, DescriptorInterface $descriptor) public function register($format, DescriptorInterface $descriptor)
{ {

View File

@ -35,7 +35,7 @@ abstract class Helper implements HelperInterface
/** /**
* Gets the helper set associated with this helper. * Gets the helper set associated with this helper.
* *
* @return HelperSet A HelperSet instance * @return HelperSet|null
*/ */
public function getHelperSet() public function getHelperSet()
{ {

View File

@ -107,7 +107,7 @@ class Table
* *
* @param string $name The style name * @param string $name The style name
* *
* @return TableStyle A TableStyle instance * @return TableStyle
*/ */
public static function getStyleDefinition($name) public static function getStyleDefinition($name)
{ {
@ -127,7 +127,7 @@ class Table
* *
* @param TableStyle|string $name The style name or a TableStyle instance * @param TableStyle|string $name The style name or a TableStyle instance
* *
* @return Table * @return $this
*/ */
public function setStyle($name) public function setStyle($name)
{ {

View File

@ -37,7 +37,7 @@ class TableStyle
* *
* @param string $paddingChar * @param string $paddingChar
* *
* @return TableStyle * @return $this
*/ */
public function setPaddingChar($paddingChar) public function setPaddingChar($paddingChar)
{ {
@ -65,7 +65,7 @@ class TableStyle
* *
* @param string $horizontalBorderChar * @param string $horizontalBorderChar
* *
* @return TableStyle * @return $this
*/ */
public function setHorizontalBorderChar($horizontalBorderChar) public function setHorizontalBorderChar($horizontalBorderChar)
{ {
@ -89,7 +89,7 @@ class TableStyle
* *
* @param string $verticalBorderChar * @param string $verticalBorderChar
* *
* @return TableStyle * @return $this
*/ */
public function setVerticalBorderChar($verticalBorderChar) public function setVerticalBorderChar($verticalBorderChar)
{ {
@ -113,7 +113,7 @@ class TableStyle
* *
* @param string $crossingChar * @param string $crossingChar
* *
* @return TableStyle * @return $this
*/ */
public function setCrossingChar($crossingChar) public function setCrossingChar($crossingChar)
{ {
@ -137,7 +137,7 @@ class TableStyle
* *
* @param string $cellHeaderFormat * @param string $cellHeaderFormat
* *
* @return TableStyle * @return $this
*/ */
public function setCellHeaderFormat($cellHeaderFormat) public function setCellHeaderFormat($cellHeaderFormat)
{ {
@ -161,7 +161,7 @@ class TableStyle
* *
* @param string $cellRowFormat * @param string $cellRowFormat
* *
* @return TableStyle * @return $this
*/ */
public function setCellRowFormat($cellRowFormat) public function setCellRowFormat($cellRowFormat)
{ {
@ -185,7 +185,7 @@ class TableStyle
* *
* @param string $cellRowContentFormat * @param string $cellRowContentFormat
* *
* @return TableStyle * @return $this
*/ */
public function setCellRowContentFormat($cellRowContentFormat) public function setCellRowContentFormat($cellRowContentFormat)
{ {
@ -209,7 +209,7 @@ class TableStyle
* *
* @param string $borderFormat * @param string $borderFormat
* *
* @return TableStyle * @return $this
*/ */
public function setBorderFormat($borderFormat) public function setBorderFormat($borderFormat)
{ {
@ -233,7 +233,7 @@ class TableStyle
* *
* @param int $padType STR_PAD_* * @param int $padType STR_PAD_*
* *
* @return TableStyle * @return $this
*/ */
public function setPadType($padType) public function setPadType($padType)
{ {

View File

@ -58,7 +58,7 @@ class ChoiceQuestion extends Question
* *
* @param bool $multiselect * @param bool $multiselect
* *
* @return ChoiceQuestion The current instance * @return $this
*/ */
public function setMultiselect($multiselect) public function setMultiselect($multiselect)
{ {
@ -93,7 +93,7 @@ class ChoiceQuestion extends Question
* *
* @param string $prompt * @param string $prompt
* *
* @return ChoiceQuestion The current instance * @return $this
*/ */
public function setPrompt($prompt) public function setPrompt($prompt)
{ {
@ -109,7 +109,7 @@ class ChoiceQuestion extends Question
* *
* @param string $errorMessage * @param string $errorMessage
* *
* @return ChoiceQuestion The current instance * @return $this
*/ */
public function setErrorMessage($errorMessage) public function setErrorMessage($errorMessage)
{ {

View File

@ -77,7 +77,7 @@ class Question
* *
* @param bool $hidden * @param bool $hidden
* *
* @return Question The current instance * @return $this
* *
* @throws LogicException In case the autocompleter is also used * @throws LogicException In case the autocompleter is also used
*/ */
@ -107,7 +107,7 @@ class Question
* *
* @param bool $fallback * @param bool $fallback
* *
* @return Question The current instance * @return $this
*/ */
public function setHiddenFallback($fallback) public function setHiddenFallback($fallback)
{ {
@ -131,7 +131,7 @@ class Question
* *
* @param null|array|\Traversable $values * @param null|array|\Traversable $values
* *
* @return Question The current instance * @return $this
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @throws LogicException * @throws LogicException
@ -162,7 +162,7 @@ class Question
* *
* @param null|callable $validator * @param null|callable $validator
* *
* @return Question The current instance * @return $this
*/ */
public function setValidator(callable $validator = null) public function setValidator(callable $validator = null)
{ {
@ -188,7 +188,7 @@ class Question
* *
* @param null|int $attempts * @param null|int $attempts
* *
* @return Question The current instance * @return $this
* *
* @throws InvalidArgumentException In case the number of attempts is invalid. * @throws InvalidArgumentException In case the number of attempts is invalid.
*/ */
@ -222,7 +222,7 @@ class Question
* *
* @param callable $normalizer * @param callable $normalizer
* *
* @return Question The current instance * @return $this
*/ */
public function setNormalizer(callable $normalizer) public function setNormalizer(callable $normalizer)
{ {

View File

@ -54,6 +54,14 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$command = new \TestCommand(); $command = new \TestCommand();
$command->setApplication($application); $command->setApplication($application);
$this->assertEquals($application, $command->getApplication(), '->setApplication() sets the current application'); $this->assertEquals($application, $command->getApplication(), '->setApplication() sets the current application');
$this->assertEquals($application->getHelperSet(), $command->getHelperSet());
}
public function testSetApplicationNull()
{
$command = new \TestCommand();
$command->setApplication(null);
$this->assertNull($command->getHelperSet());
} }
public function testSetGetDefinition() public function testSetGetDefinition()
@ -156,6 +164,13 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array('name1'), $command->getAliases(), '->setAliases() sets the aliases'); $this->assertEquals(array('name1'), $command->getAliases(), '->setAliases() sets the aliases');
} }
public function testSetAliasesNull()
{
$command = new \TestCommand();
$this->setExpectedException('InvalidArgumentException');
$command->setAliases(null);
}
public function testGetSynopsis() public function testGetSynopsis()
{ {
$command = new \TestCommand(); $command = new \TestCommand();
@ -164,6 +179,15 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('namespace:name [--foo] [--] [<bar>]', $command->getSynopsis(), '->getSynopsis() returns the synopsis'); $this->assertEquals('namespace:name [--foo] [--] [<bar>]', $command->getSynopsis(), '->getSynopsis() returns the synopsis');
} }
public function testAddGetUsages()
{
$command = new \TestCommand();
$command->addUsage('foo1');
$command->addUsage('foo2');
$this->assertContains('namespace:name foo1', $command->getUsages());
$this->assertContains('namespace:name foo2', $command->getUsages());
}
public function testGetHelper() public function testGetHelper()
{ {
$application = new Application(); $application = new Application();
@ -275,8 +299,8 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$command = $this->getMockBuilder('TestCommand')->setMethods(array('execute'))->getMock(); $command = $this->getMockBuilder('TestCommand')->setMethods(array('execute'))->getMock();
$command->expects($this->once()) $command->expects($this->once())
->method('execute') ->method('execute')
->will($this->returnValue('2.3')); ->will($this->returnValue('2.3'));
$exitCode = $command->run(new StringInput(''), new NullOutput()); $exitCode = $command->run(new StringInput(''), new NullOutput());
$this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)');
} }
@ -297,6 +321,17 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); $this->assertSame(0, $command->run(new StringInput(''), new NullOutput()));
} }
public function testRunWithProcessTitle()
{
$command = new \TestCommand();
$command->setApplication(new Application());
$command->setProcessTitle('foo');
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput()));
if (function_exists('cli_set_process_title')) {
$this->assertEquals('foo', cli_get_process_title());
}
}
public function testSetCode() public function testSetCode()
{ {
$command = new \TestCommand(); $command = new \TestCommand();

View File

@ -27,7 +27,7 @@ class SyntaxErrorException extends ParseException
* @param string $expectedValue * @param string $expectedValue
* @param Token $foundToken * @param Token $foundToken
* *
* @return SyntaxErrorException * @return self
*/ */
public static function unexpectedToken($expectedValue, Token $foundToken) public static function unexpectedToken($expectedValue, Token $foundToken)
{ {
@ -38,7 +38,7 @@ class SyntaxErrorException extends ParseException
* @param string $pseudoElement * @param string $pseudoElement
* @param string $unexpectedLocation * @param string $unexpectedLocation
* *
* @return SyntaxErrorException * @return self
*/ */
public static function pseudoElementFound($pseudoElement, $unexpectedLocation) public static function pseudoElementFound($pseudoElement, $unexpectedLocation)
{ {
@ -48,7 +48,7 @@ class SyntaxErrorException extends ParseException
/** /**
* @param int $position * @param int $position
* *
* @return SyntaxErrorException * @return self
*/ */
public static function unclosedString($position) public static function unclosedString($position)
{ {
@ -56,7 +56,7 @@ class SyntaxErrorException extends ParseException
} }
/** /**
* @return SyntaxErrorException * @return self
*/ */
public static function nestedNot() public static function nestedNot()
{ {
@ -64,7 +64,7 @@ class SyntaxErrorException extends ParseException
} }
/** /**
* @return SyntaxErrorException * @return self
*/ */
public static function stringAsFunctionArgument() public static function stringAsFunctionArgument()
{ {

View File

@ -61,7 +61,7 @@ class Specificity
/** /**
* @param Specificity $specificity * @param Specificity $specificity
* *
* @return Specificity * @return self
*/ */
public function plus(Specificity $specificity) public function plus(Specificity $specificity)
{ {

View File

@ -61,7 +61,7 @@ class TokenStream
* *
* @param Token $token * @param Token $token
* *
* @return TokenStream * @return $this
*/ */
public function push(Token $token) public function push(Token $token)
{ {
@ -73,7 +73,7 @@ class TokenStream
/** /**
* Freezes stream. * Freezes stream.
* *
* @return TokenStream * @return $this
*/ */
public function freeze() public function freeze()
{ {

View File

@ -50,7 +50,7 @@ class NodeExtension extends AbstractExtension
* @param int $flag * @param int $flag
* @param bool $on * @param bool $on
* *
* @return NodeExtension * @return $this
*/ */
public function setFlag($flag, $on) public function setFlag($flag, $on)
{ {

View File

@ -146,7 +146,7 @@ class Translator implements TranslatorInterface
* *
* @param Extension\ExtensionInterface $extension * @param Extension\ExtensionInterface $extension
* *
* @return Translator * @return $this
*/ */
public function registerExtension(Extension\ExtensionInterface $extension) public function registerExtension(Extension\ExtensionInterface $extension)
{ {
@ -182,7 +182,7 @@ class Translator implements TranslatorInterface
* *
* @param ParserInterface $shortcut * @param ParserInterface $shortcut
* *
* @return Translator * @return $this
*/ */
public function registerParserShortcut(ParserInterface $shortcut) public function registerParserShortcut(ParserInterface $shortcut)
{ {

View File

@ -66,7 +66,7 @@ class XPathExpr
/** /**
* @param $condition * @param $condition
* *
* @return XPathExpr * @return $this
*/ */
public function addCondition($condition) public function addCondition($condition)
{ {
@ -84,7 +84,7 @@ class XPathExpr
} }
/** /**
* @return XPathExpr * @return $this
*/ */
public function addNameTest() public function addNameTest()
{ {
@ -97,7 +97,7 @@ class XPathExpr
} }
/** /**
* @return XPathExpr * @return $this
*/ */
public function addStarPrefix() public function addStarPrefix()
{ {
@ -112,7 +112,7 @@ class XPathExpr
* @param string $combiner * @param string $combiner
* @param XPathExpr $expr * @param XPathExpr $expr
* *
* @return XPathExpr * @return $this
*/ */
public function join($combiner, XPathExpr $expr) public function join($combiner, XPathExpr $expr)
{ {

View File

@ -49,7 +49,7 @@ class ExceptionHandler
* @param string|null $charset The charset used by exception messages * @param string|null $charset The charset used by exception messages
* @param string|null $fileLinkFormat The IDE link template * @param string|null $fileLinkFormat The IDE link template
* *
* @return ExceptionHandler The registered exception handler * @return static
*/ */
public static function register($debug = true, $charset = null, $fileLinkFormat = null) public static function register($debug = true, $charset = null, $fileLinkFormat = null)
{ {

View File

@ -45,7 +45,7 @@ class ServiceReferenceGraph
* *
* @param string $id The id to retrieve * @param string $id The id to retrieve
* *
* @return ServiceReferenceGraphNode The node matching the supplied identifier * @return ServiceReferenceGraphNode
* *
* @throws InvalidArgumentException if no node matches the supplied identifier * @throws InvalidArgumentException if no node matches the supplied identifier
*/ */
@ -61,7 +61,7 @@ class ServiceReferenceGraph
/** /**
* Returns all nodes. * Returns all nodes.
* *
* @return ServiceReferenceGraphNode[] An array of all ServiceReferenceGraphNode objects * @return ServiceReferenceGraphNode[]
*/ */
public function getNodes() public function getNodes()
{ {

View File

@ -195,7 +195,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* *
* @param ResourceInterface $resource A resource instance * @param ResourceInterface $resource A resource instance
* *
* @return ContainerBuilder The current instance * @return $this
*/ */
public function addResource(ResourceInterface $resource) public function addResource(ResourceInterface $resource)
{ {
@ -213,7 +213,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* *
* @param ResourceInterface[] $resources An array of resources * @param ResourceInterface[] $resources An array of resources
* *
* @return ContainerBuilder The current instance * @return $this
*/ */
public function setResources(array $resources) public function setResources(array $resources)
{ {
@ -231,7 +231,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* *
* @param object $object An object instance * @param object $object An object instance
* *
* @return ContainerBuilder The current instance * @return $this
*/ */
public function addObjectResource($object) public function addObjectResource($object)
{ {
@ -247,7 +247,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* *
* @param \ReflectionClass $class * @param \ReflectionClass $class
* *
* @return ContainerBuilder The current instance * @return $this
*/ */
public function addClassResource(\ReflectionClass $class) public function addClassResource(\ReflectionClass $class)
{ {
@ -270,7 +270,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* @param string $extension The extension alias or namespace * @param string $extension The extension alias or namespace
* @param array $values An array of values that customizes the extension * @param array $values An array of values that customizes the extension
* *
* @return ContainerBuilder The current instance * @return $this
* *
* @throws BadMethodCallException When this ContainerBuilder is frozen * @throws BadMethodCallException When this ContainerBuilder is frozen
* @throws \LogicException if the container is frozen * @throws \LogicException if the container is frozen
@ -294,7 +294,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* @param CompilerPassInterface $pass A compiler pass * @param CompilerPassInterface $pass A compiler pass
* @param string $type The type of compiler pass * @param string $type The type of compiler pass
* *
* @return ContainerBuilder The current instance * @return $this
*/ */
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
{ {

View File

@ -56,7 +56,7 @@ class Definition
* *
* @param string|array $factory A PHP function or an array containing a class/Reference and a method to call * @param string|array $factory A PHP function or an array containing a class/Reference and a method to call
* *
* @return Definition The current instance * @return $this
*/ */
public function setFactory($factory) public function setFactory($factory)
{ {
@ -86,7 +86,7 @@ class Definition
* @param null|string $renamedId The new decorated service id * @param null|string $renamedId The new decorated service id
* @param int $priority The priority of decoration * @param int $priority The priority of decoration
* *
* @return Definition The current instance * @return $this
* *
* @throws InvalidArgumentException In case the decorated service id and the new decorated service id are equals. * @throws InvalidArgumentException In case the decorated service id and the new decorated service id are equals.
*/ */
@ -120,7 +120,7 @@ class Definition
* *
* @param string $class The service class * @param string $class The service class
* *
* @return Definition The current instance * @return $this
*/ */
public function setClass($class) public function setClass($class)
{ {
@ -144,7 +144,7 @@ class Definition
* *
* @param array $arguments An array of arguments * @param array $arguments An array of arguments
* *
* @return Definition The current instance * @return $this
*/ */
public function setArguments(array $arguments) public function setArguments(array $arguments)
{ {
@ -177,7 +177,7 @@ class Definition
* *
* @param mixed $argument An argument * @param mixed $argument An argument
* *
* @return Definition The current instance * @return $this
*/ */
public function addArgument($argument) public function addArgument($argument)
{ {
@ -192,7 +192,7 @@ class Definition
* @param int $index * @param int $index
* @param mixed $argument * @param mixed $argument
* *
* @return Definition The current instance * @return $this
* *
* @throws OutOfBoundsException When the replaced argument does not exist * @throws OutOfBoundsException When the replaced argument does not exist
*/ */
@ -240,7 +240,7 @@ class Definition
* *
* @param array $calls An array of method calls * @param array $calls An array of method calls
* *
* @return Definition The current instance * @return $this
*/ */
public function setMethodCalls(array $calls = array()) public function setMethodCalls(array $calls = array())
{ {
@ -258,7 +258,7 @@ class Definition
* @param string $method The method name to call * @param string $method The method name to call
* @param array $arguments An array of arguments to pass to the method call * @param array $arguments An array of arguments to pass to the method call
* *
* @return Definition The current instance * @return $this
* *
* @throws InvalidArgumentException on empty $method param * @throws InvalidArgumentException on empty $method param
*/ */
@ -277,7 +277,7 @@ class Definition
* *
* @param string $method The method name to remove * @param string $method The method name to remove
* *
* @return Definition The current instance * @return $this
*/ */
public function removeMethodCall($method) public function removeMethodCall($method)
{ {
@ -324,7 +324,7 @@ class Definition
* *
* @param array $tags * @param array $tags
* *
* @return Definition the current instance * @return $this
*/ */
public function setTags(array $tags) public function setTags(array $tags)
{ {
@ -361,7 +361,7 @@ class Definition
* @param string $name The tag name * @param string $name The tag name
* @param array $attributes An array of attributes * @param array $attributes An array of attributes
* *
* @return Definition The current instance * @return $this
*/ */
public function addTag($name, array $attributes = array()) public function addTag($name, array $attributes = array())
{ {
@ -387,7 +387,7 @@ class Definition
* *
* @param string $name The tag name * @param string $name The tag name
* *
* @return Definition * @return $this
*/ */
public function clearTag($name) public function clearTag($name)
{ {
@ -399,7 +399,7 @@ class Definition
/** /**
* Clears the tags for this definition. * Clears the tags for this definition.
* *
* @return Definition The current instance * @return $this
*/ */
public function clearTags() public function clearTags()
{ {
@ -413,7 +413,7 @@ class Definition
* *
* @param string $file A full pathname to include * @param string $file A full pathname to include
* *
* @return Definition The current instance * @return $this
*/ */
public function setFile($file) public function setFile($file)
{ {
@ -461,7 +461,7 @@ class Definition
* *
* @param bool $boolean * @param bool $boolean
* *
* @return Definition The current instance * @return $this
*/ */
public function setPublic($boolean) public function setPublic($boolean)
{ {
@ -485,7 +485,7 @@ class Definition
* *
* @param bool $lazy * @param bool $lazy
* *
* @return Definition The current instance * @return $this
*/ */
public function setLazy($lazy) public function setLazy($lazy)
{ {
@ -510,7 +510,7 @@ class Definition
* *
* @param bool $boolean * @param bool $boolean
* *
* @return Definition the current instance * @return $this
*/ */
public function setSynthetic($boolean) public function setSynthetic($boolean)
{ {
@ -536,7 +536,7 @@ class Definition
* *
* @param bool $boolean * @param bool $boolean
* *
* @return Definition the current instance * @return $this
*/ */
public function setAbstract($boolean) public function setAbstract($boolean)
{ {
@ -614,7 +614,7 @@ class Definition
* *
* @param callable $callable A PHP callable * @param callable $callable A PHP callable
* *
* @return Definition The current instance * @return $this
*/ */
public function setConfigurator($callable) public function setConfigurator($callable)
{ {

View File

@ -182,7 +182,7 @@ class DefinitionDecorator extends Definition
* @param int $index * @param int $index
* @param mixed $value * @param mixed $value
* *
* @return DefinitionDecorator the current instance * @return $this
* *
* @throws InvalidArgumentException when $index isn't an integer * @throws InvalidArgumentException when $index isn't an integer
*/ */

View File

@ -337,7 +337,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param int $position The position * @param int $position The position
* *
* @return Crawler A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist * @return self
*/ */
public function eq($position) public function eq($position)
{ {
@ -380,7 +380,7 @@ class Crawler implements \Countable, \IteratorAggregate
* @param int $offset * @param int $offset
* @param int $length * @param int $length
* *
* @return Crawler A Crawler instance with the sliced nodes * @return self
*/ */
public function slice($offset = 0, $length = null) public function slice($offset = 0, $length = null)
{ {
@ -394,7 +394,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param \Closure $closure An anonymous function * @param \Closure $closure An anonymous function
* *
* @return Crawler A Crawler instance with the selected nodes * @return self
*/ */
public function reduce(\Closure $closure) public function reduce(\Closure $closure)
{ {
@ -411,7 +411,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the first node of the current selection. * Returns the first node of the current selection.
* *
* @return Crawler A Crawler instance with the first selected node * @return self
*/ */
public function first() public function first()
{ {
@ -421,7 +421,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the last node of the current selection. * Returns the last node of the current selection.
* *
* @return Crawler A Crawler instance with the last selected node * @return self
*/ */
public function last() public function last()
{ {
@ -431,7 +431,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the siblings nodes of the current selection. * Returns the siblings nodes of the current selection.
* *
* @return Crawler A Crawler instance with the sibling nodes * @return self
* *
* @throws \InvalidArgumentException When current node is empty * @throws \InvalidArgumentException When current node is empty
*/ */
@ -447,7 +447,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the next siblings nodes of the current selection. * Returns the next siblings nodes of the current selection.
* *
* @return Crawler A Crawler instance with the next sibling nodes * @return self
* *
* @throws \InvalidArgumentException When current node is empty * @throws \InvalidArgumentException When current node is empty
*/ */
@ -463,7 +463,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the previous sibling nodes of the current selection. * Returns the previous sibling nodes of the current selection.
* *
* @return Crawler A Crawler instance with the previous sibling nodes * @return self
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
@ -479,7 +479,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the parents nodes of the current selection. * Returns the parents nodes of the current selection.
* *
* @return Crawler A Crawler instance with the parents nodes of the current selection * @return self
* *
* @throws \InvalidArgumentException When current node is empty * @throws \InvalidArgumentException When current node is empty
*/ */
@ -504,7 +504,7 @@ class Crawler implements \Countable, \IteratorAggregate
/** /**
* Returns the children nodes of the current selection. * Returns the children nodes of the current selection.
* *
* @return Crawler A Crawler instance with the children nodes * @return self
* *
* @throws \InvalidArgumentException When current node is empty * @throws \InvalidArgumentException When current node is empty
*/ */
@ -637,7 +637,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param string $xpath An XPath expression * @param string $xpath An XPath expression
* *
* @return Crawler A new instance of Crawler with the filtered list of nodes * @return self
*/ */
public function filterXPath($xpath) public function filterXPath($xpath)
{ {
@ -658,7 +658,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param string $selector A CSS selector * @param string $selector A CSS selector
* *
* @return Crawler A new instance of Crawler with the filtered list of nodes * @return self
* *
* @throws \RuntimeException if the CssSelector Component is not available * @throws \RuntimeException if the CssSelector Component is not available
*/ */
@ -679,7 +679,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param string $value The link text * @param string $value The link text
* *
* @return Crawler A new instance of Crawler with the filtered list of nodes * @return self
*/ */
public function selectLink($value) public function selectLink($value)
{ {
@ -708,7 +708,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param string $value The button text * @param string $value The button text
* *
* @return Crawler A new instance of Crawler with the filtered list of nodes * @return self
*/ */
public function selectButton($value) public function selectButton($value)
{ {
@ -910,7 +910,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* @param string $xpath * @param string $xpath
* *
* @return Crawler * @return self
*/ */
private function filterRelativeXPath($xpath) private function filterRelativeXPath($xpath)
{ {

View File

@ -69,7 +69,7 @@ class Form extends Link implements \ArrayAccess
* *
* @param array $values An array of field values * @param array $values An array of field values
* *
* @return Form * @return $this
*/ */
public function setValues(array $values) public function setValues(array $values)
{ {
@ -279,7 +279,7 @@ class Form extends Link implements \ArrayAccess
/** /**
* Gets all fields. * Gets all fields.
* *
* @return FormField[] An array of fields * @return FormField[]
*/ */
public function all() public function all()
{ {

View File

@ -151,7 +151,7 @@ class FormFieldRegistry
* @param string $base The fully qualified name of the base field * @param string $base The fully qualified name of the base field
* @param array $values The values of the fields * @param array $values The values of the fields
* *
* @return FormFieldRegistry * @return static
*/ */
private static function create($base, array $values) private static function create($base, array $values)
{ {

View File

@ -80,7 +80,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
* @param string $key Argument name * @param string $key Argument name
* @param mixed $value Value * @param mixed $value Value
* *
* @return GenericEvent * @return $this
*/ */
public function setArgument($key, $value) public function setArgument($key, $value)
{ {
@ -104,7 +104,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
* *
* @param array $args Arguments * @param array $args Arguments
* *
* @return GenericEvent * @return $this
*/ */
public function setArguments(array $args = array()) public function setArguments(array $args = array())
{ {

View File

@ -53,7 +53,7 @@ class Compiler
* *
* @param Node\Node $node The node to compile * @param Node\Node $node The node to compile
* *
* @return Compiler The current compiler instance * @return $this
*/ */
public function compile(Node\Node $node) public function compile(Node\Node $node)
{ {
@ -80,7 +80,7 @@ class Compiler
* *
* @param string $string The string * @param string $string The string
* *
* @return Compiler The current compiler instance * @return $this
*/ */
public function raw($string) public function raw($string)
{ {
@ -94,7 +94,7 @@ class Compiler
* *
* @param string $value The string * @param string $value The string
* *
* @return Compiler The current compiler instance * @return $this
*/ */
public function string($value) public function string($value)
{ {
@ -108,7 +108,7 @@ class Compiler
* *
* @param mixed $value The value to convert * @param mixed $value The value to convert
* *
* @return Compiler The current compiler instance * @return $this
*/ */
public function repr($value) public function repr($value)
{ {

View File

@ -72,7 +72,7 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Creates a new Finder. * Creates a new Finder.
* *
* @return Finder A new Finder instance * @return static
*/ */
public static function create() public static function create()
{ {
@ -82,7 +82,7 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Restricts the matching to directories only. * Restricts the matching to directories only.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
*/ */
public function directories() public function directories()
{ {
@ -94,7 +94,7 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Restricts the matching to files only. * Restricts the matching to files only.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
*/ */
public function files() public function files()
{ {
@ -113,7 +113,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string|int $level The depth level expression * @param string|int $level The depth level expression
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see DepthRangeFilterIterator * @see DepthRangeFilterIterator
* @see NumberComparator * @see NumberComparator
@ -137,7 +137,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $date A date range string * @param string $date A date range string
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see strtotime * @see strtotime
* @see DateRangeFilterIterator * @see DateRangeFilterIterator
@ -161,7 +161,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $pattern A pattern (a regexp, a glob, or a string) * @param string $pattern A pattern (a regexp, a glob, or a string)
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
@ -177,7 +177,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $pattern A pattern (a regexp, a glob, or a string) * @param string $pattern A pattern (a regexp, a glob, or a string)
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
@ -198,7 +198,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $pattern A pattern (string or regexp) * @param string $pattern A pattern (string or regexp)
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see FilecontentFilterIterator * @see FilecontentFilterIterator
*/ */
@ -219,7 +219,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $pattern A pattern (string or regexp) * @param string $pattern A pattern (string or regexp)
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see FilecontentFilterIterator * @see FilecontentFilterIterator
*/ */
@ -242,7 +242,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $pattern A pattern (a regexp or a string) * @param string $pattern A pattern (a regexp or a string)
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
@ -265,7 +265,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string $pattern A pattern (a regexp or a string) * @param string $pattern A pattern (a regexp or a string)
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
@ -285,7 +285,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string|int $size A size range string or an integer * @param string|int $size A size range string or an integer
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SizeRangeFilterIterator * @see SizeRangeFilterIterator
* @see NumberComparator * @see NumberComparator
@ -302,7 +302,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string|array $dirs A directory path or an array of directories * @param string|array $dirs A directory path or an array of directories
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see ExcludeDirectoryFilterIterator * @see ExcludeDirectoryFilterIterator
*/ */
@ -318,7 +318,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param bool $ignoreDotFiles Whether to exclude "hidden" files or not * @param bool $ignoreDotFiles Whether to exclude "hidden" files or not
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see ExcludeDirectoryFilterIterator * @see ExcludeDirectoryFilterIterator
*/ */
@ -338,7 +338,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param bool $ignoreVCS Whether to exclude VCS files or not * @param bool $ignoreVCS Whether to exclude VCS files or not
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see ExcludeDirectoryFilterIterator * @see ExcludeDirectoryFilterIterator
*/ */
@ -378,7 +378,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param \Closure $closure An anonymous function * @param \Closure $closure An anonymous function
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SortableIterator * @see SortableIterator
*/ */
@ -394,7 +394,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* This can be slow as all the matching files and directories must be retrieved for comparison. * This can be slow as all the matching files and directories must be retrieved for comparison.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SortableIterator * @see SortableIterator
*/ */
@ -410,7 +410,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* This can be slow as all the matching files and directories must be retrieved for comparison. * This can be slow as all the matching files and directories must be retrieved for comparison.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SortableIterator * @see SortableIterator
*/ */
@ -428,7 +428,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* This can be slow as all the matching files and directories must be retrieved for comparison. * This can be slow as all the matching files and directories must be retrieved for comparison.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SortableIterator * @see SortableIterator
*/ */
@ -448,7 +448,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* This can be slow as all the matching files and directories must be retrieved for comparison. * This can be slow as all the matching files and directories must be retrieved for comparison.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SortableIterator * @see SortableIterator
*/ */
@ -466,7 +466,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* This can be slow as all the matching files and directories must be retrieved for comparison. * This can be slow as all the matching files and directories must be retrieved for comparison.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see SortableIterator * @see SortableIterator
*/ */
@ -485,7 +485,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param \Closure $closure An anonymous function * @param \Closure $closure An anonymous function
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @see CustomFilterIterator * @see CustomFilterIterator
*/ */
@ -499,7 +499,7 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Forces the following of symlinks. * Forces the following of symlinks.
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
*/ */
public function followLinks() public function followLinks()
{ {
@ -515,7 +515,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param bool $ignore * @param bool $ignore
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
*/ */
public function ignoreUnreadableDirs($ignore = true) public function ignoreUnreadableDirs($ignore = true)
{ {
@ -529,7 +529,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string|array $dirs A directory path or an array of directories * @param string|array $dirs A directory path or an array of directories
* *
* @return Finder|SplFileInfo[] The current Finder instance * @return $this
* *
* @throws \InvalidArgumentException if one of the directories does not exist * @throws \InvalidArgumentException if one of the directories does not exist
*/ */
@ -590,7 +590,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param mixed $iterator * @param mixed $iterator
* *
* @return Finder|SplFileInfo[] The finder * @return $this
* *
* @throws \InvalidArgumentException When the given argument is not iterable. * @throws \InvalidArgumentException When the given argument is not iterable.
*/ */

View File

@ -369,7 +369,7 @@ class Button implements \IteratorAggregate, FormInterface
* @param null|string $submittedData The data * @param null|string $submittedData The data
* @param bool $clearMissing Not used * @param bool $clearMissing Not used
* *
* @return Button The button instance * @return $this
* *
* @throws Exception\AlreadySubmittedException If the button has already been submitted. * @throws Exception\AlreadySubmittedException If the button has already been submitted.
*/ */

View File

@ -286,7 +286,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
* *
* @param bool $disabled Whether the button is disabled * @param bool $disabled Whether the button is disabled
* *
* @return ButtonBuilder The button builder * @return $this
*/ */
public function setDisabled($disabled) public function setDisabled($disabled)
{ {
@ -398,7 +398,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
* *
* @param ResolvedFormTypeInterface $type The type of the button * @param ResolvedFormTypeInterface $type The type of the button
* *
* @return ButtonBuilder The button builder * @return $this
*/ */
public function setType(ResolvedFormTypeInterface $type) public function setType(ResolvedFormTypeInterface $type)
{ {
@ -490,7 +490,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
* *
* @param bool $initialize * @param bool $initialize
* *
* @return ButtonBuilder * @return $this
* *
* @throws BadMethodCallException * @throws BadMethodCallException
*/ */

View File

@ -713,7 +713,7 @@ class Form implements \IteratorAggregate, FormInterface
return FormUtil::isEmpty($this->modelData) || return FormUtil::isEmpty($this->modelData) ||
// arrays, countables // arrays, countables
0 === count($this->modelData) || ((is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === count($this->modelData)) ||
// traversables that are not countable // traversables that are not countable
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)); ($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
} }

View File

@ -248,7 +248,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
* *
* @param string $name The name of the unresolved child * @param string $name The name of the unresolved child
* *
* @return FormBuilder The created instance * @return self The created instance
*/ */
private function resolveChild($name) private function resolveChild($name)
{ {

View File

@ -27,7 +27,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
* @param string|null $type * @param string|null $type
* @param array $options * @param array $options
* *
* @return FormBuilderInterface The builder object * @return $this
*/ */
public function add($child, $type = null, array $options = array()); public function add($child, $type = null, array $options = array());
@ -38,7 +38,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
* @param string|null $type The type of the form or null if name is a property * @param string|null $type The type of the form or null if name is a property
* @param array $options The options * @param array $options The options
* *
* @return FormBuilderInterface The created builder * @return self
*/ */
public function create($name, $type = null, array $options = array()); public function create($name, $type = null, array $options = array());
@ -47,7 +47,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
* *
* @param string $name The name of the child * @param string $name The name of the child
* *
* @return FormBuilderInterface The builder for the child * @return self
* *
* @throws Exception\InvalidArgumentException if the given child does not exist * @throws Exception\InvalidArgumentException if the given child does not exist
*/ */
@ -58,7 +58,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
* *
* @param string $name * @param string $name
* *
* @return FormBuilderInterface The builder object * @return $this
*/ */
public function remove($name); public function remove($name);

View File

@ -23,7 +23,7 @@ interface FormFactoryBuilderInterface
* *
* @param ResolvedFormTypeFactoryInterface $resolvedTypeFactory * @param ResolvedFormTypeFactoryInterface $resolvedTypeFactory
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory); public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory);
@ -32,7 +32,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormExtensionInterface $extension The extension * @param FormExtensionInterface $extension The extension
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addExtension(FormExtensionInterface $extension); public function addExtension(FormExtensionInterface $extension);
@ -41,7 +41,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormExtensionInterface[] $extensions The extensions * @param FormExtensionInterface[] $extensions The extensions
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addExtensions(array $extensions); public function addExtensions(array $extensions);
@ -50,7 +50,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormTypeInterface $type The form type * @param FormTypeInterface $type The form type
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addType(FormTypeInterface $type); public function addType(FormTypeInterface $type);
@ -59,7 +59,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormTypeInterface[] $types The form types * @param FormTypeInterface[] $types The form types
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addTypes(array $types); public function addTypes(array $types);
@ -68,7 +68,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormTypeExtensionInterface $typeExtension The form type extension * @param FormTypeExtensionInterface $typeExtension The form type extension
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addTypeExtension(FormTypeExtensionInterface $typeExtension); public function addTypeExtension(FormTypeExtensionInterface $typeExtension);
@ -77,7 +77,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormTypeExtensionInterface[] $typeExtensions The form type extensions * @param FormTypeExtensionInterface[] $typeExtensions The form type extensions
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addTypeExtensions(array $typeExtensions); public function addTypeExtensions(array $typeExtensions);
@ -86,7 +86,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormTypeGuesserInterface $typeGuesser The type guesser * @param FormTypeGuesserInterface $typeGuesser The type guesser
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser); public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser);
@ -95,7 +95,7 @@ interface FormFactoryBuilderInterface
* *
* @param FormTypeGuesserInterface[] $typeGuessers The type guessers * @param FormTypeGuesserInterface[] $typeGuessers The type guessers
* *
* @return FormFactoryBuilderInterface The builder * @return $this
*/ */
public function addTypeGuessers(array $typeGuessers); public function addTypeGuessers(array $typeGuessers);

View File

@ -25,7 +25,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @param FormInterface|null $parent The parent form or null if it's the root * @param FormInterface|null $parent The parent form or null if it's the root
* *
* @return FormInterface The form instance * @return self
* *
* @throws Exception\AlreadySubmittedException If the form has already been submitted. * @throws Exception\AlreadySubmittedException If the form has already been submitted.
* @throws Exception\LogicException When trying to set a parent for a form with * @throws Exception\LogicException When trying to set a parent for a form with
@ -36,7 +36,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
/** /**
* Returns the parent form. * Returns the parent form.
* *
* @return FormInterface|null The parent form or null if there is none * @return self|null The parent form or null if there is none
*/ */
public function getParent(); public function getParent();
@ -47,7 +47,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* @param string|null $type The child's type, if a name was passed * @param string|null $type The child's type, if a name was passed
* @param array $options The child's options, if a name was passed * @param array $options The child's options, if a name was passed
* *
* @return FormInterface The form instance * @return self
* *
* @throws Exception\AlreadySubmittedException If the form has already been submitted. * @throws Exception\AlreadySubmittedException If the form has already been submitted.
* @throws Exception\LogicException When trying to add a child to a non-compound form. * @throws Exception\LogicException When trying to add a child to a non-compound form.
@ -60,7 +60,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @param string $name The name of the child * @param string $name The name of the child
* *
* @return FormInterface The child form * @return self
* *
* @throws \OutOfBoundsException If the named child does not exist. * @throws \OutOfBoundsException If the named child does not exist.
*/ */
@ -80,7 +80,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @param string $name The name of the child to remove * @param string $name The name of the child to remove
* *
* @return FormInterface The form instance * @return $this
* *
* @throws Exception\AlreadySubmittedException If the form has already been submitted. * @throws Exception\AlreadySubmittedException If the form has already been submitted.
*/ */
@ -89,7 +89,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
/** /**
* Returns all children in this group. * Returns all children in this group.
* *
* @return FormInterface[] An array of FormInterface instances * @return self[]
*/ */
public function all(); public function all();
@ -110,7 +110,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @param mixed $modelData The data formatted as expected for the underlying object * @param mixed $modelData The data formatted as expected for the underlying object
* *
* @return FormInterface The form instance * @return $this
* *
* @throws Exception\AlreadySubmittedException If the form has already been submitted. * @throws Exception\AlreadySubmittedException If the form has already been submitted.
* @throws Exception\LogicException If listeners try to call setData in a cycle. Or if * @throws Exception\LogicException If listeners try to call setData in a cycle. Or if
@ -182,7 +182,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @param FormError $error * @param FormError $error
* *
* @return FormInterface The form instance * @return $this
*/ */
public function addError(FormError $error); public function addError(FormError $error);
@ -248,7 +248,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* Should be called on the root form after constructing the tree. * Should be called on the root form after constructing the tree.
* *
* @return FormInterface The form instance * @return $this
*/ */
public function initialize(); public function initialize();
@ -262,7 +262,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @param mixed $request The request to handle * @param mixed $request The request to handle
* *
* @return FormInterface The form instance * @return $this
*/ */
public function handleRequest($request = null); public function handleRequest($request = null);
@ -274,7 +274,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* when they are missing in the * when they are missing in the
* submitted data. * submitted data.
* *
* @return FormInterface The form instance * @return $this
* *
* @throws Exception\AlreadySubmittedException If the form has already been submitted. * @throws Exception\AlreadySubmittedException If the form has already been submitted.
*/ */
@ -283,7 +283,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
/** /**
* Returns the root of the form tree. * Returns the root of the form tree.
* *
* @return FormInterface The root of the tree * @return self The root of the tree
*/ */
public function getRoot(); public function getRoot();

View File

@ -81,7 +81,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* Marks the view as rendered. * Marks the view as rendered.
* *
* @return FormView The view object * @return $this
*/ */
public function setRendered() public function setRendered()
{ {
@ -95,7 +95,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
* *
* @param string $name The child name * @param string $name The child name
* *
* @return FormView The child view * @return self The child view
*/ */
public function offsetGet($name) public function offsetGet($name)
{ {

View File

@ -70,7 +70,7 @@ abstract class Guess
* *
* @param Guess[] $guesses An array of guesses * @param Guess[] $guesses An array of guesses
* *
* @return Guess|null The guess with the highest confidence * @return self|null
*/ */
public static function getBestGuess(array $guesses) public static function getBestGuess(array $guesses)
{ {

View File

@ -37,7 +37,7 @@ class SubmitButton extends Button implements ClickableInterface
* @param null|string $submittedData The data * @param null|string $submittedData The data
* @param bool $clearMissing Not used * @param bool $clearMissing Not used
* *
* @return SubmitButton The button instance * @return $this
* *
* @throws Exception\AlreadySubmittedException If the form has already been submitted. * @throws Exception\AlreadySubmittedException If the form has already been submitted.
*/ */

View File

@ -48,7 +48,7 @@ class AcceptHeader
* *
* @param string $headerValue * @param string $headerValue
* *
* @return AcceptHeader * @return self
*/ */
public static function fromString($headerValue) public static function fromString($headerValue)
{ {
@ -101,7 +101,7 @@ class AcceptHeader
* *
* @param AcceptHeaderItem $item * @param AcceptHeaderItem $item
* *
* @return AcceptHeader * @return $this
*/ */
public function add(AcceptHeaderItem $item) public function add(AcceptHeaderItem $item)
{ {
@ -128,7 +128,7 @@ class AcceptHeader
* *
* @param string $pattern * @param string $pattern
* *
* @return AcceptHeader * @return self
*/ */
public function filter($pattern) public function filter($pattern)
{ {

View File

@ -57,7 +57,7 @@ class AcceptHeaderItem
* *
* @param string $itemValue * @param string $itemValue
* *
* @return AcceptHeaderItem * @return self
*/ */
public static function fromString($itemValue) public static function fromString($itemValue)
{ {
@ -103,7 +103,7 @@ class AcceptHeaderItem
* *
* @param string $value * @param string $value
* *
* @return AcceptHeaderItem * @return $this
*/ */
public function setValue($value) public function setValue($value)
{ {
@ -127,7 +127,7 @@ class AcceptHeaderItem
* *
* @param float $quality * @param float $quality
* *
* @return AcceptHeaderItem * @return $this
*/ */
public function setQuality($quality) public function setQuality($quality)
{ {
@ -151,7 +151,7 @@ class AcceptHeaderItem
* *
* @param int $index * @param int $index
* *
* @return AcceptHeaderItem * @return $this
*/ */
public function setIndex($index) public function setIndex($index)
{ {
@ -211,7 +211,7 @@ class AcceptHeaderItem
* @param string $name * @param string $name
* @param string $value * @param string $value
* *
* @return AcceptHeaderItem * @return $this
*/ */
public function setAttribute($name, $value) public function setAttribute($name, $value)
{ {

View File

@ -66,7 +66,7 @@ class BinaryFileResponse extends Response
* @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoEtag Whether the ETag header should be automatically set
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set
* *
* @return BinaryFileResponse The created response * @return static
*/ */
public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
{ {
@ -81,7 +81,7 @@ class BinaryFileResponse extends Response
* @param bool $autoEtag * @param bool $autoEtag
* @param bool $autoLastModified * @param bool $autoLastModified
* *
* @return BinaryFileResponse * @return $this
* *
* @throws FileException * @throws FileException
*/ */
@ -153,7 +153,7 @@ class BinaryFileResponse extends Response
* @param string $filename Optionally use this filename instead of the real name of the file * @param string $filename Optionally use this filename instead of the real name of the file
* @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename * @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename
* *
* @return BinaryFileResponse * @return $this
*/ */
public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') public function setContentDisposition($disposition, $filename = '', $filenameFallback = '')
{ {
@ -348,7 +348,7 @@ class BinaryFileResponse extends Response
* *
* @param bool $shouldDelete * @param bool $shouldDelete
* *
* @return BinaryFileResponse * @return $this
*/ */
public function deleteFileAfterSend($shouldDelete) public function deleteFileAfterSend($shouldDelete)
{ {

View File

@ -85,7 +85,7 @@ class File extends \SplFileInfo
* @param string $directory The destination folder * @param string $directory The destination folder
* @param string $name The new file name * @param string $name The new file name
* *
* @return File A File object representing the new file * @return self A File object representing the new file
* *
* @throws FileException if the target file could not be created * @throws FileException if the target file could not be created
*/ */

View File

@ -42,7 +42,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
/** /**
* Returns the singleton instance. * Returns the singleton instance.
* *
* @return ExtensionGuesser * @return self
*/ */
public static function getInstance() public static function getInstance()
{ {

View File

@ -56,7 +56,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
/** /**
* Returns the singleton instance. * Returns the singleton instance.
* *
* @return MimeTypeGuesser * @return self
*/ */
public static function getInstance() public static function getInstance()
{ {

View File

@ -62,7 +62,7 @@ class JsonResponse extends Response
* @param int $status The response status code * @param int $status The response status code
* @param array $headers An array of response headers * @param array $headers An array of response headers
* *
* @return JsonResponse * @return static
*/ */
public static function create($data = null, $status = 200, $headers = array()) public static function create($data = null, $status = 200, $headers = array())
{ {
@ -74,7 +74,7 @@ class JsonResponse extends Response
* *
* @param string|null $callback The JSONP callback or null to use none * @param string|null $callback The JSONP callback or null to use none
* *
* @return JsonResponse * @return $this
* *
* @throws \InvalidArgumentException When the callback name is not valid * @throws \InvalidArgumentException When the callback name is not valid
*/ */
@ -125,7 +125,7 @@ class JsonResponse extends Response
* *
* @param mixed $data * @param mixed $data
* *
* @return JsonResponse * @return $this
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
@ -172,7 +172,7 @@ class JsonResponse extends Response
* *
* @param int $encodingOptions * @param int $encodingOptions
* *
* @return JsonResponse * @return $this
*/ */
public function setEncodingOptions($encodingOptions) public function setEncodingOptions($encodingOptions)
{ {
@ -184,7 +184,7 @@ class JsonResponse extends Response
/** /**
* Updates the content and headers according to the JSON data and callback. * Updates the content and headers according to the JSON data and callback.
* *
* @return JsonResponse * @return $this
*/ */
protected function update() protected function update()
{ {

View File

@ -66,7 +66,7 @@ class RedirectResponse extends Response
* *
* @param string $url The URL to redirect to * @param string $url The URL to redirect to
* *
* @return RedirectResponse The current response * @return $this
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */

View File

@ -261,7 +261,7 @@ class Request
/** /**
* Creates a new request with values from PHP's super globals. * Creates a new request with values from PHP's super globals.
* *
* @return Request A new request * @return static
*/ */
public static function createFromGlobals() public static function createFromGlobals()
{ {
@ -304,7 +304,7 @@ class Request
* @param array $server The server parameters ($_SERVER) * @param array $server The server parameters ($_SERVER)
* @param string $content The raw body data * @param string $content The raw body data
* *
* @return Request A Request instance * @return static
*/ */
public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
{ {
@ -422,7 +422,7 @@ class Request
* @param array $files The FILES parameters * @param array $files The FILES parameters
* @param array $server The SERVER parameters * @param array $server The SERVER parameters
* *
* @return Request The duplicated request * @return static
*/ */
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
{ {

View File

@ -215,7 +215,7 @@ class Response
* @param int $status The response status code * @param int $status The response status code
* @param array $headers An array of response headers * @param array $headers An array of response headers
* *
* @return Response * @return static
*/ */
public static function create($content = '', $status = 200, $headers = array()) public static function create($content = '', $status = 200, $headers = array())
{ {
@ -258,7 +258,7 @@ class Response
* *
* @param Request $request A Request instance * @param Request $request A Request instance
* *
* @return Response The current response * @return $this
*/ */
public function prepare(Request $request) public function prepare(Request $request)
{ {
@ -320,7 +320,7 @@ class Response
/** /**
* Sends HTTP headers. * Sends HTTP headers.
* *
* @return Response * @return $this
*/ */
public function sendHeaders() public function sendHeaders()
{ {
@ -358,7 +358,7 @@ class Response
/** /**
* Sends content for the current web response. * Sends content for the current web response.
* *
* @return Response * @return $this
*/ */
public function sendContent() public function sendContent()
{ {
@ -370,7 +370,7 @@ class Response
/** /**
* Sends HTTP headers and content. * Sends HTTP headers and content.
* *
* @return Response * @return $this
*/ */
public function send() public function send()
{ {
@ -393,7 +393,7 @@ class Response
* *
* @param mixed $content Content that can be cast to string * @param mixed $content Content that can be cast to string
* *
* @return Response * @return $this
* *
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
@ -423,7 +423,7 @@ class Response
* *
* @param string $version The HTTP protocol version * @param string $version The HTTP protocol version
* *
* @return Response * @return $this
*/ */
public function setProtocolVersion($version) public function setProtocolVersion($version)
{ {
@ -451,7 +451,7 @@ class Response
* If the status text is null it will be automatically populated for the known * If the status text is null it will be automatically populated for the known
* status codes and left empty otherwise. * status codes and left empty otherwise.
* *
* @return Response * @return $this
* *
* @throws \InvalidArgumentException When the HTTP status code is not valid * @throws \InvalidArgumentException When the HTTP status code is not valid
*/ */
@ -494,7 +494,7 @@ class Response
* *
* @param string $charset Character set * @param string $charset Character set
* *
* @return Response * @return $this
*/ */
public function setCharset($charset) public function setCharset($charset)
{ {
@ -567,7 +567,7 @@ class Response
* *
* It makes the response ineligible for serving other clients. * It makes the response ineligible for serving other clients.
* *
* @return Response * @return $this
*/ */
public function setPrivate() public function setPrivate()
{ {
@ -582,7 +582,7 @@ class Response
* *
* It makes the response eligible for serving other clients. * It makes the response eligible for serving other clients.
* *
* @return Response * @return $this
*/ */
public function setPublic() public function setPublic()
{ {
@ -628,7 +628,7 @@ class Response
* *
* @param \DateTime $date A \DateTime instance * @param \DateTime $date A \DateTime instance
* *
* @return Response * @return $this
*/ */
public function setDate(\DateTime $date) public function setDate(\DateTime $date)
{ {
@ -655,7 +655,7 @@ class Response
/** /**
* Marks the response stale by setting the Age header to be equal to the maximum age of the response. * Marks the response stale by setting the Age header to be equal to the maximum age of the response.
* *
* @return Response * @return $this
*/ */
public function expire() public function expire()
{ {
@ -688,7 +688,7 @@ class Response
* *
* @param \DateTime|null $date A \DateTime instance or null to remove the header * @param \DateTime|null $date A \DateTime instance or null to remove the header
* *
* @return Response * @return $this
*/ */
public function setExpires(\DateTime $date = null) public function setExpires(\DateTime $date = null)
{ {
@ -734,7 +734,7 @@ class Response
* *
* @param int $value Number of seconds * @param int $value Number of seconds
* *
* @return Response * @return $this
*/ */
public function setMaxAge($value) public function setMaxAge($value)
{ {
@ -750,7 +750,7 @@ class Response
* *
* @param int $value Number of seconds * @param int $value Number of seconds
* *
* @return Response * @return $this
*/ */
public function setSharedMaxAge($value) public function setSharedMaxAge($value)
{ {
@ -784,7 +784,7 @@ class Response
* *
* @param int $seconds Number of seconds * @param int $seconds Number of seconds
* *
* @return Response * @return $this
*/ */
public function setTtl($seconds) public function setTtl($seconds)
{ {
@ -800,7 +800,7 @@ class Response
* *
* @param int $seconds Number of seconds * @param int $seconds Number of seconds
* *
* @return Response * @return $this
*/ */
public function setClientTtl($seconds) public function setClientTtl($seconds)
{ {
@ -828,7 +828,7 @@ class Response
* *
* @param \DateTime|null $date A \DateTime instance or null to remove the header * @param \DateTime|null $date A \DateTime instance or null to remove the header
* *
* @return Response * @return $this
*/ */
public function setLastModified(\DateTime $date = null) public function setLastModified(\DateTime $date = null)
{ {
@ -859,7 +859,7 @@ class Response
* @param string|null $etag The ETag unique identifier or null to remove the header * @param string|null $etag The ETag unique identifier or null to remove the header
* @param bool $weak Whether you want a weak ETag or not * @param bool $weak Whether you want a weak ETag or not
* *
* @return Response * @return $this
*/ */
public function setEtag($etag = null, $weak = false) public function setEtag($etag = null, $weak = false)
{ {
@ -883,7 +883,7 @@ class Response
* *
* @param array $options An array of cache options * @param array $options An array of cache options
* *
* @return Response * @return $this
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
@ -934,7 +934,7 @@ class Response
* This sets the status, removes the body, and discards any headers * This sets the status, removes the body, and discards any headers
* that MUST NOT be included in 304 responses. * that MUST NOT be included in 304 responses.
* *
* @return Response * @return $this
* *
* @see http://tools.ietf.org/html/rfc2616#section-10.3.5 * @see http://tools.ietf.org/html/rfc2616#section-10.3.5
*/ */
@ -986,7 +986,7 @@ class Response
* @param string|array $headers * @param string|array $headers
* @param bool $replace Whether to replace the actual value or not (true by default) * @param bool $replace Whether to replace the actual value or not (true by default)
* *
* @return Response * @return $this
*/ */
public function setVary($headers, $replace = true) public function setVary($headers, $replace = true)
{ {

View File

@ -55,7 +55,7 @@ class StreamedResponse extends Response
* @param int $status The response status code * @param int $status The response status code
* @param array $headers An array of response headers * @param array $headers An array of response headers
* *
* @return StreamedResponse * @return static
*/ */
public static function create($callback = null, $status = 200, $headers = array()) public static function create($callback = null, $status = 200, $headers = array())
{ {

View File

@ -76,7 +76,7 @@ class Profile
/** /**
* Sets the parent token. * Sets the parent token.
* *
* @param Profile $parent The parent Profile * @param Profile $parent
*/ */
public function setParent(Profile $parent) public function setParent(Profile $parent)
{ {
@ -86,7 +86,7 @@ class Profile
/** /**
* Returns the parent profile. * Returns the parent profile.
* *
* @return Profile The parent profile * @return self
*/ */
public function getParent() public function getParent()
{ {
@ -191,7 +191,7 @@ class Profile
/** /**
* Finds children profilers. * Finds children profilers.
* *
* @return Profile[] An array of Profile * @return self[]
*/ */
public function getChildren() public function getChildren()
{ {
@ -201,7 +201,7 @@ class Profile
/** /**
* Sets children profiler. * Sets children profiler.
* *
* @param Profile[] $children An array of Profile * @param Profile[] $children
*/ */
public function setChildren(array $children) public function setChildren(array $children)
{ {
@ -214,7 +214,7 @@ class Profile
/** /**
* Adds the child token. * Adds the child token.
* *
* @param Profile $child The child Profile * @param Profile $child
*/ */
public function addChild(Profile $child) public function addChild(Profile $child)
{ {

View File

@ -88,7 +88,7 @@ class Collator
* *
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* *
* @return Collator * @return self
* *
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
*/ */

View File

@ -173,7 +173,7 @@ class IntlDateFormatter
* One of the calendar constants. * One of the calendar constants.
* @param string $pattern Optional pattern to use when formatting * @param string $pattern Optional pattern to use when formatting
* *
* @return IntlDateFormatter * @return self
* *
* @see http://www.php.net/manual/en/intldateformatter.create.php * @see http://www.php.net/manual/en/intldateformatter.create.php
* @see http://userguide.icu-project.org/formatparse/datetime * @see http://userguide.icu-project.org/formatparse/datetime

View File

@ -304,7 +304,7 @@ class NumberFormatter
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
* *
* @return NumberFormatter * @return self
* *
* @see http://www.php.net/manual/en/numberformatter.create.php * @see http://www.php.net/manual/en/numberformatter.create.php
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details * @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details

View File

@ -42,7 +42,7 @@ class SvnRepository
* @param string $url The URL to download from * @param string $url The URL to download from
* @param string $targetDir The directory in which to store the repository * @param string $targetDir The directory in which to store the repository
* *
* @return SvnRepository The directory where the data is stored * @return static
* *
* @throws RuntimeException If an error occurs during the download. * @throws RuntimeException If an error occurs during the download.
*/ */

View File

@ -145,7 +145,7 @@ class OptionsResolver implements Options
* @param string $option The name of the option * @param string $option The name of the option
* @param mixed $value The default value of the option * @param mixed $value The default value of the option
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
*/ */
@ -208,7 +208,7 @@ class OptionsResolver implements Options
* *
* @param array $defaults The default values to set * @param array $defaults The default values to set
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
*/ */
@ -241,7 +241,7 @@ class OptionsResolver implements Options
* *
* @param string|string[] $optionNames One or more option names * @param string|string[] $optionNames One or more option names
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
*/ */
@ -322,7 +322,7 @@ class OptionsResolver implements Options
* *
* @param string|string[] $optionNames One or more option names * @param string|string[] $optionNames One or more option names
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
*/ */
@ -389,7 +389,7 @@ class OptionsResolver implements Options
* @param string $option The option name * @param string $option The option name
* @param \Closure $normalizer The normalizer * @param \Closure $normalizer The normalizer
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws UndefinedOptionsException If the option is undefined * @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
@ -432,7 +432,7 @@ class OptionsResolver implements Options
* @param string $option The option name * @param string $option The option name
* @param mixed $allowedValues One or more acceptable values/closures * @param mixed $allowedValues One or more acceptable values/closures
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws UndefinedOptionsException If the option is undefined * @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
@ -477,7 +477,7 @@ class OptionsResolver implements Options
* @param string $option The option name * @param string $option The option name
* @param mixed $allowedValues One or more acceptable values/closures * @param mixed $allowedValues One or more acceptable values/closures
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws UndefinedOptionsException If the option is undefined * @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
@ -522,7 +522,7 @@ class OptionsResolver implements Options
* @param string $option The option name * @param string $option The option name
* @param string|string[] $allowedTypes One or more accepted types * @param string|string[] $allowedTypes One or more accepted types
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws UndefinedOptionsException If the option is undefined * @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
@ -561,7 +561,7 @@ class OptionsResolver implements Options
* @param string $option The option name * @param string $option The option name
* @param string|string[] $allowedTypes One or more accepted types * @param string|string[] $allowedTypes One or more accepted types
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws UndefinedOptionsException If the option is undefined * @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
@ -599,7 +599,7 @@ class OptionsResolver implements Options
* *
* @param string|string[] $optionNames One or more option names * @param string|string[] $optionNames One or more option names
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
*/ */
@ -620,7 +620,7 @@ class OptionsResolver implements Options
/** /**
* Removes all options. * Removes all options.
* *
* @return OptionsResolver This instance * @return $this
* *
* @throws AccessException If called from a lazy option or normalizer * @throws AccessException If called from a lazy option or normalizer
*/ */

View File

@ -318,7 +318,7 @@ class Process implements \IteratorAggregate
* @param callable|null $callback A PHP callback to run whenever there is some * @param callable|null $callback A PHP callback to run whenever there is some
* output available on STDOUT or STDERR * output available on STDOUT or STDERR
* *
* @return Process The new process * @return $this
* *
* @throws RuntimeException When process can't be launched * @throws RuntimeException When process can't be launched
* @throws RuntimeException When process is already running * @throws RuntimeException When process is already running
@ -398,7 +398,7 @@ class Process implements \IteratorAggregate
* *
* @param int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php) * @param int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
* *
* @return Process * @return $this
* *
* @throws LogicException In case the process is not running * @throws LogicException In case the process is not running
* @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
@ -414,7 +414,7 @@ class Process implements \IteratorAggregate
/** /**
* Disables fetching output and error output from the underlying process. * Disables fetching output and error output from the underlying process.
* *
* @return Process * @return $this
* *
* @throws RuntimeException In case the process is already running * @throws RuntimeException In case the process is already running
* @throws LogicException if an idle timeout is set * @throws LogicException if an idle timeout is set
@ -436,7 +436,7 @@ class Process implements \IteratorAggregate
/** /**
* Enables fetching output and error output from the underlying process. * Enables fetching output and error output from the underlying process.
* *
* @return Process * @return $this
* *
* @throws RuntimeException In case the process is already running * @throws RuntimeException In case the process is already running
*/ */
@ -565,7 +565,7 @@ class Process implements \IteratorAggregate
/** /**
* Clears the process output. * Clears the process output.
* *
* @return Process * @return $this
*/ */
public function clearOutput() public function clearOutput()
{ {
@ -624,7 +624,7 @@ class Process implements \IteratorAggregate
/** /**
* Clears the process output. * Clears the process output.
* *
* @return Process * @return $this
*/ */
public function clearErrorOutput() public function clearErrorOutput()
{ {

View File

@ -46,7 +46,7 @@ class ProcessBuilder
* *
* @param string[] $arguments An array of arguments * @param string[] $arguments An array of arguments
* *
* @return ProcessBuilder * @return static
*/ */
public static function create(array $arguments = array()) public static function create(array $arguments = array())
{ {
@ -58,7 +58,7 @@ class ProcessBuilder
* *
* @param string $argument A command argument * @param string $argument A command argument
* *
* @return ProcessBuilder * @return $this
*/ */
public function add($argument) public function add($argument)
{ {
@ -74,7 +74,7 @@ class ProcessBuilder
* *
* @param string|array $prefix A command prefix or an array of command prefixes * @param string|array $prefix A command prefix or an array of command prefixes
* *
* @return ProcessBuilder * @return $this
*/ */
public function setPrefix($prefix) public function setPrefix($prefix)
{ {
@ -91,7 +91,7 @@ class ProcessBuilder
* *
* @param string[] $arguments * @param string[] $arguments
* *
* @return ProcessBuilder * @return $this
*/ */
public function setArguments(array $arguments) public function setArguments(array $arguments)
{ {
@ -105,7 +105,7 @@ class ProcessBuilder
* *
* @param null|string $cwd The working directory * @param null|string $cwd The working directory
* *
* @return ProcessBuilder * @return $this
*/ */
public function setWorkingDirectory($cwd) public function setWorkingDirectory($cwd)
{ {
@ -119,7 +119,7 @@ class ProcessBuilder
* *
* @param bool $inheritEnv * @param bool $inheritEnv
* *
* @return ProcessBuilder * @return $this
*/ */
public function inheritEnvironmentVariables($inheritEnv = true) public function inheritEnvironmentVariables($inheritEnv = true)
{ {
@ -137,7 +137,7 @@ class ProcessBuilder
* @param string $name The variable name * @param string $name The variable name
* @param null|string $value The variable value * @param null|string $value The variable value
* *
* @return ProcessBuilder * @return $this
*/ */
public function setEnv($name, $value) public function setEnv($name, $value)
{ {
@ -155,7 +155,7 @@ class ProcessBuilder
* *
* @param array $variables The variables * @param array $variables The variables
* *
* @return ProcessBuilder * @return $this
*/ */
public function addEnvironmentVariables(array $variables) public function addEnvironmentVariables(array $variables)
{ {
@ -169,7 +169,7 @@ class ProcessBuilder
* *
* @param resource|scalar|\Traversable|null $input The input content * @param resource|scalar|\Traversable|null $input The input content
* *
* @return ProcessBuilder * @return $this
* *
* @throws InvalidArgumentException In case the argument is invalid * @throws InvalidArgumentException In case the argument is invalid
*/ */
@ -187,7 +187,7 @@ class ProcessBuilder
* *
* @param float|null $timeout * @param float|null $timeout
* *
* @return ProcessBuilder * @return $this
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
@ -216,7 +216,7 @@ class ProcessBuilder
* @param string $name The option name * @param string $name The option name
* @param string $value The option value * @param string $value The option value
* *
* @return ProcessBuilder * @return $this
*/ */
public function setOption($name, $value) public function setOption($name, $value)
{ {
@ -228,7 +228,7 @@ class ProcessBuilder
/** /**
* Disables fetching output and error output from the underlying process. * Disables fetching output and error output from the underlying process.
* *
* @return ProcessBuilder * @return $this
*/ */
public function disableOutput() public function disableOutput()
{ {
@ -240,7 +240,7 @@ class ProcessBuilder
/** /**
* Enables fetching output and error output from the underlying process. * Enables fetching output and error output from the underlying process.
* *
* @return ProcessBuilder * @return $this
*/ */
public function enableOutput() public function enableOutput()
{ {

View File

@ -21,7 +21,7 @@ final class PropertyAccess
/** /**
* Creates a property accessor with the default configuration. * Creates a property accessor with the default configuration.
* *
* @return PropertyAccessor The new property accessor * @return PropertyAccessor
*/ */
public static function createPropertyAccessor() public static function createPropertyAccessor()
{ {
@ -31,7 +31,7 @@ final class PropertyAccess
/** /**
* Creates a property accessor builder. * Creates a property accessor builder.
* *
* @return PropertyAccessorBuilder The new property accessor builder * @return PropertyAccessor
*/ */
public static function createPropertyAccessorBuilder() public static function createPropertyAccessorBuilder()
{ {

View File

@ -31,7 +31,7 @@ class PropertyAccessorBuilder
/** /**
* Enables the use of "__call" by the PropertyAccessor. * Enables the use of "__call" by the PropertyAccessor.
* *
* @return PropertyAccessorBuilder The builder object * @return $this
*/ */
public function enableMagicCall() public function enableMagicCall()
{ {
@ -43,7 +43,7 @@ class PropertyAccessorBuilder
/** /**
* Disables the use of "__call" by the PropertyAccessor. * Disables the use of "__call" by the PropertyAccessor.
* *
* @return PropertyAccessorBuilder The builder object * @return $this
*/ */
public function disableMagicCall() public function disableMagicCall()
{ {
@ -66,7 +66,7 @@ class PropertyAccessorBuilder
* This has no influence on writing non-existing indices with PropertyAccessorInterface::setValue() * This has no influence on writing non-existing indices with PropertyAccessorInterface::setValue()
* which are always created on-the-fly. * which are always created on-the-fly.
* *
* @return PropertyAccessorBuilder The builder object * @return $this
*/ */
public function enableExceptionOnInvalidIndex() public function enableExceptionOnInvalidIndex()
{ {
@ -80,7 +80,7 @@ class PropertyAccessorBuilder
* *
* Instead, null is returned when calling PropertyAccessorInterface::getValue() on a non-existing index. * Instead, null is returned when calling PropertyAccessorInterface::getValue() on a non-existing index.
* *
* @return PropertyAccessorBuilder The builder object * @return $this
*/ */
public function disableExceptionOnInvalidIndex() public function disableExceptionOnInvalidIndex()
{ {

View File

@ -86,7 +86,7 @@ class DumperCollection implements \IteratorAggregate
/** /**
* Returns the root of the collection. * Returns the root of the collection.
* *
* @return DumperCollection The root collection * @return self The root collection
*/ */
public function getRoot() public function getRoot()
{ {

View File

@ -50,7 +50,7 @@ class DumperPrefixCollection extends DumperCollection
* *
* @param DumperRoute $route The route * @param DumperRoute $route The route
* *
* @return DumperPrefixCollection The node the route was added to * @return self
* *
* @throws \LogicException * @throws \LogicException
*/ */

View File

@ -66,7 +66,7 @@ class RequestContext
* *
* @param Request $request A Request instance * @param Request $request A Request instance
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function fromRequest(Request $request) public function fromRequest(Request $request)
{ {
@ -97,7 +97,7 @@ class RequestContext
* *
* @param string $baseUrl The base URL * @param string $baseUrl The base URL
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setBaseUrl($baseUrl) public function setBaseUrl($baseUrl)
{ {
@ -121,7 +121,7 @@ class RequestContext
* *
* @param string $pathInfo The path info * @param string $pathInfo The path info
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setPathInfo($pathInfo) public function setPathInfo($pathInfo)
{ {
@ -147,7 +147,7 @@ class RequestContext
* *
* @param string $method The HTTP method * @param string $method The HTTP method
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setMethod($method) public function setMethod($method)
{ {
@ -173,7 +173,7 @@ class RequestContext
* *
* @param string $host The HTTP host * @param string $host The HTTP host
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setHost($host) public function setHost($host)
{ {
@ -197,7 +197,7 @@ class RequestContext
* *
* @param string $scheme The HTTP scheme * @param string $scheme The HTTP scheme
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setScheme($scheme) public function setScheme($scheme)
{ {
@ -221,7 +221,7 @@ class RequestContext
* *
* @param int $httpPort The HTTP port * @param int $httpPort The HTTP port
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setHttpPort($httpPort) public function setHttpPort($httpPort)
{ {
@ -245,7 +245,7 @@ class RequestContext
* *
* @param int $httpsPort The HTTPS port * @param int $httpsPort The HTTPS port
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setHttpsPort($httpsPort) public function setHttpsPort($httpsPort)
{ {
@ -269,7 +269,7 @@ class RequestContext
* *
* @param string $queryString The query string (after "?") * @param string $queryString The query string (after "?")
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setQueryString($queryString) public function setQueryString($queryString)
{ {
@ -294,7 +294,7 @@ class RequestContext
* *
* @param array $parameters The parameters * @param array $parameters The parameters
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setParameters(array $parameters) public function setParameters(array $parameters)
{ {
@ -333,7 +333,7 @@ class RequestContext
* @param string $name A parameter name * @param string $name A parameter name
* @param mixed $parameter The parameter value * @param mixed $parameter The parameter value
* *
* @return RequestContext The current instance, implementing a fluent interface * @return $this
*/ */
public function setParameter($name, $parameter) public function setParameter($name, $parameter)
{ {

View File

@ -149,7 +149,7 @@ class Route implements \Serializable
* *
* @param string $pattern The path pattern * @param string $pattern The path pattern
* *
* @return Route The current Route instance * @return $this
*/ */
public function setPath($pattern) public function setPath($pattern)
{ {
@ -178,7 +178,7 @@ class Route implements \Serializable
* *
* @param string $pattern The host pattern * @param string $pattern The host pattern
* *
* @return Route The current Route instance * @return $this
*/ */
public function setHost($pattern) public function setHost($pattern)
{ {
@ -207,7 +207,7 @@ class Route implements \Serializable
* *
* @param string|array $schemes The scheme or an array of schemes * @param string|array $schemes The scheme or an array of schemes
* *
* @return Route The current Route instance * @return $this
*/ */
public function setSchemes($schemes) public function setSchemes($schemes)
{ {
@ -248,7 +248,7 @@ class Route implements \Serializable
* *
* @param string|array $methods The method or an array of methods * @param string|array $methods The method or an array of methods
* *
* @return Route The current Route instance * @return $this
*/ */
public function setMethods($methods) public function setMethods($methods)
{ {
@ -275,7 +275,7 @@ class Route implements \Serializable
* *
* @param array $options The options * @param array $options The options
* *
* @return Route The current Route instance * @return $this
*/ */
public function setOptions(array $options) public function setOptions(array $options)
{ {
@ -293,7 +293,7 @@ class Route implements \Serializable
* *
* @param array $options The options * @param array $options The options
* *
* @return Route The current Route instance * @return $this
*/ */
public function addOptions(array $options) public function addOptions(array $options)
{ {
@ -313,7 +313,7 @@ class Route implements \Serializable
* @param string $name An option name * @param string $name An option name
* @param mixed $value The option value * @param mixed $value The option value
* *
* @return Route The current Route instance * @return $this
*/ */
public function setOption($name, $value) public function setOption($name, $value)
{ {
@ -364,7 +364,7 @@ class Route implements \Serializable
* *
* @param array $defaults The defaults * @param array $defaults The defaults
* *
* @return Route The current Route instance * @return $this
*/ */
public function setDefaults(array $defaults) public function setDefaults(array $defaults)
{ {
@ -380,7 +380,7 @@ class Route implements \Serializable
* *
* @param array $defaults The defaults * @param array $defaults The defaults
* *
* @return Route The current Route instance * @return $this
*/ */
public function addDefaults(array $defaults) public function addDefaults(array $defaults)
{ {
@ -422,7 +422,7 @@ class Route implements \Serializable
* @param string $name A variable name * @param string $name A variable name
* @param mixed $default The default value * @param mixed $default The default value
* *
* @return Route The current Route instance * @return $this
*/ */
public function setDefault($name, $default) public function setDefault($name, $default)
{ {
@ -449,7 +449,7 @@ class Route implements \Serializable
* *
* @param array $requirements The requirements * @param array $requirements The requirements
* *
* @return Route The current Route instance * @return $this
*/ */
public function setRequirements(array $requirements) public function setRequirements(array $requirements)
{ {
@ -465,7 +465,7 @@ class Route implements \Serializable
* *
* @param array $requirements The requirements * @param array $requirements The requirements
* *
* @return Route The current Route instance * @return $this
*/ */
public function addRequirements(array $requirements) public function addRequirements(array $requirements)
{ {
@ -507,7 +507,7 @@ class Route implements \Serializable
* @param string $key The key * @param string $key The key
* @param string $regex The regex * @param string $regex The regex
* *
* @return Route The current Route instance * @return $this
*/ */
public function setRequirement($key, $regex) public function setRequirement($key, $regex)
{ {
@ -534,7 +534,7 @@ class Route implements \Serializable
* *
* @param string $condition The condition * @param string $condition The condition
* *
* @return Route The current Route instance * @return $this
*/ */
public function setCondition($condition) public function setCondition($condition)
{ {

View File

@ -69,7 +69,7 @@ class Section
* *
* @param string|null $id null to create a new section, the identifier to re-open an existing one * @param string|null $id null to create a new section, the identifier to re-open an existing one
* *
* @return Section A child section * @return self
*/ */
public function open($id) public function open($id)
{ {
@ -93,7 +93,7 @@ class Section
* *
* @param string $id The session identifier * @param string $id The session identifier
* *
* @return Section The current section * @return $this
*/ */
public function setId($id) public function setId($id)
{ {

View File

@ -90,7 +90,7 @@ class Stopwatch
* @param string $name The event name * @param string $name The event name
* @param string $category The event category * @param string $category The event category
* *
* @return StopwatchEvent A StopwatchEvent instance * @return StopwatchEvent
*/ */
public function start($name, $category = null) public function start($name, $category = null)
{ {
@ -114,7 +114,7 @@ class Stopwatch
* *
* @param string $name The event name * @param string $name The event name
* *
* @return StopwatchEvent A StopwatchEvent instance * @return StopwatchEvent
*/ */
public function stop($name) public function stop($name)
{ {
@ -126,7 +126,7 @@ class Stopwatch
* *
* @param string $name The event name * @param string $name The event name
* *
* @return StopwatchEvent A StopwatchEvent instance * @return StopwatchEvent
*/ */
public function lap($name) public function lap($name)
{ {
@ -138,7 +138,7 @@ class Stopwatch
* *
* @param string $name The event name * @param string $name The event name
* *
* @return StopwatchEvent A StopwatchEvent instance * @return StopwatchEvent
*/ */
public function getEvent($name) public function getEvent($name)
{ {
@ -150,7 +150,7 @@ class Stopwatch
* *
* @param string $id A section identifier * @param string $id A section identifier
* *
* @return StopwatchEvent[] An array of StopwatchEvent instances * @return StopwatchEvent[]
*/ */
public function getSectionEvents($id) public function getSectionEvents($id)
{ {

View File

@ -75,7 +75,7 @@ class StopwatchEvent
/** /**
* Starts a new event period. * Starts a new event period.
* *
* @return StopwatchEvent The event * @return $this
*/ */
public function start() public function start()
{ {
@ -87,7 +87,7 @@ class StopwatchEvent
/** /**
* Stops the last started event period. * Stops the last started event period.
* *
* @return StopwatchEvent The event * @return $this
* *
* @throws \LogicException When stop() is called without a matching call to start() * @throws \LogicException When stop() is called without a matching call to start()
*/ */
@ -115,7 +115,7 @@ class StopwatchEvent
/** /**
* Stops the current period and then starts a new one. * Stops the current period and then starts a new one.
* *
* @return StopwatchEvent The event * @return $this
*/ */
public function lap() public function lap()
{ {

View File

@ -31,7 +31,7 @@ interface TemplateReferenceInterface
* @param string $name The parameter name * @param string $name The parameter name
* @param string $value The parameter value * @param string $value The parameter value
* *
* @return TemplateReferenceInterface The TemplateReferenceInterface instance * @return $this
* *
* @throws \InvalidArgumentException if the parameter name is not supported * @throws \InvalidArgumentException if the parameter name is not supported
*/ */

View File

@ -105,7 +105,7 @@ interface MessageCatalogueInterface
* *
* The two catalogues must have the same locale. * The two catalogues must have the same locale.
* *
* @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance * @param self $catalogue
*/ */
public function addCatalogue(MessageCatalogueInterface $catalogue); public function addCatalogue(MessageCatalogueInterface $catalogue);
@ -115,14 +115,14 @@ interface MessageCatalogueInterface
* *
* This is used to provide default translations when they do not exist for the current locale. * This is used to provide default translations when they do not exist for the current locale.
* *
* @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance * @param self $catalogue
*/ */
public function addFallbackCatalogue(MessageCatalogueInterface $catalogue); public function addFallbackCatalogue(MessageCatalogueInterface $catalogue);
/** /**
* Gets the fallback catalogue. * Gets the fallback catalogue.
* *
* @return MessageCatalogueInterface|null A MessageCatalogueInterface instance or null when no fallback has been set * @return self|null A MessageCatalogueInterface instance or null when no fallback has been set
*/ */
public function getFallbackCatalogue(); public function getFallbackCatalogue();

View File

@ -219,7 +219,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
* @param string $property The name of the property * @param string $property The name of the property
* @param Constraint $constraint The constraint * @param Constraint $constraint The constraint
* *
* @return ClassMetadata This object * @return $this
*/ */
public function addPropertyConstraint($property, Constraint $constraint) public function addPropertyConstraint($property, Constraint $constraint)
{ {
@ -240,7 +240,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
* @param string $property * @param string $property
* @param Constraint[] $constraints * @param Constraint[] $constraints
* *
* @return ClassMetadata * @return $this
*/ */
public function addPropertyConstraints($property, array $constraints) public function addPropertyConstraints($property, array $constraints)
{ {
@ -260,7 +260,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
* @param string $property The name of the property * @param string $property The name of the property
* @param Constraint $constraint The constraint * @param Constraint $constraint The constraint
* *
* @return ClassMetadata This object * @return $this
*/ */
public function addGetterConstraint($property, Constraint $constraint) public function addGetterConstraint($property, Constraint $constraint)
{ {
@ -281,7 +281,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
* @param string $property * @param string $property
* @param Constraint[] $constraints * @param Constraint[] $constraints
* *
* @return ClassMetadata * @return $this
*/ */
public function addGetterConstraints($property, array $constraints) public function addGetterConstraints($property, array $constraints)
{ {
@ -304,6 +304,10 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
} }
foreach ($source->getConstrainedProperties() as $property) { foreach ($source->getConstrainedProperties() as $property) {
if ($this->hasPropertyMetadata($property)) {
continue;
}
foreach ($source->getPropertyMetadata($property) as $member) { foreach ($source->getPropertyMetadata($property) as $member) {
$member = clone $member; $member = clone $member;
@ -360,7 +364,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface
* *
* @param array $groupSequence An array of group names * @param array $groupSequence An array of group names
* *
* @return ClassMetadata * @return $this
* *
* @throws GroupDefinitionException * @throws GroupDefinitionException
*/ */

View File

@ -116,7 +116,7 @@ class GenericMetadata implements MetadataInterface
* *
* @param Constraint $constraint The constraint to add * @param Constraint $constraint The constraint to add
* *
* @return GenericMetadata This object * @return $this
* *
* @throws ConstraintDefinitionException When trying to add the * @throws ConstraintDefinitionException When trying to add the
* {@link Traverse} constraint * {@link Traverse} constraint
@ -157,7 +157,7 @@ class GenericMetadata implements MetadataInterface
* *
* @param Constraint[] $constraints The constraints to add * @param Constraint[] $constraints The constraints to add
* *
* @return GenericMetadata This object * @return $this
*/ */
public function addConstraints(array $constraints) public function addConstraints(array $constraints)
{ {

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Tests\Mapping; namespace Symfony\Component\Validator\Tests\Mapping;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
@ -295,4 +296,29 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property'); $this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property');
} }
public function testMergeDoesOverrideConstraintsFromParentClassIfPropertyIsOverriddenInChildClass()
{
$parentMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ParentClass');
$parentMetadata->addPropertyConstraint('example', new GreaterThan(0));
$childMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ChildClass');
$childMetadata->addPropertyConstraint('example', new GreaterThan(1));
$childMetadata->mergeConstraints($parentMetadata);
$expectedMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ChildClass');
$expectedMetadata->addPropertyConstraint('example', new GreaterThan(1));
$this->assertEquals($expectedMetadata, $childMetadata);
}
}
class ParentClass
{
public $example = 0;
}
class ChildClass extends ParentClass
{
public $example = 1; // overrides parent property of same name
} }

View File

@ -29,7 +29,7 @@ interface ContextualValidatorInterface
* *
* @param string $path The path to append * @param string $path The path to append
* *
* @return ContextualValidatorInterface This validator * @return $this
*/ */
public function atPath($path); public function atPath($path);
@ -46,7 +46,7 @@ interface ContextualValidatorInterface
* validate. If none is given, * validate. If none is given,
* "Default" is assumed * "Default" is assumed
* *
* @return ContextualValidatorInterface This validator * @return $this
*/ */
public function validate($value, $constraints = null, $groups = null); public function validate($value, $constraints = null, $groups = null);
@ -59,7 +59,7 @@ interface ContextualValidatorInterface
* @param array|null $groups The validation groups to validate. If * @param array|null $groups The validation groups to validate. If
* none is given, "Default" is assumed * none is given, "Default" is assumed
* *
* @return ContextualValidatorInterface This validator * @return $this
*/ */
public function validateProperty($object, $propertyName, $groups = null); public function validateProperty($object, $propertyName, $groups = null);
@ -74,7 +74,7 @@ interface ContextualValidatorInterface
* @param array|null $groups The validation groups to validate. If * @param array|null $groups The validation groups to validate. If
* none is given, "Default" is assumed * none is given, "Default" is assumed
* *
* @return ContextualValidatorInterface This validator * @return $this
*/ */
public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);

View File

@ -29,7 +29,7 @@ interface ValidatorBuilderInterface
* *
* @param ObjectInitializerInterface $initializer The initializer * @param ObjectInitializerInterface $initializer The initializer
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addObjectInitializer(ObjectInitializerInterface $initializer); public function addObjectInitializer(ObjectInitializerInterface $initializer);
@ -38,7 +38,7 @@ interface ValidatorBuilderInterface
* *
* @param array $initializers The initializer * @param array $initializers The initializer
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addObjectInitializers(array $initializers); public function addObjectInitializers(array $initializers);
@ -47,7 +47,7 @@ interface ValidatorBuilderInterface
* *
* @param string $path The path to the mapping file * @param string $path The path to the mapping file
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addXmlMapping($path); public function addXmlMapping($path);
@ -56,7 +56,7 @@ interface ValidatorBuilderInterface
* *
* @param array $paths The paths to the mapping files * @param array $paths The paths to the mapping files
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addXmlMappings(array $paths); public function addXmlMappings(array $paths);
@ -65,7 +65,7 @@ interface ValidatorBuilderInterface
* *
* @param string $path The path to the mapping file * @param string $path The path to the mapping file
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addYamlMapping($path); public function addYamlMapping($path);
@ -74,7 +74,7 @@ interface ValidatorBuilderInterface
* *
* @param array $paths The paths to the mapping files * @param array $paths The paths to the mapping files
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addYamlMappings(array $paths); public function addYamlMappings(array $paths);
@ -83,7 +83,7 @@ interface ValidatorBuilderInterface
* *
* @param string $methodName The name of the method * @param string $methodName The name of the method
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addMethodMapping($methodName); public function addMethodMapping($methodName);
@ -92,7 +92,7 @@ interface ValidatorBuilderInterface
* *
* @param array $methodNames The names of the methods * @param array $methodNames The names of the methods
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function addMethodMappings(array $methodNames); public function addMethodMappings(array $methodNames);
@ -101,14 +101,14 @@ interface ValidatorBuilderInterface
* *
* @param Reader $annotationReader The annotation reader to be used * @param Reader $annotationReader The annotation reader to be used
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function enableAnnotationMapping(Reader $annotationReader = null); public function enableAnnotationMapping(Reader $annotationReader = null);
/** /**
* Disables annotation based constraint mapping. * Disables annotation based constraint mapping.
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function disableAnnotationMapping(); public function disableAnnotationMapping();
@ -117,7 +117,7 @@ interface ValidatorBuilderInterface
* *
* @param MetadataFactoryInterface $metadataFactory The metadata factory * @param MetadataFactoryInterface $metadataFactory The metadata factory
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function setMetadataFactory(MetadataFactoryInterface $metadataFactory); public function setMetadataFactory(MetadataFactoryInterface $metadataFactory);
@ -126,7 +126,7 @@ interface ValidatorBuilderInterface
* *
* @param CacheInterface $cache The cache instance * @param CacheInterface $cache The cache instance
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function setMetadataCache(CacheInterface $cache); public function setMetadataCache(CacheInterface $cache);
@ -135,7 +135,7 @@ interface ValidatorBuilderInterface
* *
* @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory * @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory); public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory);
@ -144,7 +144,7 @@ interface ValidatorBuilderInterface
* *
* @param TranslatorInterface $translator The translator instance * @param TranslatorInterface $translator The translator instance
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function setTranslator(TranslatorInterface $translator); public function setTranslator(TranslatorInterface $translator);
@ -157,7 +157,7 @@ interface ValidatorBuilderInterface
* *
* @param string $translationDomain The translation domain of the violation messages * @param string $translationDomain The translation domain of the violation messages
* *
* @return ValidatorBuilderInterface The builder object * @return $this
*/ */
public function setTranslationDomain($translationDomain); public function setTranslationDomain($translationDomain);

View File

@ -31,7 +31,7 @@ interface ConstraintViolationBuilderInterface
* *
* @param string $path The property path * @param string $path The property path
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
*/ */
public function atPath($path); public function atPath($path);
@ -41,7 +41,7 @@ interface ConstraintViolationBuilderInterface
* @param string $key The name of the parameter * @param string $key The name of the parameter
* @param string $value The value to be inserted in the parameter's place * @param string $value The value to be inserted in the parameter's place
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
*/ */
public function setParameter($key, $value); public function setParameter($key, $value);
@ -52,7 +52,7 @@ interface ConstraintViolationBuilderInterface
* the values to be inserted in their place as * the values to be inserted in their place as
* values * values
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
*/ */
public function setParameters(array $parameters); public function setParameters(array $parameters);
@ -62,7 +62,7 @@ interface ConstraintViolationBuilderInterface
* *
* @param string $translationDomain The translation domain * @param string $translationDomain The translation domain
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
* *
* @see \Symfony\Component\Translation\TranslatorInterface * @see \Symfony\Component\Translation\TranslatorInterface
*/ */
@ -73,7 +73,7 @@ interface ConstraintViolationBuilderInterface
* *
* @param mixed $invalidValue The invalid value * @param mixed $invalidValue The invalid value
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
*/ */
public function setInvalidValue($invalidValue); public function setInvalidValue($invalidValue);
@ -83,7 +83,7 @@ interface ConstraintViolationBuilderInterface
* *
* @param int $number The number for determining the plural form * @param int $number The number for determining the plural form
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
* *
* @see \Symfony\Component\Translation\TranslatorInterface::transChoice() * @see \Symfony\Component\Translation\TranslatorInterface::transChoice()
*/ */
@ -94,7 +94,7 @@ interface ConstraintViolationBuilderInterface
* *
* @param string|null $code The violation code * @param string|null $code The violation code
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
*/ */
public function setCode($code); public function setCode($code);
@ -103,7 +103,7 @@ interface ConstraintViolationBuilderInterface
* *
* @param mixed $cause The cause of the violation * @param mixed $cause The cause of the violation
* *
* @return ConstraintViolationBuilderInterface This builder * @return $this
*/ */
public function setCause($cause); public function setCause($cause);