-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Convert some parts of Date validator to php8 syntax and add so…
…me tests to check userland retrocompatibility. Signed-off-by: codisart <[email protected]>
- Loading branch information
Showing
3 changed files
with
88 additions
and
12 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
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,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaminasTest\Validator\TestAsset; | ||
|
||
use DateTime; | ||
use DateTimeInterface; | ||
use Laminas\Validator\Date; | ||
|
||
final class CustomDate extends Date | ||
{ | ||
/** @var string */ | ||
protected $format = self::FORMAT_DEFAULT; | ||
|
||
/** @var bool */ | ||
protected $strict = false; | ||
|
||
/** | ||
* @param string|numeric|array|DateTimeInterface $value | ||
* @return bool | ||
*/ | ||
public function isValid($value) | ||
{ | ||
return parent::isValid($value); | ||
} | ||
|
||
/** | ||
* @param string|numeric|array|DateTimeInterface $param | ||
* @param bool $addErrors | ||
* @return bool|DateTime | ||
*/ | ||
protected function convertToDateTime($param, $addErrors = true) | ||
{ | ||
return parent::convertToDateTime($param, false); | ||
} | ||
|
||
/** | ||
* @param integer $value | ||
* @return false|DateTime | ||
*/ | ||
protected function convertInteger($value) | ||
{ | ||
return parent::convertInteger($value); | ||
} | ||
|
||
/** | ||
* @param double $value | ||
* @return false|DateTime | ||
*/ | ||
protected function convertDouble($value) | ||
{ | ||
return parent::convertDouble($value * 100); | ||
} | ||
} |