Merge branch '3.1'

* 3.1:
  [VarDumper] Fix indentation trimming in ExceptionCaster
  [HttpKernel] Clarify deprecation of non-scalar values in surrogate renderer
  removed @since
  [Security] fixed DebugAccessDecisionManager::setVoters()
  Remove and change unrelevant comments in Validator and Security components.
  [Validator] add missing interface use statement for phpdoc block return type.
  [Validator] UuidValidator must accept a Uuid constraint.
  [Validator] make UuidValidator class formatting consistent.

Conflicts:
	src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
This commit is contained in:
Nicolas Grekas 2016-07-05 13:11:18 +02:00
commit 5213778822
57 changed files with 50 additions and 158 deletions

View File

@ -95,9 +95,9 @@ FrameworkBundle
HttpKernel HttpKernel
---------- ----------
* Passing objects as URI attributes to the ESI and SSI renderers has been * Passing non-scalar values as URI attributes to the ESI and SSI renderers has been
deprecated and will be removed in Symfony 4.0. The inline fragment deprecated and will be removed in Symfony 4.0. The inline fragment
renderer should be used with object attributes. renderer should be used with non-scalar attributes.
* The `ControllerResolver::getArguments()` method has been deprecated and will * The `ControllerResolver::getArguments()` method has been deprecated and will
be removed in 4.0. If you have your own `ControllerResolverInterface` be removed in 4.0. If you have your own `ControllerResolverInterface`

View File

@ -124,9 +124,9 @@ FrameworkBundle
HttpKernel HttpKernel
---------- ----------
* Possibility to pass objects as URI attributes to the ESI and SSI renderers * Possibility to pass non-scalar values as URI attributes to the ESI and SSI
has been removed. The inline fragment renderer should be used with object renderers has been removed. The inline fragment renderer should be used with
attributes. non-scalar attributes.
* The `ControllerResolver::getArguments()` method has been removed. If you * The `ControllerResolver::getArguments()` method has been removed. If you
have your own `ControllerResolverInterface` implementation, you should have your own `ControllerResolverInterface` implementation, you should

View File

