From abca2d6fdc89479586e052cd11241d5a9bc885e5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 2 Oct 2015 14:08:08 +0200 Subject: [PATCH] [3.0] Clean Form, Validator, DowCrawler and some more --- .../Component/Debug/ExceptionHandler.php | 6 - src/Symfony/Component/DomCrawler/Crawler.php | 218 ++++-------------- .../Form/Extension/Core/Type/ChoiceType.php | 14 +- .../Form/Extension/Core/Type/FormType.php | 2 - .../EventListener/ValidationListener.php | 4 - .../Type/FormTypeValidatorExtension.php | 3 - src/Symfony/Component/Form/FormFactory.php | 34 +-- .../Component/Form/FormFactoryInterface.php | 30 +-- .../Component/Form/Tests/FormFactoryTest.php | 4 +- .../Form/Util/InheritDataAwareIterator.php | 2 +- .../Validator/Mapping/TraversalStrategy.php | 10 - .../RecursiveContextualValidator.php | 35 +-- .../Validator/RecursiveValidator.php | 12 - .../VarDumper/Caster/ExceptionCaster.php | 36 --- src/Symfony/Component/Yaml/Parser.php | 2 - 15 files changed, 72 insertions(+), 340 deletions(-) diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index 27e5995f06539..a36f61b4980e9 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -38,12 +38,6 @@ class ExceptionHandler public function __construct($debug = true, $charset = null, $fileLinkFormat = null) { - if (false !== strpos($charset, '%')) { - // Swap $charset and $fileLinkFormat for BC reasons - $pivot = $fileLinkFormat; - $fileLinkFormat = $charset; - $charset = $pivot; - } $this->debug = $debug; $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 0e4277914d49f..4a4d4995533f1 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -18,7 +18,7 @@ * * @author Fabien Potencier */ -class Crawler extends \SplObjectStorage +class Crawler implements \Countable { /** * @var string The current URI @@ -45,6 +45,11 @@ class Crawler extends \SplObjectStorage */ private $document; + /** + * @var \DOMNode[] + */ + private $nodes = array(); + /** * Whether the Crawler contains HTML or XML content (used when converting CSS to XPath). * @@ -72,7 +77,7 @@ public function __construct($node = null, $currentUri = null, $baseHref = null) */ public function clear() { - parent::removeAll($this); + $this->nodes = array(); $this->document = null; } @@ -329,7 +334,7 @@ public function addNode(\DOMNode $node) $this->document = $node->ownerDocument; } - parent::attach($node); + $this->nodes[] = $node; } // Serializing and unserializing a crawler creates DOM objects in a corrupted state. DOM elements are not properly serializable. @@ -352,10 +357,8 @@ public function serialize() */ public function eq($position) { - foreach ($this as $i => $node) { - if ($i == $position) { - return $this->createSubCrawler($node); - } + if (isset($this->nodes[$position])) { + return $this->createSubCrawler($this->nodes[$position]); } return $this->createSubCrawler(null); @@ -380,7 +383,7 @@ public function eq($position) public function each(\Closure $closure) { $data = array(); - foreach ($this as $i => $node) { + foreach ($this->nodes as $i => $node) { $data[] = $closure($this->createSubCrawler($node), $i); } @@ -395,9 +398,9 @@ public function each(\Closure $closure) * * @return Crawler A Crawler instance with the sliced nodes */ - public function slice($offset = 0, $length = -1) + public function slice($offset = 0, $length = null) { - return $this->createSubCrawler(iterator_to_array(new \LimitIterator($this, $offset, $length))); + return $this->createSubCrawler(array_slice($this->nodes, $offset, $length)); } /** @@ -412,7 +415,7 @@ public function slice($offset = 0, $length = -1) public function reduce(\Closure $closure) { $nodes = array(); - foreach ($this as $i => $node) { + foreach ($this->nodes as $i => $node) { if (false !== $closure($this->createSubCrawler($node), $i)) { $nodes[] = $node; } @@ -438,7 +441,7 @@ public function first() */ public function last() { - return $this->eq(count($this) - 1); + return $this->eq(count($this->nodes) - 1); } /** @@ -450,7 +453,7 @@ public function last() */ public function siblings() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -466,7 +469,7 @@ public function siblings() */ public function nextAll() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -482,7 +485,7 @@ public function nextAll() */ public function previousAll() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -498,7 +501,7 @@ public function previousAll() */ public function parents() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -523,7 +526,7 @@ public function parents() */ public function children() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -543,7 +546,7 @@ public function children() */ public function attr($attribute) { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -561,7 +564,7 @@ public function attr($attribute) */ public function nodeName() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -577,7 +580,7 @@ public function nodeName() */ public function text() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -593,7 +596,7 @@ public function text() */ public function html() { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -624,7 +627,7 @@ public function extract($attributes) $count = count($attributes); $data = array(); - foreach ($this as $node) { + foreach ($this->nodes as $node) { $elements = array(); foreach ($attributes as $attribute) { if ('_text' === $attribute) { @@ -730,7 +733,7 @@ public function selectButton($value) */ public function link($method = 'get') { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -747,7 +750,7 @@ public function link($method = 'get') public function links() { $links = array(); - foreach ($this as $node) { + foreach ($this->nodes as $node) { $links[] = new Link($node, $this->baseHref, 'get'); } @@ -766,7 +769,7 @@ public function links() */ public function form(array $values = null, $method = null) { - if (!count($this)) { + if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } @@ -845,136 +848,6 @@ public static function xpathLiteral($s) return sprintf('concat(%s)', implode($parts, ', ')); } - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function attach($object, $data = null) - { - $this->triggerDeprecation(__METHOD__); - - parent::attach($object, $data); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function detach($object) - { - $this->triggerDeprecation(__METHOD__); - - parent::detach($object); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function contains($object) - { - $this->triggerDeprecation(__METHOD__); - - return parent::contains($object); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function addAll($storage) - { - $this->triggerDeprecation(__METHOD__); - - parent::addAll($storage); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function removeAll($storage) - { - $this->triggerDeprecation(__METHOD__); - - parent::removeAll($storage); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function removeAllExcept($storage) - { - $this->triggerDeprecation(__METHOD__); - - parent::removeAllExcept($storage); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function getInfo() - { - $this->triggerDeprecation(__METHOD__); - - return parent::getInfo(); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function setInfo($data) - { - $this->triggerDeprecation(__METHOD__); - - parent::setInfo($data); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function offsetExists($object) - { - $this->triggerDeprecation(__METHOD__); - - return parent::offsetExists($object); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function offsetSet($object, $data = null) - { - $this->triggerDeprecation(__METHOD__); - - parent::offsetSet($object, $data); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function offsetUnset($object) - { - $this->triggerDeprecation(__METHOD__); - - parent::offsetUnset($object); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function offsetGet($object) - { - $this->triggerDeprecation(__METHOD__); - - return parent::offsetGet($object); - } - - /** - * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. - */ - public function getHash($object) - { - $this->triggerDeprecation(__METHOD__, true); - - return parent::getHash($object); - } - /** * Filters the list of nodes with an XPath expression. * @@ -990,7 +863,7 @@ private function filterRelativeXPath($xpath) $crawler = $this->createSubCrawler(null); - foreach ($this as $node) { + foreach ($this->nodes as $node) { $domxpath = $this->createDOMXPath($node->ownerDocument, $prefixes); foreach ($domxpath->query($xpath, $node) as $subNode) { @@ -1080,13 +953,19 @@ private function relativize($xpath) */ public function getNode($position) { - foreach ($this as $i => $node) { - if ($i == $position) { - return $node; - } + if (isset($this->nodes[$position])) { + return $this->nodes[$position]; } } + /** + * @return int + */ + public function count() + { + return count($this->nodes); + } + /** * @param \DOMElement $node * @param string $siblingDir @@ -1179,23 +1058,4 @@ private function createSubCrawler($nodes) return $crawler; } - - private function triggerDeprecation($methodName, $useTrace = false) - { - $traces = array(); - $caller = array(); - - if ($useTrace || defined('HHVM_VERSION')) { - $traces = debug_backtrace(); - $caller = $traces[2]; - } - - // The SplObjectStorage class performs calls to its own methods. These - // method calls must not lead to triggered deprecation notices. - if (isset($caller['class']) && 'SplObjectStorage' === $caller['class']) { - return; - } - - @trigger_error('The '.$methodName.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); - } } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index 709fc037629c3..c85aca26ec3b4 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -245,17 +245,11 @@ public function configureOptions(OptionsResolver $resolver) return ''; }; - $placeholder = function (Options $options) { + $placeholderDefault = function (Options $options) { return $options['required'] ? null : ''; }; - $choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) { - if ($choiceList) { - @trigger_error('The "choice_list" option is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', E_USER_DEPRECATED); - - return $choiceList; - } - + $choiceListNormalizer = function (Options $options) use ($choiceListFactory) { if (null !== $options['choice_loader']) { return $choiceListFactory->createListFromLoader( $options['choice_loader'], @@ -316,7 +310,7 @@ public function configureOptions(OptionsResolver $resolver) 'preferred_choices' => array(), 'group_by' => null, 'empty_data' => $emptyData, - 'placeholder' => $placeholder, + 'placeholder' => $placeholderDefault, 'error_bubbling' => false, 'compound' => $compound, // The view data is always a string, even if the "data" option @@ -330,7 +324,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setNormalizer('placeholder', $placeholderNormalizer); $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); - $resolver->setAllowedTypes('choice_list', array('null', 'Symfony\Component\Form\ChoiceList\ChoiceListInterface', 'Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface')); + $resolver->setAllowedTypes('choice_list', array('null', 'Symfony\Component\Form\ChoiceList\ChoiceListInterface')); $resolver->setAllowedTypes('choices', array('null', 'array', '\Traversable')); $resolver->setAllowedTypes('choice_translation_domain', array('null', 'bool', 'string')); $resolver->setAllowedTypes('choices_as_values', 'bool'); diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index a0f19616197d0..ff8d0b4fdecf7 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -159,8 +159,6 @@ public function configureOptions(OptionsResolver $resolver) 'empty_data' => $emptyData, 'trim' => true, 'required' => true, - 'max_length' => null, - 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, diff --git a/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php b/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php index 0aae4bb8536b7..410eedc2aefc1 100644 --- a/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php +++ b/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php @@ -35,10 +35,6 @@ public static function getSubscribedEvents() return array(FormEvents::POST_SUBMIT => 'validateForm'); } - /** - * @param ValidatorInterface $validator - * @param ViolationMapperInterface $violationMapper - */ public function __construct(ValidatorInterface $validator, ViolationMapperInterface $violationMapper) { $this->validator = $validator; diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php index 0cc3da7c6bb23..0f7c27bceb843 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php +++ b/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php @@ -33,9 +33,6 @@ class FormTypeValidatorExtension extends BaseValidatorExtension */ private $violationMapper; - /** - * @param ValidatorInterface $validator - */ public function __construct(ValidatorInterface $validator) { $this->validator = $validator; diff --git a/src/Symfony/Component/Form/FormFactory.php b/src/Symfony/Component/Form/FormFactory.php index 051d57993d6f8..0023c9064c96a 100644 --- a/src/Symfony/Component/Form/FormFactory.php +++ b/src/Symfony/Component/Form/FormFactory.php @@ -61,39 +61,11 @@ public function createForProperty($class, $property, $data = null, array $option */ public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array()) { - $name = null; - $typeName = null; - - if ($type instanceof ResolvedFormTypeInterface) { - if (method_exists($type, 'getBlockPrefix')) { - // As of Symfony 3.0, the block prefix of the type is used as - // default name - $name = $type->getBlockPrefix(); - } else { - // BC - $typeName = $type->getName(); - } - } elseif ($type instanceof FormTypeInterface) { - // BC - $typeName = $type->getName(); - } elseif (is_string($type)) { - // BC - $typeName = $type; - } else { - throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface'); - } - - if (null === $name) { - if (false === strpos($typeName, '\\')) { - // No FQCN - leave unchanged for BC - $name = $typeName; - } else { - // FQCN - $name = StringUtil::fqcnToBlockPrefix($typeName); - } + if (!is_string($type)) { + throw new UnexpectedTypeException($type, 'string'); } - return $this->createNamedBuilder($name, $type, $data, $options); + return $this->createNamedBuilder(StringUtil::fqcnToBlockPrefix($type), $type, $data, $options); } /** diff --git a/src/Symfony/Component/Form/FormFactoryInterface.php b/src/Symfony/Component/Form/FormFactoryInterface.php index b7e95cb01eb4d..7014cda159cf9 100644 --- a/src/Symfony/Component/Form/FormFactoryInterface.php +++ b/src/Symfony/Component/Form/FormFactoryInterface.php @@ -21,9 +21,9 @@ interface FormFactoryInterface * * @see createBuilder() * - * @param string|FormTypeInterface $type The type of the form - * @param mixed $data The initial data - * @param array $options The options + * @param string $type The type of the form + * @param mixed $data The initial data + * @param array $options The options * * @return FormInterface The form named after the type * @@ -36,10 +36,10 @@ public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormT * * @see createNamedBuilder() * - * @param string|int $name The name of the form - * @param string|FormTypeInterface $type The type of the form - * @param mixed $data The initial data - * @param array $options The options + * @param string|int $name The name of the form + * @param string $type The type of the form + * @param mixed $data The initial data + * @param array $options The options * * @return FormInterface The form * @@ -66,9 +66,9 @@ public function createForProperty($class, $property, $data = null, array $option /** * Returns a form builder. * - * @param string|FormTypeInterface $type The type of the form - * @param mixed $data The initial data - * @param array $options The options + * @param string $type The type of the form + * @param mixed $data The initial data + * @param array $options The options * * @return FormBuilderInterface The form builder * @@ -79,10 +79,10 @@ public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Typ /** * Returns a form builder. * - * @param string|int $name The name of the form - * @param string|FormTypeInterface $type The type of the form - * @param mixed $data The initial data - * @param array $options The options + * @param string|int $name The name of the form + * @param string $type The type of the form + * @param mixed $data The initial data + * @param array $options The options * * @return FormBuilderInterface The form builder * @@ -93,7 +93,7 @@ public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extens /** * Returns a form builder for a property of a class. * - * If any of the 'max_length', 'required' and type options can be guessed, + * If any of the 'required' and type options can be guessed, * and are not provided in the options argument, the guessed value is used. * * @param string $class The fully qualified class name diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php index 3649d18f46646..f1fc2f864401e 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -162,7 +162,7 @@ public function testCreateNamedBuilderThrowsUnderstandableException() /** * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException - * @expectedExceptionMessage Expected argument of type "string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface", "stdClass" given + * @expectedExceptionMessage Expected argument of type "string", "stdClass" given */ public function testCreateThrowsUnderstandableException() { @@ -182,7 +182,7 @@ public function testCreateUsesTypeNameIfTypeGivenAsString() $resolvedType->expects($this->once()) ->method('createBuilder') - ->with($this->factory, 'TYPE', $options) + ->with($this->factory, 'type', $options) ->will($this->returnValue($this->builder)); $this->builder->expects($this->any()) diff --git a/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php b/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php index f07ec82f0a0ec..a320344997fa9 100644 --- a/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php +++ b/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php @@ -34,7 +34,7 @@ public function getChildren() } /** - *{@inheritdoc} + * {@inheritdoc} */ public function hasChildren() { diff --git a/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php b/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php index ae76857aa443f..8a09be1fac5e3 100644 --- a/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php +++ b/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php @@ -48,16 +48,6 @@ class TraversalStrategy */ const TRAVERSE = 4; - /** - * Specifies that nested instances of {@link \Traversable} should never be - * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}. - * - * @deprecated since version 2.5, to be removed in 3.0. This constant was added for backwards compatibility only. - * - * @internal - */ - const STOP_RECURSION = 8; - /** * Not instantiable. */ diff --git a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index a5dc3e7ee3299..0405e7415cfb9 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -167,7 +167,6 @@ public function validate($value, $constraints = null, $groups = null) $value, $this->defaultPropertyPath, $groups, - true, $this->context ); @@ -378,7 +377,6 @@ private function validateObject($object, $propertyPath, array $groups, $traversa $object, $propertyPath, $groups, - $traversalStrategy & TraversalStrategy::STOP_RECURSION, $context ); } @@ -392,26 +390,16 @@ private function validateObject($object, $propertyPath, array $groups, $traversa * objects are iterated as well. Nested arrays are always iterated, * regardless of the value of $recursive. * - * @param array|\Traversable $collection The collection - * @param string $propertyPath The current property path - * @param string[] $groups The validated groups - * @param bool $stopRecursion Whether to disable - * recursive iteration. For - * backwards compatibility - * with Symfony < 2.5. - * @param ExecutionContextInterface $context The current execution context + * @param array|\Traversable $collection The collection + * @param string $propertyPath The current property path + * @param string[] $groups The validated groups + * @param ExecutionContextInterface $context The current execution context * * @see ClassNode * @see CollectionNode */ - private function validateEachObjectIn($collection, $propertyPath, array $groups, $stopRecursion, ExecutionContextInterface $context) + private function validateEachObjectIn($collection, $propertyPath, array $groups, ExecutionContextInterface $context) { - if ($stopRecursion) { - $traversalStrategy = TraversalStrategy::NONE; - } else { - $traversalStrategy = TraversalStrategy::IMPLICIT; - } - foreach ($collection as $key => $value) { if (is_array($value)) { // Arrays are always cascaded, independent of the specified @@ -421,7 +409,6 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups, $value, $propertyPath.'['.$key.']', $groups, - $stopRecursion, $context ); @@ -435,7 +422,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups, $value, $propertyPath.'['.$key.']', $groups, - $traversalStrategy, + TraversalStrategy::IMPLICIT, $context ); } @@ -613,9 +600,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m // If no specific traversal strategy was requested when this method // was called, use the traversal strategy of the class' metadata if ($traversalStrategy & TraversalStrategy::IMPLICIT) { - // Keep the STOP_RECURSION flag, if it was set - $traversalStrategy = $metadata->getTraversalStrategy() - | ($traversalStrategy & TraversalStrategy::STOP_RECURSION); + $traversalStrategy = $metadata->getTraversalStrategy(); } // Traverse only if IMPLICIT or TRAVERSE @@ -643,7 +628,6 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m $object, $propertyPath, $groups, - $traversalStrategy & TraversalStrategy::STOP_RECURSION, $context ); } @@ -729,9 +713,7 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa // If no specific traversal strategy was requested when this method // was called, use the traversal strategy of the node's metadata if ($traversalStrategy & TraversalStrategy::IMPLICIT) { - // Keep the STOP_RECURSION flag, if it was set - $traversalStrategy = $metadata->getTraversalStrategy() - | ($traversalStrategy & TraversalStrategy::STOP_RECURSION); + $traversalStrategy = $metadata->getTraversalStrategy(); } // The $cascadedGroups property is set, if the "Default" group is @@ -749,7 +731,6 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa $value, $propertyPath, $cascadedGroups, - $traversalStrategy & TraversalStrategy::STOP_RECURSION, $context ); diff --git a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php index e8c60d7090122..536ec2cc33998 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php @@ -12,8 +12,6 @@ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -141,14 +139,4 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) ->getViolations(); } - - private static function testConstraints($constraints) - { - return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && (0 === count($constraints) || current($constraints) instanceof Constraint)); - } - - private static function testGroups($groups) - { - return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (0 === count($groups) || is_string(current($groups)) || current($groups) instanceof GroupSequence)); - } } diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php index 81bf186e5593a..c3209aac1ccb7 100644 --- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php @@ -184,42 +184,6 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $is return $a; } - /** - * @deprecated since 2.8, to be removed in 3.0. Use the castTraceStub method instead. - */ - public static function filterTrace(&$trace, $dumpArgs, $offset = 0) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the castTraceStub method instead.', E_USER_DEPRECATED); - - if (0 > $offset || empty($trace[$offset])) { - return $trace = null; - } - - $t = $trace[$offset]; - - if (empty($t['class']) && isset($t['function'])) { - if ('user_error' === $t['function'] || 'trigger_error' === $t['function']) { - ++$offset; - } - } - - if ($offset) { - array_splice($trace, 0, $offset); - } - - foreach ($trace as &$t) { - $t = array( - 'call' => (isset($t['class']) ? $t['class'].$t['type'] : '').$t['function'].'()', - 'file' => isset($t['line']) ? "{$t['file']}:{$t['line']}" : '', - 'args' => &$t['args'], - ); - - if (!isset($t['args']) || !$dumpArgs) { - unset($t['args']); - } - } - } - private static function filterExceptionArray($xClass, array $a, $xPrefix, $filter) { if (isset($a[$xPrefix.'trace'])) { diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 04f2237be27ed..9c5563c0387d2 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -21,8 +21,6 @@ class Parser { const BLOCK_SCALAR_HEADER_PATTERN = '(?P\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?'; - // BC - wrongly named - const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN; private $offset = 0; private $lines = array(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy