Skip to content

Commit ab90ff1

Browse files
committed
Merge branch '4.2'
* 4.2: Update console.rst: reversing constants (logical purpose) Replacing of size to date in File Date section Added new UnexpectedValueException
2 parents 3308281 + 44aaddd commit ab90ff1

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

components/finder.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ Restrict files by last modified dates with the
343343

344344
Restrict by a date range by chaining calls or passing an array::
345345

346-
$finder->date('>= 2018-01-01')->size('<= 2018-12-31');
346+
$finder->date('>= 2018-01-01')->date('<= 2018-12-31');
347347

348348
// same as above
349349
$finder->date(array('>= 2018-01-01', '<= 2018-12-31'));

console.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ available in the ``configure()`` method::
9292
{
9393
$this
9494
// ...
95-
->addArgument('password', $this->requirePassword ? InputArgument::OPTIONAL : InputArgument::REQUIRED, 'User password')
95+
->addArgument('password', $this->requirePassword ? InputArgument::REQUIRED : InputArgument::OPTIONAL, 'User password')
9696
;
9797
}
9898
}

validation/custom_constraint.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ The validator class is also simple, and only has one required method ``validate(
7676
}
7777

7878
if (!is_string($value)) {
79-
throw new UnexpectedTypeException($value, 'string');
79+
// throw this exception if your validator cannot handle the passed type so that it can be marked as invalid
80+
throw new UnexpectedValueException($value, 'string');
81+
82+
// separate multiple types using pipes
83+
// throw new UnexpectedValueException($value, 'string|int');
8084
}
8185

8286
if (!preg_match('/^[a-zA-Z0-9]+$/', $value, $matches)) {
@@ -94,6 +98,9 @@ message as its argument and returns an instance of
9498
:class:`Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface`.
9599
The ``addViolation()`` method call finally adds the violation to the context.
96100

101+
.. versionadded:: 4.2
102+
The ``UnexpectedValueException`` was introduced in Symfony 4.2.
103+
97104
Using the new Validator
98105
-----------------------
99106

0 commit comments

Comments
 (0)