8000 [Validator] New NodeTraverser implementation by webmozart · Pull Request #10287 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator] New NodeTraverser implementation #10287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 86 commits into from
Mar 31, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
25cdc68
[Validator] Refactored ValidatorTest and ValidationVisitorTest into a…
webmozart Feb 12, 2014
a6ed4ca
[Validator] Prototype of the traverser implementation
webmozart Feb 17, 2014
a40189c
[Validator] Decoupled the new classes a bit
webmozart Feb 17, 2014
7e3a41d
[Validator] Moved visitors to NodeVisitor namespace
webmozart Feb 17, 2014
b1a9477
[Validator] Added ObjectInitializer visitor
webmozart Feb 17, 2014
1156bde
[Validator] Extracted code for group sequence resolving into GroupSeq…
webmozart Feb 17, 2014
321d5bb
[Validator] Throw exception if ObjectInitializer is constructed witho…
webmozart Feb 17, 2014
680f1ee
[Validator] Renamed $params to $parameters
webmozart Feb 17, 2014
8ae68c9
[Validator] Made tests green (yay!)
webmozart Feb 18, 2014
c1b1e03
[Validator] Added TODO reminder
webmozart Feb 18, 2014
5fbf848
[Validator] Added note about Callback constraint to CHANGELOG
webmozart Feb 18, 2014
8318286
[Validator] Completed GroupSequence implementation
webmozart Feb 18, 2014
f6b7288
[Validator] Removed unused use statement
webmozart Feb 18, 2014
4ea3ff6
[Validator] Finished inline documentation of ExecutionContext[Interface]
webmozart Feb 18, 2014
adc1437
[Validator] Fixed failing tests
webmozart Feb 18, 2014
499b2bb
[Validator] Completed test coverage of ExecutionContext
webmozart Feb 18, 2014
405a03b
[Validator] Updated deprecation notes in GroupSequence
webmozart Feb 18, 2014
9b07b0c
[Validator] Implemented BC validation of arrays through validate()
webmozart Feb 18, 2014
297ba4f
[Validator] Added a note why scalars are passed to cascadeObject() in…
webmozart Feb 18, 2014
09f744b
[Validator] Implemented BC traversal of traversables through validate()
webmozart Feb 18, 2014
ee1adad
[Validator] Implemented handling of arrays and Traversables in Legacy…
webmozart Feb 19, 2014
718601c
[Validator] Changed validateValue() to validate() in the new API
webmozart Feb 19, 2014
feb3d6f
[Validator] Tested the validation in a separate context
webmozart Feb 19, 2014
1e81f3b
[Validator] Finished test coverage and documentation of ExecutionCont…
webmozart Feb 19, 2014
9c9e715
[Validator] Completed documentation of GroupManagerInterface
webmozart Feb 19, 2014
2c65a28
[Validator] Completed test coverage and documentation of the Node cla…
webmozart Feb 19, 2014
a3555fb
[Validator] Fixed: Objects are not traversed unless they are instance…
webmozart Feb 19, 2014
bc29591
[Validator] Clearly separated classes supporting the API <2.5/2.5+
webmozart Feb 19, 2014
26eafa4
[Validator] Removed unused use statements
webmozart Feb 19, 2014
df41974
[Validator] Changed context manager to context factory
webmozart Feb 19, 2014
e440690
[Validator] Renamed validateCollection() to validateObjects()
webmozart Feb 19, 2014
e057b19
[Validator] Decoupled ContextRefresher from ExecutionContext
webmozart Feb 19, 2014
230f2a7
[Validator] Fixed exception message
webmozart Feb 19, 2014
cf1281f
[Validator] Added "Visitor" suffix to all node visitors
webmozart Feb 20, 2014
94583a9
[Validator] Changed NodeTraverser to traverse nodes iteratively, not …
webmozart Feb 20, 2014
117b1b9
[Validator] Wrapped collections into CollectionNode instances
webmozart Feb 20, 2014
51197f6
[Validator] Made traversal of Traversables consistent
webmozart Feb 20, 2014
08172bf
[Validator] Merged validate(), validateObject() and validateObjects()…
webmozart Feb 20, 2014
aeb6822
[Validator] Improved visitor names
webmozart Feb 20, 2014
4161371
[Validator] Removed unused use statements
webmozart Feb 20, 2014
76d8c9a
[Validator] Fixed typos
webmozart Feb 20, 2014
778ec24
[Validator] Removed helper class Traversal
webmozart Feb 20, 2014
6fc6ecd
[Validator] Fixed tests under PHP<5.3.9
webmozart Feb 20, 2014
2936d10
[Validator] Removed unused use statement
webmozart Feb 20, 2014
e8fa15b
[Validator] Fixed the new validator API under PHP < 5.3.9
webmozart Feb 20, 2014
8558377
[Validator] Added deprecation notes
webmozart Feb 20, 2014
dbce5a2
[Validator] Updated outdated doc blocks
webmozart Feb 20, 2014
822fe47
[Validator] Completed inline documentation of the Node classes and th…
webmozart Feb 21, 2014
186c115
[Validator] Improved test coverage of NonRecursiveNodeTraverser
webmozart Feb 21, 2014
299c2dc
[Validator] Improved test coverage and prevented duplicate validation…
webmozart Feb 21, 2014
be7f055
[Validator] Visitors may now abort the traversal by returning false f…
webmozart Feb 21, 2014
9986f03
[Validator] Added inline documentation for the PropertyPath utility c…
webmozart Feb 21, 2014
524a953
[Validator] Improved inline documentation of the validators
webmozart Feb 21, 2014
9ca61df
[Validator] Improved inline documentation of CascadingStrategy and Tr…
webmozart Feb 21, 2014
01ceeda
[Validator] Improved test coverage of the Traverse constraint
webmozart Feb 21, 2014
79387a7
[Validator] Improved inline documentation of the metadata classes
webmozart Feb 21, 2014
987313d
[Validator] Improved inline documentation of the violation builder
webmozart Feb 21, 2014
93fdff7
[Validator] The supported API versions can now be passed to the Valid…
webmozart Feb 21, 2014
886e05e
[Validator] Removed unused use statement
webmozart Feb 21, 2014
f61d31e
[Validator] Fixed grammar
webmozart Feb 21, 2014
23534ca
[Validator] Added a recursive clone of the new implementation for spe…
webmozart Feb 22, 2014
38e26fb
[Validator] Decoupled RecursiveContextualValidator from Node
webmozart Feb 22, 2014
274d4e6
[Validator] Changed ValidatorBuilder to always use LegacyExecutionCon…
webmozart Mar 11, 2014
eeed509
[Validator] Improved phpdoc of RecursiveValidator
webmozart Mar 11, 2014
5c479d8
[Validator] Simplified validateNodeForGroup
webmozart Mar 11, 2014
eed29d8
[Validator] Improved performance of *ContextualValidator::validate()
webmozart Mar 11, 2014
50bb84d
[Validator] Optimized RecursiveContextualValidator
webmozart Mar 11, 2014
be508e0
[Validator] Merged DefaultGroupReplacingVisitor and ContextUpdateVisi…
webmozart Mar 11, 2014
1622eb3
[Validator] Fixed reference to removed class in ValidatorBuilder
webmozart Mar 11, 2014
94ef21e
[Validator] Optimized use statements
webmozart Mar 17, 2014
73c9cc5
[Validator] Optimized performance by calling spl_object_hash() only o…
webmozart Mar 17, 2014
2f23d97
[Validator] Reduced number of method calls on the execution context
webmozart Mar 17, 2014
029a716
[Validator] Moved logic of replaceDefaultGroup() to validateNode()
webmozart Mar 17, 2014
3183aed
[Validator] Improved performance of cache key generation
webmozart Mar 17, 2014
90c27bb
[Validator] Removed traverser implementation
webmozart Mar 18, 2014
166d71a
[Validator] Removed unused property
webmozart Mar 18, 2014
7bc952d
[Validator] Improved inline documentation of RecursiveContextualValid…
webmozart Mar 18, 2014
1b111d0
[Validator] Fixed typos pointed out by @cordoval
webmozart Mar 18, 2014
0946dbe
[Validator] Adapted CHANGELOG
webmozart Mar 18, 2014
9b204c9
[FrameworkBundle] Implemented configuration to select the desired Val…
webmozart Mar 18, 2014
c5629bb
[Validator] Added getObject() to ExecutionContextInterface
webmozart Mar 18, 2014
3dc2b4d
[Validator] Made "symfony/property-access" an optional dependency
webmozart Mar 18, 2014
0bfde4a
[Validator] Fixed misnamed method calls in FrameworkExtension
webmozart Mar 18, 2014
b1badea
[Validator] Fixed failing CsrfFormLoginTest
webmozart Mar 30, 2014
68d8018
[Validator] Documented changes in the UPGRADE files 8000
webmozart Mar 30, 2014
ca6a722
[Validator] Converted `@deprecate` doc comment into regular doc comment
webmozart Mar 30, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Validator] Added deprecation notes
  • Loading branch information
