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 Altitude extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'ft',
|
||||
'km',
|
||||
'm',
|
||||
@@ -26,7 +26,14 @@ class Altitude extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.altitude');
|
||||
$this->instance = new Length($value, $unit);
|
||||
$this->localUnit = setting('units.altitude');
|
||||
$this->internalUnit = config('phpvms.internal_units.altitude');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new Length($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Mass;
|
||||
|
||||
class Fuel extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'kg',
|
||||
'lbs',
|
||||
];
|
||||
@@ -25,7 +25,14 @@ class Fuel extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.fuel');
|
||||
$this->instance = new Mass($value, $unit);
|
||||
$this->localUnit = setting('units.fuel');
|
||||
$this->internalUnit = config('phpvms.internal_units.fuel');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new Mass($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Mass as MassUnit;
|
||||
|
||||
class Mass extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'kg',
|
||||
'lbs',
|
||||
];
|
||||
@@ -25,7 +25,14 @@ class Mass extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.weight');
|
||||
$this->instance = new MassUnit($value, $unit);
|
||||
$this->localUnit = setting('units.weight');
|
||||
$this->internalUnit = config('phpvms.internal_units.mass');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new MassUnit($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Pressure as PressureUnit;
|
||||
*/
|
||||
class Pressure extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'atm',
|
||||
'hPa',
|
||||
];
|
||||
@@ -28,7 +28,14 @@ class Pressure extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.temperature');
|
||||
$this->instance = new PressureUnit($value, $unit);
|
||||
$this->localUnit = setting('units.temperature');
|
||||
$this->internalUnit = config('phpvms.internal_units.temperature');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new PressureUnit($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Temperature as TemperatureUnit;
|
||||
*/
|
||||
class Temperature extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'C',
|
||||
'F',
|
||||
];
|
||||
@@ -28,7 +28,14 @@ class Temperature extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.temperature');
|
||||
$this->instance = new TemperatureUnit($value, $unit);
|
||||
$this->localUnit = setting('units.temperature');
|
||||
$this->internalUnit = config('phpvms.internal_units.temperature');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new TemperatureUnit($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Velocity as VelocityUnit;
|
||||
*/
|
||||
class Velocity extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'km/h',
|
||||
'knots',
|
||||
];
|
||||
@@ -28,7 +28,14 @@ class Velocity extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.speed');
|
||||
$this->instance = new VelocityUnit($value, $unit);
|
||||
$this->localUnit = setting('units.speed');
|
||||
$this->internalUnit = config('phpvms.internal_units.velocity');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new VelocityUnit($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Volume as VolumeUnit;
|
||||
*/
|
||||
class Volume extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
public array $responseUnits = [
|
||||
'gal',
|
||||
'liters',
|
||||
];
|
||||
@@ -28,7 +28,14 @@ class Volume extends Unit
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$this->unit = setting('units.volume');
|
||||
$this->instance = new VolumeUnit($value, $unit);
|
||||
$this->localUnit = setting('units.volume');
|
||||
$this->internalUnit = config('phpvms.internal_units.volume');
|
||||
|
||||
if ($value instanceof self) {
|
||||
$value->toUnit($unit);
|
||||
$this->instance = $value->instance;
|
||||
} else {
|
||||
$this->instance = new VolumeUnit($value, $unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user