@ -117,8 +117,6 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
* @param string $registerAliasMethodName Name of Configuration class method to * @param string $registerAliasMethodName Name of Configuration class method to
* register alias. * register alias.
* @param string[] $aliasMap Map of alias to namespace * @param string[] $aliasMap Map of alias to namespace
*
* @since Support for bundle alias was added in Symfony 2.6
*/ */
public function __construct($driver, array $namespaces, array $managerParameters, $driverPattern, $enabledParameter = false, $configurationPattern = '', $registerAliasMethodName = '', array $aliasMap = array()) public function __construct($driver, array $namespaces, array $managerParameters, $driverPattern, $enabledParameter = false, $configurationPattern = '', $registerAliasMethodName = '', array $aliasMap = array())
{ {

View File

@ -18,8 +18,6 @@ use Symfony\Component\Form\Exception\RuntimeException;
/** /**
* A utility for reading object IDs. * A utility for reading object IDs.
* *
* @since 1.0
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @internal This class is meant for internal use only. * @internal This class is meant for internal use only.

View File

@ -17,8 +17,6 @@ use Symfony\Component\Form\AbstractExtension;
/** /**
* Extension for collecting data of the forms on a page. * Extension for collecting data of the forms on a page.
* *
* @since 2.4
*
* @author Robert Schönthal <robert.schoenthal@gmail.com> * @author Robert Schönthal <robert.schoenthal@gmail.com>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -20,8 +20,6 @@ use Symfony\Component\Form\FormEvents;
* Listener that invokes a data collector for the {@link FormEvents::POST_SET_DATA} * Listener that invokes a data collector for the {@link FormEvents::POST_SET_DATA}
* and {@link FormEvents::POST_SUBMIT} events. * and {@link FormEvents::POST_SUBMIT} events.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class DataCollectorListener implements EventSubscriberInterface class DataCollectorListener implements EventSubscriberInterface

View File

@ -20,8 +20,6 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollector;
/** /**
* Data collector for {@link FormInterface} instances. * Data collector for {@link FormInterface} instances.
* *
* @since 2.4
*
* @author Robert Schönthal <robert.schoenthal@gmail.com> * @author Robert Schönthal <robert.schoenthal@gmail.com>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -18,8 +18,6 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
/** /**
* Collects and structures information about forms. * Collects and structures information about forms.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface FormDataCollectorInterface extends DataCollectorInterface interface FormDataCollectorInterface extends DataCollectorInterface

View File

@ -19,8 +19,6 @@ use Symfony\Component\Validator\ConstraintViolationInterface;
/** /**
* Default implementation of {@link FormDataExtractorInterface}. * Default implementation of {@link FormDataExtractorInterface}.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class FormDataExtractor implements FormDataExtractorInterface class FormDataExtractor implements FormDataExtractorInterface

View File

@ -17,8 +17,6 @@ use Symfony\Component\Form\FormView;
/** /**
* Extracts arrays of information out of forms. * Extracts arrays of information out of forms.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface FormDataExtractorInterface interface FormDataExtractorInterface

View File

@ -21,8 +21,6 @@ use Symfony\Component\Form\ResolvedFormTypeInterface;
/** /**
* Proxy that invokes a data collector when creating a form and its view. * Proxy that invokes a data collector when creating a form and its view.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface

View File

@ -20,8 +20,6 @@ use Symfony\Component\Form\ResolvedFormTypeInterface;
* Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy} * Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy}
* instances. * instances.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class ResolvedTypeFactoryDataCollectorProxy implements ResolvedFormTypeFactoryInterface class ResolvedTypeFactoryDataCollectorProxy implements ResolvedFormTypeFactoryInterface

View File

@ -19,8 +19,6 @@ use Symfony\Component\Form\FormBuilderInterface;
/** /**
* Type extension for collecting data of a form with this type. * Type extension for collecting data of a form with this type.
* *
* @since 2.4
*
* @author Robert Schönthal <robert.schoenthal@gmail.com> * @author Robert Schönthal <robert.schoenthal@gmail.com>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -27,8 +27,6 @@ use Symfony\Component\Form\Exception\BadMethodCallException;
* flatten the recursive structure into a flat list of errors. * flatten the recursive structure into a flat list of errors.
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*
* @since 2.5
*/ */
class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \ArrayAccess, \Countable class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \ArrayAccess, \Countable
{ {

View File

@ -102,9 +102,6 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* *
* @return FormErrorIterator An iterator over the {@link FormError} * @return FormErrorIterator An iterator over the {@link FormError}
* instances that where added to this form * instances that where added to this form
*
* @since 2.5 Since version 2.5 this method returns a
* {@link FormErrorIterator} instance instead of an array
*/ */
public function getErrors($deep = false, $flatten = true); public function getErrors($deep = false, $flatten = true);

View File

@ -62,8 +62,6 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
} }
/** /**
* @since Method available since Release 2.3.0
*
* @return int * @return int
*/ */
public function getMaxRunningTime() public function getMaxRunningTime()

View File

@ -63,8 +63,6 @@ namespace Symfony\Component\Form\Util;
* } * }
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*
* @since 2.2.6
*/ */
class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
{ {
@ -93,8 +91,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
* Creates a new map. * Creates a new map.
* *
* @param array $elements The elements to insert initially * @param array $elements The elements to insert initially
*
* @since 2.2.6
*/ */
public function __construct(array $elements = array()) public function __construct(array $elements = array())
{ {
@ -104,8 +100,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function offsetExists($key) public function offsetExists($key)
{ {
@ -114,8 +108,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function offsetGet($key) public function offsetGet($key)
{ {
@ -128,8 +120,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function offsetSet($key, $value) public function offsetSet($key, $value)
{ {
@ -151,8 +141,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function offsetUnset($key) public function offsetUnset($key)
{ {
@ -170,8 +158,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function getIterator() public function getIterator()
{ {
@ -180,8 +166,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function count() public function count()
{ {

View File

@ -17,8 +17,6 @@ namespace Symfony\Component\Form\Util;
* This class is internal and should not be used. * This class is internal and should not be used.
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*
* @since 2.2.6
*/ */
class OrderedHashMapIterator implements \Iterator class OrderedHashMapIterator implements \Iterator
{ {
@ -69,8 +67,6 @@ class OrderedHashMapIterator implements \Iterator
* This array is managed by the corresponding * This array is managed by the corresponding
* {@link OrderedHashMap} instance to support * {@link OrderedHashMap} instance to support
* recognizing the deletion of elements. * recognizing the deletion of elements.
*
* @since 2.2.6
*/ */
public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors) public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors)
{ {
@ -85,8 +81,6 @@ class OrderedHashMapIterator implements \Iterator
/** /**
* Removes the iterator's cursors from the managed cursors of the * Removes the iterator's cursors from the managed cursors of the
* corresponding {@link OrderedHashMap} instance. * corresponding {@link OrderedHashMap} instance.
*
* @since 2.2.6
*/ */
public function __destruct() public function __destruct()
{ {
@ -96,9 +90,7 @@ class OrderedHashMapIterator implements \Iterator
} }
/** /**
*{@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function current() public function current()
{ {
@ -107,8 +99,6 @@ class OrderedHashMapIterator implements \Iterator
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function next() public function next()
{ {
@ -124,9 +114,7 @@ class OrderedHashMapIterator implements \Iterator
} }
/** /**
*{@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function key() public function key()
{ {
@ -134,9 +122,7 @@ class OrderedHashMapIterator implements \Iterator
} }
/** /**
*{@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function valid() public function valid()
{ {
@ -144,9 +130,7 @@ class OrderedHashMapIterator implements \Iterator
} }
/** /**
*{@inheritdoc} * {@inheritdoc}
*
* @since 2.2.6
*/ */
public function rewind() public function rewind()
{ {

View File

@ -65,7 +65,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
{ {
if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) {
if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) {
@trigger_error('Passing objects as part of URI attributes to the ESI and SSI rendering strategies is deprecated since version 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since version 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED);
} }
return $this->inlineStrategy->render($uri, $request, $options); return $this->inlineStrategy->render($uri, $request, $options);

View File

@ -62,7 +62,7 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface
*/ */
public function setVoters(array $voters) public function setVoters(array $voters)
{ {
if (!$this->manager instanceof AccessDecisionManager) { if (!method_exists($this->manager, 'setVoters')) {
return; return;
} }

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\Security\Csrf;
/** /**
* Manages CSRF tokens. * Manages CSRF tokens.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface CsrfTokenManagerInterface interface CsrfTokenManagerInterface

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\Security\Csrf\TokenGenerator;
/** /**
* Generates CSRF tokens. * Generates CSRF tokens.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface TokenGeneratorInterface interface TokenGeneratorInterface

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\Security\Csrf\TokenGenerator;
/** /**
* Generates CSRF tokens. * Generates CSRF tokens.
* *
* @since 2.4
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com> * @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/ */
class UriSafeTokenGenerator implements TokenGeneratorInterface class UriSafeTokenGenerator implements TokenGeneratorInterface

View File

@ -16,8 +16,6 @@ use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException;
/** /**
* Token storage that uses PHP's native session handling. * Token storage that uses PHP's native session handling.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class NativeSessionTokenStorage implements TokenStorageInterface class NativeSessionTokenStorage implements TokenStorageInterface

View File

@ -15,9 +15,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException; use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException;
/** /**
* Token storage that uses a Symfony2 Session object. * Token storage that uses a Symfony Session object.
*
* @since 2.4
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\Security\Csrf\TokenStorage;
/** /**
* Stores CSRF tokens. * Stores CSRF tokens.
* *
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface TokenStorageInterface interface TokenStorageInterface

View File

@ -207,8 +207,6 @@ abstract class Constraint
* @throws InvalidOptionsException If an invalid option name is given * @throws InvalidOptionsException If an invalid option name is given
* *
* @internal This method should not be used or overwritten in userland code. * @internal This method should not be used or overwritten in userland code.
*
* @since 2.6
*/ */
public function __get($option) public function __get($option)
{ {
@ -296,8 +294,6 @@ abstract class Constraint
* @internal This method may be replaced by an implementation of * @internal This method may be replaced by an implementation of
* {@link \Serializable} in the future. Please don't use or * {@link \Serializable} in the future. Please don't use or
* overwrite it. * overwrite it.
*
* @since 2.6
*/ */
public function __sleep() public function __sleep()
{ {

View File

@ -23,8 +23,6 @@ class Callback extends Constraint
{ {
/** /**
* @var string|callable * @var string|callable
*
* @since 2.4
*/ */
public $callback; public $callback;

View File

@ -24,8 +24,6 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
* let {@link getCompositeOption()} return the name of the property which * let {@link getCompositeOption()} return the name of the property which
* contains the nested constraints. * contains the nested constraints.
* *
* @since 2.6
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
abstract class Composite extends Constraint abstract class Composite extends Constraint

View File

@ -17,8 +17,6 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/** /**
* @Annotation * @Annotation
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class Traverse extends Constraint class Traverse extends Constraint

View File

@ -64,6 +64,10 @@ class UuidValidator extends ConstraintValidator
return; return;
} }
if (!$constraint instanceof Uuid) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid');
}
if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedTypeException($value, 'string'); throw new UnexpectedTypeException($value, 'string');
} }
@ -179,10 +183,7 @@ class UuidValidator extends ConstraintValidator
if ('-' === $value{$i}) { if ('-' === $value{$i}) {
if ($i !== $h) { if ($i !== $h) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter( ->setParameter('{{ value }}', $this->formatValue($value))
'{{ value }}',
$this->formatValue($value)
)
->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR)
->addViolation(); ->addViolation();

View File

@ -26,8 +26,6 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;
/** /**
* The context used and created by {@link ExecutionContextFactory}. * The context used and created by {@link ExecutionContextFactory}.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @see ExecutionContextInterface * @see ExecutionContextInterface

View File

@ -17,8 +17,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* Creates new {@link ExecutionContext} instances. * Creates new {@link ExecutionContext} instances.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @internal You should not instantiate or use this class. Code against * @internal You should not instantiate or use this class. Code against

View File

@ -19,8 +19,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
* You can use a custom factory if you want to customize the execution context * You can use a custom factory if you want to customize the execution context
* that is passed through the validation run. * that is passed through the validation run.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface ExecutionContextFactoryInterface interface ExecutionContextFactoryInterface

View File

@ -57,8 +57,6 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
* cannot store a context and expect that the methods still return the same * cannot store a context and expect that the methods still return the same
* results later on. * results later on.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface ExecutionContextInterface interface ExecutionContextInterface

View File

@ -12,8 +12,6 @@
namespace Symfony\Component\Validator\Exception; namespace Symfony\Component\Validator\Exception;
/** /**
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class UnsupportedMetadataException extends InvalidArgumentException class UnsupportedMetadataException extends InvalidArgumentException

View File

@ -27,8 +27,6 @@ namespace Symfony\Component\Validator\Mapping;
* Although the constants currently represent a boolean switch, they are * Although the constants currently represent a boolean switch, they are
* implemented as bit mask in order to allow future extensions. * implemented as bit mask in order to allow future extensions.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @see TraversalStrategy * @see TraversalStrategy

View File

@ -21,8 +21,6 @@ namespace Symfony\Component\Validator\Mapping;
* by a group sequence for that class and whether instances of that class * by a group sequence for that class and whether instances of that class
* should be traversed or not. * should be traversed or not.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @see MetadataInterface * @see MetadataInterface

View File

@ -11,13 +11,12 @@
namespace Symfony\Component\Validator\Mapping\Factory; namespace Symfony\Component\Validator\Mapping\Factory;
use Symfony\Component\Validator\Exception; use Symfony\Component\Validator\Exception\NoSuchMetadataException;
use Symfony\Component\Validator\Mapping\MetadataInterface;
/** /**
* Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. * Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface MetadataFactoryInterface interface MetadataFactoryInterface
@ -29,7 +28,7 @@ interface MetadataFactoryInterface
* *
* @return MetadataInterface The metadata for the value * @return MetadataInterface The metadata for the value
* *
* @throws Exception\NoSuchMetadataException If no metadata exists for the given value * @throws NoSuchMetadataException If no metadata exists for the given value
*/ */
public function getMetadataFor($value); public function getMetadataFor($value);

View File

@ -21,8 +21,6 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
* *
* This class supports serialization and cloning. * This class supports serialization and cloning.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class GenericMetadata implements MetadataInterface class GenericMetadata implements MetadataInterface

View File

@ -23,8 +23,6 @@ use Symfony\Component\Validator\Constraint;
* against their class' metadata and whether traversable objects should be * against their class' metadata and whether traversable objects should be
* traversed or not. * traversed or not.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @see CascadingStrategy * @see CascadingStrategy

View File

@ -21,8 +21,6 @@ namespace Symfony\Component\Validator\Mapping;
* should be validated against their class' metadata and whether traversable * should be validated against their class' metadata and whether traversable
* objects should be traversed or not. * objects should be traversed or not.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @see MetadataInterface * @see MetadataInterface

View File

@ -23,8 +23,6 @@ namespace Symfony\Component\Validator\Mapping;
* *
* The traversal strategy is ignored for arrays. Arrays are always iterated. * The traversal strategy is ignored for arrays. Arrays are always iterated.
* *
* @since 2.1
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @see CascadingStrategy * @see CascadingStrategy

View File

@ -32,8 +32,6 @@ class ConcreteComposite extends Composite
} }
/** /**
* @since 2.6
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class CompositeTest extends \PHPUnit_Framework_TestCase class CompositeTest extends \PHPUnit_Framework_TestCase

View File

@ -39,6 +39,16 @@ class UuidValidatorTest extends ConstraintValidatorTestCase
$this->assertNoViolation(); $this->assertNoViolation();
} }
/**
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
*/
public function testExpectsUuidConstraintCompatibleType()
{
$constraint = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\Constraint');
$this->validator->validate('216fff40-98d9-11e3-a5e2-0800200c9a66', $constraint);
}
/** /**
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
*/ */

View File

@ -23,8 +23,6 @@ use Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity;
use Symfony\Component\Validator\Tests\Fixtures\Reference; use Symfony\Component\Validator\Tests\Fixtures\Reference;
/** /**
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase

View File

@ -16,8 +16,6 @@ namespace Symfony\Component\Validator\Util;
* *
* For more extensive functionality, use Symfony's PropertyAccess component. * For more extensive functionality, use Symfony's PropertyAccess component.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class PropertyPath class PropertyPath

View File

@ -17,8 +17,6 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
/** /**
* A validator in a specific execution context. * A validator in a specific execution context.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface ContextualValidatorInterface interface ContextualValidatorInterface

View File

@ -33,8 +33,6 @@ use Symfony\Component\Validator\Util\PropertyPath;
/** /**
* Recursive implementation of {@link ContextualValidatorInterface}. * Recursive implementation of {@link ContextualValidatorInterface}.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class RecursiveContextualValidator implements ContextualValidatorInterface class RecursiveContextualValidator implements ContextualValidatorInterface

View File

@ -20,8 +20,6 @@ use Symfony\Component\Validator\ObjectInitializerInterface;
/** /**
* Recursive implementation of {@link ValidatorInterface}. * Recursive implementation of {@link ValidatorInterface}.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
class RecursiveValidator implements ValidatorInterface class RecursiveValidator implements ValidatorInterface

View File

@ -19,8 +19,6 @@ use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
/** /**
* Validates PHP values against constraints. * Validates PHP values against constraints.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface ValidatorInterface extends MetadataFactoryInterface interface ValidatorInterface extends MetadataFactoryInterface

View File

@ -20,8 +20,6 @@ use Symfony\Component\Validator\Util\PropertyPath;
/** /**
* Default implementation of {@link ConstraintViolationBuilderInterface}. * Default implementation of {@link ConstraintViolationBuilderInterface}.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @internal You should not instantiate or use this class. Code against * @internal You should not instantiate or use this class. Code against
@ -199,7 +197,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface
$this->message, $this->message,
$this->plural, $this->plural,
$this->parameters, $this->parameters,
$this->translationDomain# $this->translationDomain
); );
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
$translatedMessage = $this->translator->trans( $translatedMessage = $this->translator->trans(

View File

@ -19,8 +19,6 @@ namespace Symfony\Component\Validator\Violation;
* Finally, call {@link addViolation()} to add the violation to the current * Finally, call {@link addViolation()} to add the violation to the current
* execution context. * execution context.
* *
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */
interface ConstraintViolationBuilderInterface interface ConstraintViolationBuilderInterface

View File

@ -217,19 +217,24 @@ class ExceptionCaster
} }
$ltrim = 0; $ltrim = 0;
while (' ' === $src[0][$ltrim] || "\t" === $src[0][$ltrim]) { do {
$i = $srcContext << 1; $pad = null;
while ($i > 0 && $src[0][$ltrim] === $src[$i][$ltrim]) { for ($i = $srcContext << 1; $i >= 0; --$i) {
--$i; if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
} if (null === $pad) {
if ($i) { $pad = $c;
break; }
if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
break;
}
}
} }
++$ltrim; ++$ltrim;
} } while (0 > $i && null !== $pad);
if ($ltrim) {
if (--$ltrim) {
foreach ($src as $i => $line) { foreach ($src as $i => $line) {
$src[$i] = substr($line, $ltrim); $src[$i] = isset($line[$ltrim]) && "\r" !== $line[$ltrim] ? substr($line, $ltrim) : ltrim($line, " \t");
} }
} }

View File

@ -210,8 +210,8 @@ array:2 [
executing: { executing: {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): { Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
%sGeneratorDemo.php:10: """ %sGeneratorDemo.php:10: """
yield 1;\n yield 1;\n
}\n }\n
\n \n
""" """
} }

View File

@ -227,7 +227,7 @@ EOTXT
$twig = <<<EOTXT $twig = <<<EOTXT
foo.twig:2: """ foo.twig:2: """
foo bar\\n foo bar\\n
twig source\\n twig source\\n
\\n \\n
""" """

View File

@ -29,6 +29,6 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends Twig_Template
return array (19 => 2); return array (19 => 2);
} }
} }
/* foo bar*/ /* foo bar*/
/* twig source*/ /* twig source*/
/* */ /* */