feature #16075 [3.0] Clean Form, Validator, DowCrawler and some more (nicolas-grekas)

This PR was merged into the 3.0-dev branch.

Discussion
----------

[3.0] Clean Form, Validator, DowCrawler and some more

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

abca2d6 [3.0] Clean Form, Validator, DowCrawler and some more
This commit is contained in:
Fabien Potencier 2015-10-02 19:33:59 +02:00
commit d606e76ecf
15 changed files with 72 additions and 340 deletions

View File

@ -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');

View File

@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\CssSelectorConverter;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
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 @@ class Crawler extends \SplObjectStorage
*/
public function clear()
{
parent::removeAll($this);
$this->nodes = array();
$this->document = null;
}
@ -329,7 +334,7 @@ class Crawler extends \SplObjectStorage
$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 @@ class Crawler extends \SplObjectStorage
*/
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 @@ class Crawler extends \SplObjectStorage
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 @@ class Crawler extends \SplObjectStorage
*
* @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 @@ class Crawler extends \SplObjectStorage
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 @@ class Crawler extends \SplObjectStorage
*/
public function last()
{
return $this->eq(count($this) - 1);
return $this->eq(count($this->nodes) - 1);
}
/**
@ -450,7 +453,7 @@ class Crawler extends \SplObjectStorage
*/
public function siblings()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -466,7 +469,7 @@ class Crawler extends \SplObjectStorage
*/
public function nextAll()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -482,7 +485,7 @@ class Crawler extends \SplObjectStorage
*/
public function previousAll()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -498,7 +501,7 @@ class Crawler extends \SplObjectStorage
*/
public function parents()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -523,7 +526,7 @@ class Crawler extends \SplObjectStorage
*/
public function children()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -543,7 +546,7 @@ class Crawler extends \SplObjectStorage
*/
public function attr($attribute)
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -561,7 +564,7 @@ class Crawler extends \SplObjectStorage
*/
public function nodeName()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -577,7 +580,7 @@ class Crawler extends \SplObjectStorage
*/
public function text()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -593,7 +596,7 @@ class Crawler extends \SplObjectStorage
*/
public function html()
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -624,7 +627,7 @@ class Crawler extends \SplObjectStorage
$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 @@ class Crawler extends \SplObjectStorage
*/
public function link($method = 'get')
{
if (!count($this)) {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
@ -747,7 +750,7 @@ class Crawler extends \SplObjectStorage
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 @@ class Crawler extends \SplObjectStorage
*/
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 @@ class Crawler extends \SplObjectStorage
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 @@ class Crawler extends \SplObjectStorage
$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 @@ class Crawler extends \SplObjectStorage
*/
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 @@ class Crawler extends \SplObjectStorage
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);
}
}

View File

@ -245,17 +245,11 @@ class ChoiceType extends AbstractType
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 @@ class ChoiceType extends AbstractType
'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 @@ class ChoiceType extends AbstractType
$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');

View File

@ -159,8 +159,6 @@ class FormType extends BaseType
'empty_data' => $emptyData,
'trim' => true,
'required' => true,
'max_length' => null,
'pattern' => null,
'property_path' => null,
'mapped' => true,
'by_reference' => true,

View File

@ -35,10 +35,6 @@ class ValidationListener implements EventSubscriberInterface
return array(FormEvents::POST_SUBMIT => 'validateForm');
}
/**
* @param ValidatorInterface $validator
* @param ViolationMapperInterface $violationMapper
*/
public function __construct(ValidatorInterface $validator, ViolationMapperInterface $violationMapper)
{
$this->validator = $validator;

View File

@ -33,9 +33,6 @@ class FormTypeValidatorExtension extends BaseValidatorExtension
*/
private $violationMapper;
/**
* @param ValidatorInterface $validator
*/
public function __construct(ValidatorInterface $validator)
{
$this->validator = $validator;

View File

@ -61,39 +61,11 @@ class FormFactory implements FormFactoryInterface
*/
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 (!is_string($type)) {
throw new UnexpectedTypeException($type, 'string');
}
if (null === $name) {
if (false === strpos($typeName, '\\')) {
// No FQCN - leave unchanged for BC
$name = $typeName;
} else {
// FQCN
$name = StringUtil::fqcnToBlockPrefix($typeName);
}
}
return $this->createNamedBuilder($name, $type, $data, $options);
return $this->createNamedBuilder(StringUtil::fqcnToBlockPrefix($type), $type, $data, $options);
}
/**

View File

@ -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 @@ interface FormFactoryInterface
*
* @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 @@ interface FormFactoryInterface
/**
* 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 @@ interface FormFactoryInterface
/**
* 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 @@ interface FormFactoryInterface
/**
* 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

View File

@ -162,7 +162,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
/**
* @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 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$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())

View File

@ -34,7 +34,7 @@ class InheritDataAwareIterator extends \IteratorIterator implements \RecursiveIt
}
/**
*{@inheritdoc}
* {@inheritdoc}
*/
public function hasChildren()
{

View File

@ -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.
*/

View File

@ -167,7 +167,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$value,
$this->defaultPropertyPath,
$groups,
true,
$this->context
);
@ -378,7 +377,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$object,
$propertyPath,
$groups,
$traversalStrategy & TraversalStrategy::STOP_RECURSION,
$context
);
}
@ -392,26 +390,16 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
* 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 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$value,
$propertyPath.'['.$key.']',
$groups,
$stopRecursion,
$context
);
@ -435,7 +422,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$value,
$propertyPath.'['.$key.']',
$groups,
$traversalStrategy,
TraversalStrategy::IMPLICIT,
$context
);
}
@ -613,9 +600,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
// 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 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$object,
$propertyPath,
$groups,
$traversalStrategy & TraversalStrategy::STOP_RECURSION,
$context
);
}
@ -729,9 +713,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
// 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 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$value,
$propertyPath,
$cascadedGroups,
$traversalStrategy & TraversalStrategy::STOP_RECURSION,
$context
);

View File

@ -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 @@ class RecursiveValidator implements ValidatorInterface
->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));
}
}

View File

@ -184,42 +184,6 @@ class ExceptionCaster
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'])) {

View File

@ -21,8 +21,6 @@ use Symfony\Component\Yaml\Exception\ParseException;
class Parser
{
const BLOCK_SCALAR_HEADER_PATTERN = '(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?';
// BC - wrongly named
const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN;
private $offset = 0;
private $lines = array();