-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Method LastDragon_ru\LaraASP\Formatter\Formatter::time() should retur…
…n string but returns string|false. Method LastDragon_ru\LaraASP\Formatter\Formatter::date() should return string but returns string|false. Method LastDragon_ru\LaraASP\Formatter\Formatter::datetime() should return string but returns string|false. Parameter #1 $value of method LastDragon_ru\LaraASP\Formatter\Formatter::decimal() expects float|null, float|int<min, 1023> given. Parameter #3 $length of function mb_substr expects int|null, float|int given. Parameter #2 $length of function str_pad expects int, float|int given. Method LastDragon_ru\LaraASP\Formatter\Formatter::getIntlNumberFormatter() should return NumberFormatter but returns IntlDateFormatter|NumberFormatter. Parameter #1 $attribute of method NumberFormatter::setAttribute() expects int, int|string given. Parameter #1 $symbol of method NumberFormatter::setSymbol() expects int, int|string given. Parameter #1 $attribute of method NumberFormatter::setTextAttribute() expects int, int|string given. Method LastDragon_ru\LaraASP\Formatter\Formatter::getIntlDateFormatter() should return IntlDateFormatter but returns IntlDateFormatter|NumberFormatter.
- Loading branch information
1 parent
7150212
commit cb8900c
Showing
5 changed files
with
336 additions
and
203 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
packages/formatter/src/Exceptions/FailedToCreateDateFormatter.php
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,32 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace LastDragon_ru\LaraASP\Formatter\Exceptions; | ||
|
||
use IntlDateFormatter; | ||
use LastDragon_ru\LaraASP\Formatter\PackageException; | ||
use Throwable; | ||
|
||
use function sprintf; | ||
|
||
class FailedToCreateDateFormatter extends PackageException { | ||
public function __construct( | ||
protected string $type, | ||
protected string|int|null $format, | ||
Throwable $previous = null, | ||
) { | ||
parent::__construct(sprintf( | ||
'Failed to create instance of `%s` for type `%s` with format `%s`.', | ||
IntlDateFormatter::class, | ||
$this->getType(), | ||
$this->getFormat() ?? 'null', | ||
), $previous); | ||
} | ||
|
||
public function getType(): string { | ||
return $this->type; | ||
} | ||
|
||
public function getFormat(): string|int|null { | ||
return $this->format; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/formatter/src/Exceptions/FailedToCreateNumberFormatter.php
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,26 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace LastDragon_ru\LaraASP\Formatter\Exceptions; | ||
|
||
use LastDragon_ru\LaraASP\Formatter\PackageException; | ||
use NumberFormatter; | ||
use Throwable; | ||
|
||
use function sprintf; | ||
|
||
class FailedToCreateNumberFormatter extends PackageException { | ||
public function __construct( | ||
protected string $type, | ||
Throwable $previous = null, | ||
) { | ||
parent::__construct(sprintf( | ||
'Failed to create instance of `%s` for type `%s`.', | ||
NumberFormatter::class, | ||
$this->getType(), | ||
), $previous); | ||
} | ||
|
||
public function getType(): string { | ||
return $this->type; | ||
} | ||
} |
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,36 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace LastDragon_ru\LaraASP\Formatter\Exceptions; | ||
|
||
use LastDragon_ru\LaraASP\Formatter\PackageException; | ||
use Throwable; | ||
|
||
use function sprintf; | ||
|
||
class FailedToFormatDate extends PackageException { | ||
public function __construct( | ||
protected string $type, | ||
protected int $errorCode, | ||
protected string $errorMessage, | ||
Throwable $previous = null, | ||
) { | ||
parent::__construct(sprintf( | ||
'Date formatting for type `%s` failed: `%s` (`%s`).', | ||
$this->getType(), | ||
$this->getErrorMessage(), | ||
$this->getErrorCode(), | ||
), $previous); | ||
} | ||
|
||
public function getType(): string { | ||
return $this->type; | ||
} | ||
|
||
public function getErrorCode(): int { | ||
return $this->errorCode; | ||
} | ||
|
||
public function getErrorMessage(): string { | ||
return $this->errorMessage; | ||
} | ||
} |
Oops, something went wrong.