Skip to content

Commit

Permalink
add support for php 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
514sid committed Sep 3, 2023
1 parent edd25c4 commit ab703e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/Collection/FloatFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Num\Num;
use MichaelRubel\Formatters\Formatter;
use Num\Enums\DecimalSeparator;

class FloatFormatter implements Formatter
{
Expand All @@ -21,18 +20,18 @@ public function __construct(
}

/**
* Get the decimal separator as a DecimalSeparator enum value.
* Get the valid decimal separator or null.
*
* @param string|null $decimal_separator The decimal separator to convert.
* @return DecimalSeparator|null The DecimalSeparator enum value.
* @return string|null The valid decimal separator or null.
*/
private function getDecimalSeparator(?string $decimal_separator): ?DecimalSeparator
private function getDecimalSeparator(?string $decimal_separator): ?string
{
switch ($decimal_separator) {
case '.':
return DecimalSeparator::POINT;
return '.';
case ',':
return DecimalSeparator::COMMA;
return ',';
default:
return null;
}
Expand Down
15 changes: 7 additions & 8 deletions src/Collection/IntFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Num\Num;
use MichaelRubel\Formatters\Formatter;
use Num\Enums\DecimalSeparator;

class IntFormatter implements Formatter
{
Expand All @@ -21,27 +20,27 @@ public function __construct(
}

/**
* Get the decimal separator as a DecimalSeparator enum value.
* Get the valid decimal separator or null.
*
* @param string|null $decimal_separator The decimal separator to convert.
* @return DecimalSeparator|null The DecimalSeparator enum value.
* @return string|null The valid decimal separator or null.
*/
private function getDecimalSeparator(?string $decimal_separator): ?DecimalSeparator
private function getDecimalSeparator(?string $decimal_separator): ?string
{
switch ($decimal_separator) {
case '.':
return DecimalSeparator::POINT;
return '.';
case ',':
return DecimalSeparator::COMMA;
return ',';
default:
return null;
}
}

/**
* Format the value as a int using the specified decimal separator.
* Format the value as an integer using the specified decimal separator.
*
* @return int The formatted int value.
* @return int The formatted integer value.
*/
public function format(): int
{
Expand Down

0 comments on commit ab703e7

Please sign in to comment.