A warning was thrown because of the preg_match call, as not every input
is a string we prevent calls from arrays going further into checking.
Issue 346
A warning was thrown because of the preg_match call, as not every input
is a string we prevent calls from arrays going further into checking.
Issue 346
A warning was thrown because of the preg_match call, as not every input
is a string we prevent calls from arrays going further into checking.
Issue 346
timezone information. However, in the comparison the DateTime-object is
first output to a timestamp, which is then converted to a string with the
date()-function. But because a timestamp does not include timezone
information, date() will assume the system's timezone. So if the system
timezone set in the PHP settings is UTC, a string with another timezone,
e.g. 2015-04-24T21:11:00+02:00, will fail to be validated. The result from
the date()-function in this example is 2015-04-24T19:11:00+00:00, which is
a different string then the input.
The DateTime-class has also an option to create a string from a format,
DateTime->format(). So it is possible to skip the use of the
date()-function with the added benefit that using format() does have
access to the timezone information and thus produces the expected
2015-04-24T21:11:00+02:00 to compare with the given input.
This commit changes the Rule to accommodate this and expands the tests. If
these added tests are run before applying the fix to the Date-rule, the
tests will fail.
There are some other rules which could extend this class too, like Tld
and CountryCode, but was not changed in order to avoid code duplication
or API breaks.
* `ExceptionInterface`: all Respect\Validation\Exceptions implement through inheritance
* `ValidatorExceptionInterface`: implemented only by AllOfException. This allows the end users to know when there has been a Validator exception rather than just any of our exceptions.
Fixed formatting issues
Created two new exception types
* Created ValidationExceptionInterface
* Created NestedValidationExceptionInterface which extends ValidationExceptionInterface
* Renamed from ValidatorExceptionInterface
* ValidationException implements ValidationExceptionInterface and ValidationExceptionTest checks for the implementation.
* AbstractNestedException implements NestedValidationExceptionInterface and AbstractNestedExceptionTest checks for the implementation.
* CheckExceptionsTest now checks all Rule exceptions to make sure they implement ValidationExceptionInterface
* ValidatorTest now contains test that shows that only ValidationExceptionInterface can be used reliably with `::check()`
* Updated documentation for new exception types
* Reworked examples to show how to catch the exception interfaces
Minor changes in readme.md and ExceptionInterfaces
* Removed `import` statements (hahaha)
* Renamed `$e` to `$exception`
* `ValidationExceptionInterface` now extends `ExceptionInterface`. Changed `ValidationException` to match