[Validator] Removed information from the violation output if the value is an array, object or resource
This was decided in the discussion of #10687.
This commit is contained in:
parent
d6a783f989
commit
08ea6d3621
|
@ -67,11 +67,11 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||
}
|
||||
|
||||
if (is_object($value)) {
|
||||
return 'Object('.get_class($value).')';
|
||||
return 'object';
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
return 'Array';
|
||||
return 'array';
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
|
@ -79,7 +79,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||
}
|
||||
|
||||
if (is_resource($value)) {
|
||||
return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
|
||||
return 'resource';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
|
|
|
@ -66,9 +66,9 @@ class NullValidatorTest extends \PHPUnit_Framework_TestCase
|
|||
array(true, 'true'),
|
||||
array('', '""'),
|
||||
array('foo bar', '"foo bar"'),
|
||||
array(new \DateTime(), 'Object(DateTime)'),
|
||||
array(new \stdClass(), 'Object(stdClass)'),
|
||||
array(array(), 'Array'),
|
||||
array(new \DateTime(), 'object'),
|
||||
array(new \stdClass(), 'object'),
|
||||
array(array(), 'array'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,6 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$object = new \stdClass();
|
||||
$file = $this->createFile();
|
||||
$fileAsString = 'Resource(stream#'.intval($file).')';
|
||||
|
||||
return array(
|
||||
array('foobar', 'numeric', '"foobar"'),
|
||||
|
@ -140,18 +139,18 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
|||
array('0', 'integer', '"0"'),
|
||||
array('1.5', 'float', '"1.5"'),
|
||||
array(12345, 'string', '12345'),
|
||||
array($object, 'boolean', 'Object(stdClass)'),
|
||||
array($object, 'numeric', 'Object(stdClass)'),
|
||||
array($object, 'integer', 'Object(stdClass)'),
|
||||
array($object, 'float', 'Object(stdClass)'),
|
||||
array($object, 'string', 'Object(stdClass)'),
|
||||
array($object, 'resource', 'Object(stdClass)'),
|
||||
array($file, 'boolean', $fileAsString),
|
||||
array($file, 'numeric', $fileAsString),
|
||||
array($file, 'integer', $fileAsString),
|
||||
array($file, 'float', $fileAsString),
|
||||
array($file, 'string', $fileAsString),
|
||||
array($file, 'object', $fileAsString),
|
||||
array($object, 'boolean', 'object'),
|
||||
array($object, 'numeric', 'object'),
|
||||
array($object, 'integer', 'object'),
|
||||
array($object, 'float', 'object'),
|
||||
array($object, 'string', 'object'),
|
||||
array($object, 'resource', 'object'),
|
||||
array($file, 'boolean', 'resource'),
|
||||
array($file, 'numeric', 'resource'),
|
||||
array($file, 'integer', 'resource'),
|
||||
array($file, 'float', 'resource'),
|
||||
array($file, 'string', 'resource'),
|
||||
array($file, 'object', 'resource'),
|
||||
array('12a34', 'digit', '"12a34"'),
|
||||
array('1a#23', 'alnum', '"1a#23"'),
|
||||
array('abcd1', 'alpha', '"abcd1"'),
|
||||
|
|
Reference in New Issue