We want to release version 3.0 as fresh as possible, without having to
maintain backward compatibility with the previous versions. Because that
version will be on for some time, we decided it will be best to support
only PHP version 8.5 or higher.
Acked-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
This change is to ensure `Respect\Validation` is intentional about the
DateTime formats.
For context the [ISO 8601][] standard says that we shouldn't accept
`-00:00` (or anything similar) offsets.
I noticed that there was an a [change][] in how
`CanValidateDateTime.php` behaved from v2.2 to v2.3.
Prior to v2.3 date time formats of `2018-01-30T19:04:35-00:00` (note the
-00:00) would pass validation. After updating to v2.3 the format is not
accepted.
This is because the `DateTime::createFromFormat` accepts the `$value`
of `2018-01-30T19:04:35-00:00` but internally converts the `-00:00` to
`+00:00`
```
$formattedDate = DateTime::createFromFormat(
$format,
$value,
new DateTimeZone(date_default_timezone_get())
);
```
This in turn causes the validation around
`$value !== $formattedDate->format($format))` to fail
```
if ($formattedDate === false || $value !== $formattedDate->format($format)) {
return false;
}
```
[ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601#Other_time_offset_specifications
[change]: 5fe4b96ebf
This change will bring many breaking changes. The good thing is that we
can finally use more modern resources available in PHP.
I can imagine that's not a popular change since it will bring many
breaking changes to users, but we shouldn't be stuck in time because of
that. Using some of those features will make it easier to contribute to
the project. At least, I hope so.
There are still some useless doc-blocks, and we're not using "readonly"
properties when we could. I aim to send those changes soon.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
From PHPUnit 10, all data providers need to be static. This commit will
make migrating from version 9 to 10 a bit easier.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Because traits are behaviors that are added to a class, it makes sense
to name them with the behavior that they add the classes that use them.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-12-06 21:21:42 +01:00
Renamed from tests/unit/Helpers/DateTimeHelperTest.php (Browse further)