-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to find template from default templates first
When executing `ValidationException::setTemplate()` using a template key, it does not try to select the template, but instead it uses the template key as the template itself. In order to fix this behaviour, there is now a check for a key with the defined template. In case the template was not found, use the defined template as the template itself.
- Loading branch information
1 parent
d072b4d
commit 37a71de
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--FILE-- | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use Respect\Validation\Exceptions\ValidationException; | ||
use Respect\Validation\Validator as v; | ||
|
||
try { | ||
v::when(v::alwaysInvalid(), v::alwaysValid())->check('foo'); | ||
} catch (ValidationException $exception) { | ||
echo $exception->getMainMessage(); | ||
} | ||
?> | ||
--EXPECT-- | ||
"foo" is not valid |