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
----------
* 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
renderer should be used with object attributes.
renderer should be used with non-scalar attributes.
* The `ControllerResolver::getArguments()` method has been deprecated and will
be removed in 4.0. If you have your own `ControllerResolverInterface`

View File

@ -124,9 +124,9 @@ FrameworkBundle
HttpKernel
----------
* Possibility to pass objects as URI attributes to the ESI and SSI renderers
has been removed. The inline fragment renderer should be used with object
attributes.
* Possibility to pass non-scalar values as URI attributes to the ESI and SSI
renderers has been removed. The inline fragment renderer should be used with
non-scalar attributes.
* The `ControllerResolver::getArguments()` method has been removed. If you
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
* register alias.
* @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())
{

View File

@ -18,8 +18,6 @@ use Symfony\Component\Form\Exception\RuntimeException;
/**
* A utility for reading object IDs.
*
* @since 1.0
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @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.
*
* @since 2.4
*
* @author Robert Schönthal <robert.schoenthal@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}
* and {@link FormEvents::POST_SUBMIT} events.
*
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class DataCollectorListener implements EventSubscriberInterface

View File

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

View File

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

View File

@ -17,8 +17,6 @@ use Symfony\Component\Form\FormView;
/**
* Extracts arrays of information out of forms.
*
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
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.
*
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface

View File

@ -20,8 +20,6 @@ use Symfony\Component\Form\ResolvedFormTypeInterface;
* Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy}
* instances.
*
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
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.
*
* @since 2.4
*
* @author Robert Schönthal <robert.schoenthal@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.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @since 2.5
*/
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}
* 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);

View File

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

View File

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

View File

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

View File

@ -65,7 +65,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
{
if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) {
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);

View File

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

View File

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

View File

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

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\Security\Csrf\TokenGenerator;
/**
* Generates CSRF tokens.
*
* @since 2.4
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
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.
*
* @since 2.4
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class NativeSessionTokenStorage implements TokenStorageInterface

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,8 +17,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
* Creates new {@link ExecutionContext} instances.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @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
* that is passed through the validation run.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
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
* results later on.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface ExecutionContextInterface

View File

@ -12,8 +12,6 @@
namespace Symfony\Component\Validator\Exception;
/**
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
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
* implemented as bit mask in order to allow future extensions.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @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
* should be traversed or not.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @see MetadataInterface

View File

@ -11,13 +11,12 @@
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.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface MetadataFactoryInterface
@ -29,7 +28,7 @@ interface MetadataFactoryInterface
*
* @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);

View File

@ -21,8 +21,6 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
*
* This class supports serialization and cloning.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
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
* traversed or not.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @see CascadingStrategy

View File

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

View File

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

View File

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

View File

@ -39,6 +39,16 @@ class UuidValidatorTest extends ConstraintValidatorTestCase
$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
*/

View File

@ -23,8 +23,6 @@ use Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity;
use Symfony\Component\Validator\Tests\Fixtures\Reference;
/**
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
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.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class PropertyPath

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -217,19 +217,24 @@ class ExceptionCaster
}
$ltrim = 0;
while (' ' === $src[0][$ltrim] || "\t" === $src[0][$ltrim]) {
$i = $srcContext << 1;
while ($i > 0 && $src[0][$ltrim] === $src[$i][$ltrim]) {
--$i;
}
if ($i) {
break;
do {
$pad = null;
for ($i = $srcContext << 1; $i >= 0; --$i) {
if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
if (null === $pad) {
$pad = $c;
}
if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
break;
}
}
}
++$ltrim;
}
if ($ltrim) {
} while (0 > $i && null !== $pad);
if (--$ltrim) {
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: {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
%sGeneratorDemo.php:10: """
yield 1;\n
}\n
yield 1;\n
}\n
\n
"""
}

View File

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

View File

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