Laravel 9 Update (#1413)
Update to Laravel 9 and PHP 8+ Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Length;
|
||||
|
||||
class Distance extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'm',
|
||||
'km',
|
||||
'mi',
|
||||
@@ -17,19 +17,26 @@ class Distance extends Unit
|
||||
/**
|
||||
* Distance constructor.
|
||||
*
|
||||
* @param float $value
|
||||
* @param string $unit
|
||||
* @param Distance|float $value
|
||||
* @param string $unit The unit of $value
|
||||
*
|
||||
* @throws \PhpUnitsOfMeasure\Exception\NonNumericValue
|
||||
* @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName
|
||||
*/
|
||||
public function __construct($value, string $unit)
|
||||
public function __construct(mixed $value, string $unit)
|
||||
{
|
||||
if (empty($value)) {
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.distance');
|
||||
$this->instance = new Length($value, $unit);
|
||||
$this->localUnit = setting('units.distance');
|
||||
$this->internalUnit = config('phpvms.internal_units.distance');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new Length($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user