webmozart committed Mar 30, 2014
commit 85583779450d3d944e26baa967713a94af61252e
3 changes: 3 additions & 0 deletions src/Symfony/Component/Validator/ClassBasedInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* An object backed by a PHP class.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Mapping\ClassMetadataInterface} instead.
*/
interface ClassBasedInterface
{
Expand Down
12 changes: 6 additions & 6 deletions src/Symfony/Component/Validator/Constraints/GroupSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function __construct(array $groups)
* @see \IteratorAggregate::getIterator()
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in 3.0.
* To be removed in Symfony 3.0.
*/
public function getIterator()
{
Expand All @@ -114,7 +114,7 @@ public function getIterator()
* @return Boolean Whether the offset exists
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in 3.0.
* To be removed in Symfony 3.0.
*/
public function offsetExists($offset)
{
Expand All @@ -131,7 +131,7 @@ public function offsetExists($offset)
* @throws OutOfBoundsException If the object does not exist
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in 3.0.
* To be removed in Symfony 3.0.
*/
public function offsetGet($offset)
{
Expand All @@ -152,7 +152,7 @@ public function offsetGet($offset)
* @param string $value The group name
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in 3.0.
* To be removed in Symfony 3.0.
*/
public function offsetSet($offset, $value)
{
Expand All @@ -171,7 +171,7 @@ public function offsetSet($offset, $value)
* @param integer $offset The offset
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in 3.0.
* To be removed in Symfony 3.0.
*/
public function offsetUnset($offset)
{
Expand All @@ -184,7 +184,7 @@ public function offsetUnset($offset)
* @return integer The number of groups
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in 3.0.
* To be removed in Symfony 3.0.
*/
public function count()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
* @since 2.5
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5. To be
* removed in 3.0.
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in Symfony 3.0.
*/
class LegacyExecutionContext extends ExecutionContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* @since 2.5
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5. To be
* removed in 3.0.
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in Symfony 3.0.
*/
class LegacyExecutionContextFactory implements ExecutionContextFactoryInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Validator/ExecutionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContext} instead.
*/
class ExecutionContext implements ExecutionContextInterface
{
Expand Down
25 changes: 25 additions & 0 deletions src/Symfony/Component/Validator/ExecutionContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @api
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContextInterface} instead.
*/
interface ExecutionContextInterface
{
Expand All @@ -95,6 +98,10 @@ interface ExecutionContextInterface
* @param integer|null $code The violation code.
*
* @api
*
* @deprecated The parameters $invalidValue, $pluralization and $code are
* deprecated since version 2.5 and will be removed in
* Symfony 3.0.
*/
public function addViolation($message, array $params = array(), $invalidValue = null, $pluralization = null, $code = null);

Expand All @@ -110,6 +117,10 @@ public function addViolation($message, array $params = array(), $invalidValue =
* @param integer|null $code The violation code.
*
* @api
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContextInterface::buildViolation()}
* instead.
*/
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $pluralization = null, $code = null);

Expand Down Expand Up @@ -151,6 +162,10 @@ public function addViolationAt($subPath, $message, array $parameters = array(),
* or an instance of <tt>\Traversable</tt>.
* @param Boolean $deep Whether to traverse the value recursively if
* it is a collection of collections.
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContextInterface::getValidator()}
* instead.
*/
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false);

Expand Down Expand Up @@ -180,6 +195,10 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals
* @param null|string|string[] $groups The groups to validate in. If you don't pass any
* groups here, the current group of the context
* will be used.
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContextInterface::getValidator()}
* instead.
*/
public function validateValue($value, $constraints, $subPath = '', $groups = null);

Expand Down Expand Up @@ -237,6 +256,12 @@ public function getMetadata();
* Returns the used metadata factory.
*
* @return MetadataFactoryInterface The metadata factory.
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContextInterface::getValidator()}
* instead and call
* {@link Validator\ValidatorInterface::getMetadataFor()} or
* {@link Validator\ValidatorInterface::hasMetadataFor()} there.
*/
public function getMetadataFactory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
* </ul>
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Context\ExecutionContextInterface} instead.
*/
interface GlobalExecutionContextInterface
{
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Validator/MetadataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
* again.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Mapping\MetadataInterface} instead.
*/
interface MetadataInterface
{
Expand All @@ -54,6 +57,8 @@ interface MetadataInterface
* @param mixed $value The value to validate.
* @param string|string[] $group The validation group to validate in.
* @param string $propertyPath The current property path in the validation graph.
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
*/
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* A container for {@link PropertyMetadataInterface} instances.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Mapping\ClassMetadataInterface} instead.
*/
interface PropertyMetadataContainerInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Validator/PropertyMetadataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @see MetadataInterface
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Mapping\PropertyMetadataInterface} instead.
*/
interface PropertyMetadataInterface extends MetadataInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Validator/ValidationVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
* {@link GlobalExecutionContextInterface}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link NodeVisitor\NodeVisitorInterface} instead.
*/
class ValidationVisitor implements ValidationVisitorInterface, GlobalExecutionContextInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
* </ol>
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link NodeVisitor\NodeVisitorInterface} instead.
*/
interface ValidationVisitorInterface
{
Expand Down Expand Up @@ -62,6 +65,8 @@ interface ValidationVisitorInterface
*
* @throws Exception\NoSuchMetadataException If no metadata can be found for
* the given value.
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
*/
public function validate($value, $group, $propertyPath, $traverse = false, $deep = false);

Expand All @@ -75,6 +80,8 @@ public function validate($value, $group, $propertyPath, $traverse = false, $deep
* @param mixed $value The value to validate.
* @param string $group The validation group to validate.
* @param string $propertyPath The current property path in the validation graph.
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
*/
public function visit(MetadataInterface $metadata, $value, $group, $propertyPath);
}
3 changes: 3 additions & 0 deletions src/Symfony/Component/Validator/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Validator\Validator} instead.
*/
class Validator implements ValidatorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;

