-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed wrong datetime assignment (#52)
Co-authored-by: Dimannn <[email protected]>
- Loading branch information
1 parent
e5752f6
commit 363320a
Showing
2 changed files
with
60 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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OnMoon\OpenApiServerBundle\Mapper; | ||
|
||
use OnMoon\OpenApiServerBundle\Exception\OpenApiError; | ||
use Safe\Exceptions\StringsException; | ||
use function Safe\sprintf; | ||
|
||
class NotADateTimeValue extends OpenApiError | ||
{ | ||
/** @var mixed $value */ | ||
private $value; | ||
|
||
/** | ||
* @param mixed $value | ||
* | ||
* @throws StringsException | ||
*/ | ||
public function __construct(string $name, string $class, $value) | ||
{ | ||
$message = sprintf( | ||
'Value is not DateTime for "%s" in "%s"', | ||
$name, | ||
$class | ||
); | ||
$this->value = $value; | ||
parent::__construct($message); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
} |