/**
* @since %%NextVersion%%
* @since 2.5
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Implemented for backwards compatibility with Symfony < 2.5.
* To be removed in Symfony 3.0.
*/
class LegacyValidator extends Validator implements LegacyValidatorInterface
{
Expand Down
15 changes: 15 additions & 0 deletions src/Symfony/Component/Validator/ValidatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @api
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Validator\ValidatorInterface} instead.
*/
interface ValidatorInterface
{
Expand All @@ -35,6 +38,10 @@ interface ValidatorInterface
* list is empty, validation succeeded.
*
* @api
*
* @deprecated The signature changed with Symfony 2.5 (see
* {@link Validator\ValidatorInterface::validate()}. This
* signature will be disabled in Symfony 3.0.
*/
public function validate($value, $groups = null, $traverse = false, $deep = false);

Expand Down Expand Up @@ -85,6 +92,9 @@ public function validatePropertyValue($containingValue, $property, $value, $grou
* list is empty, validation succeeded.
*
* @api
*
* @deprecated Renamed to {@link Validator\ValidatorInterface::validate()}
* in Symfony 2.5. Will be removed in Symfony 3.0.
*/
public function validateValue($value, $constraints, $groups = null);

Expand All @@ -94,6 +104,11 @@ public function validateValue($value, $constraints, $groups = null);
* @return MetadataFactoryInterface The metadata factory.
*
* @api
*
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
* Use {@link Validator\ValidatorInterface::getMetadataFor()} or
* {@link Validator\ValidatorInterface::hasMetadataFor()}
* instead.
*/
public function getMetadataFactory();
}
0