Skip to content

Commit 675047b

Browse files
committed
Bumped up PHP version and switched coding standards.
1 parent a4f7ee2 commit 675047b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+435
-341
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: php
33
sudo: false
44

55
php:
6-
- 8.0
6+
- 8.2
77

88
before_script:
99
- composer self-update

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.4 (2022.07.21)
2+
- Bumped up minimum PHP version to 8.2
3+
- Swapped Laminas Coding Standards for Qubus Coding Standards
4+
- Made changes/updates per Qubus Coding Standards
5+
16
## 2.0.1 (2022.07.21)
27
- Switched league/geotools for laravie/geotools.
38

Climate/Celsius.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -14,22 +15,29 @@
1415

1516
namespace Qubus\ValueObjects\Climate;
1617

17-
use Qubus\ValueObjects\Climate\Fahrenheit;
18-
use Qubus\ValueObjects\Climate\Kelvin;
19-
use Qubus\ValueObjects\Climate\Temperature;
18+
use Qubus\Exception\Data\TypeException;
2019

2120
class Celsius extends Temperature
2221
{
22+
/**
23+
* @throws TypeException
24+
*/
2325
public function toCelsius(): Celsius
2426
{
2527
return new static($this->value);
2628
}
2729

30+
/**
31+
* @throws TypeException
32+
*/
2833
public function toKelvin(): Kelvin
2934
{
3035
return new Kelvin($this->value + 273.15);
3136
}
3237

38+
/**
39+
* @throws TypeException
40+
*/
3341
public function toFahrenheit(): Fahrenheit
3442
{
3543
return new Fahrenheit($this->value * 1.8 + 32);

Climate/Fahrenheit.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -14,22 +15,29 @@
1415

1516
namespace Qubus\ValueObjects\Climate;
1617

17-
use Qubus\ValueObjects\Climate\Celsius;
18-
use Qubus\ValueObjects\Climate\Kelvin;
19-
use Qubus\ValueObjects\Climate\Temperature;
18+
use Qubus\Exception\Data\TypeException;
2019

2120
class Fahrenheit extends Temperature
2221
{
22+
/**
23+
* @throws TypeException
24+
*/
2325
public function toCelsius(): Celsius
2426
{
2527
return new Celsius(($this->value - 32) / 1.8);
2628
}
2729

30+
/**
31+
* @throws TypeException
32+
*/
2833
public function toKelvin(): Kelvin
2934
{
3035
return new Kelvin($this->toCelsius()->toNative() + 273.15);
3136
}
3237

38+
/**
39+
* @throws TypeException
40+
*/
3341
public function toFahrenheit(): Fahrenheit
3442
{
3543
return new static($this->value);

Climate/Kelvin.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -14,22 +15,29 @@
1415

1516
namespace Qubus\ValueObjects\Climate;
1617

17-
use Qubus\ValueObjects\Climate\Celsius;
18-
use Qubus\ValueObjects\Climate\Fahrenheit;
19-
use Qubus\ValueObjects\Climate\Temperature;
18+
use Qubus\Exception\Data\TypeException;
2019

2120
class Kelvin extends Temperature
2221
{
22+
/**
23+
* @throws TypeException
24+
*/
2325
public function toCelsius(): Celsius
2426
{
2527
return new Celsius($this->value - 273.15);
2628
}
2729

30+
/**
31+
* @throws TypeException
32+
*/
2833
public function toKelvin(): Kelvin
2934
{
3035
return new static($this->value);
3136
}
3237

38+
/**
39+
* @throws TypeException
40+
*/
3341
public function toFahrenheit(): Fahrenheit
3442
{
3543
return new Fahrenheit($this->toCelsius()->toNative() * 1.8 + 32);

Climate/RelativeHumidity.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -32,6 +33,7 @@ class RelativeHumidity extends Natural
3233

3334
/**
3435
* Returns a new RelativeHumidity object.
36+
* @throws TypeException
3537
*/
3638
public function __construct(int $value)
3739
{
@@ -55,8 +57,8 @@ public function __construct(int $value)
5557
/**
5658
* Returns a new RelativeHumidity from native int value.
5759
*
58-
* @param int ...$value
59-
* @return RelativeHumidity|ValueObject
60+
* @return ValueObject
61+
* @throws TypeException
6062
*/
6163
public static function fromNative(): ValueObject
6264
{

Climate/Temperature.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -14,9 +15,6 @@
1415

1516
namespace Qubus\ValueObjects\Climate;
1617

17-
use Qubus\ValueObjects\Climate\Celsius;
18-
use Qubus\ValueObjects\Climate\Fahrenheit;
19-
use Qubus\ValueObjects\Climate\Kelvin;
2018
use Qubus\ValueObjects\Number\RealNumber;
2119

2220
abstract class Temperature extends RealNumber

DateTime/Date.php

+14-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -15,10 +16,8 @@
1516
namespace Qubus\ValueObjects\DateTime;
1617

1718
use Carbon\CarbonImmutable;
19+
use Qubus\Exception\Data\TypeException;
1820
use Qubus\ValueObjects\DateTime\Exception\InvalidDateException;
19-
use Qubus\ValueObjects\DateTime\Month;
20-
use Qubus\ValueObjects\DateTime\MonthDay;
21-
use Qubus\ValueObjects\DateTime\Year;
2221
use Qubus\ValueObjects\Util;
2322
use Qubus\ValueObjects\ValueObject;
2423

@@ -62,13 +61,14 @@ public function __toString(): string
6261
/**
6362
* Returns a new Date from native year, month and day values.
6463
*
65-
* @param int $year
66-
* @param string $month
67-
* @param int $day
68-
* @throws InvalidDateException
64+
* @param int $year
65+
* @param string $month
66+
* @param int $day
6967
* @return Date|ValueObject
68+
* @throws TypeException
69+
* @throws InvalidDateException
7070
*/
71-
public static function fromNative(): ValueObject
71+
public static function fromNative(): Date|ValueObject
7272
{
7373
$args = func_get_args();
7474

@@ -82,7 +82,7 @@ public static function fromNative(): ValueObject
8282
/**
8383
* Returns a new Date from CarbonImmutable.
8484
*
85-
* @throws InvalidDateException
85+
* @throws InvalidDateException|TypeException
8686
*/
8787
public static function fromNativeCarbonImmutable(CarbonImmutable $date): Date
8888
{
@@ -97,6 +97,7 @@ public static function fromNativeCarbonImmutable(CarbonImmutable $date): Date
9797
* Returns current Date.
9898
*
9999
* @throws InvalidDateException
100+
* @throws TypeException
100101
*/
101102
public static function now(): Date
102103
{
@@ -106,9 +107,10 @@ public static function now(): Date
106107
/**
107108
* Tells whether two Date are equal by comparing their values.
108109
*
109-
* @param ValueObject|Date $date
110+
* @param ValueObject|Date $date
111+
* @return bool
110112
*/
111-
public function equals(ValueObject $date): bool
113+
public function equals(Date|ValueObject $date): bool
112114
{
113115
if (false === Util::classEquals($this, $date)) {
114116
return false;

DateTime/DateTime.php

+14-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\ValueObjects
55
*
66
* @link https://github.com/QubusPHP/valueobjects
7-
* @copyright 2020 Joshua Parker
7+
* @copyright 2020
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 1.0.0
@@ -15,9 +16,8 @@
1516
namespace Qubus\ValueObjects\DateTime;
1617

1718
use Carbon\CarbonImmutable;
18-
use Qubus\ValueObjects\DateTime\Date;
19+
use Qubus\Exception\Data\TypeException;
1920
use Qubus\ValueObjects\DateTime\Exception\InvalidDateException;
20-
use Qubus\ValueObjects\DateTime\Time;
2121
use Qubus\ValueObjects\Util;
2222
use Qubus\ValueObjects\ValueObject;
2323

@@ -31,6 +31,7 @@ class DateTime implements ValueObject
3131

3232
/**
3333
* Returns a new DateTime object.
34+
* @throws TypeException
3435
*/
3536
public function __construct(Date $date, ?Time $time = null)
3637
{
@@ -52,16 +53,17 @@ public function __toString(): string
5253
/**
5354
* Returns a new DateTime object from native values.
5455
*
55-
* @param int $year
56+
* @param int $year
5657
* @param string $month
57-
* @param int $day
58-
* @param int $hour
59-
* @param int $minute
60-
* @param int $second
61-
* @throws InvalidDateException
58+
* @param int $day
59+
* @param int $hour
60+
* @param int $minute
61+
* @param int $second
6262
* @return DateTime|ValueObject
63+
* @throws TypeException
64+
* @throws InvalidDateException
6365
*/
64-
public static function fromNative(): ValueObject
66+
public static function fromNative(): DateTime|ValueObject
6567
{
6668
$args = func_get_args();
6769

@@ -74,7 +76,7 @@ public static function fromNative(): ValueObject
7476
/**
7577
* Returns a new DateTime from native CarbonImmutable.
7678
*
77-
* @throws InvalidDateException
79+
* @throws InvalidDateException|TypeException
7880
*/
7981
public static function fromNativeCarbonImmutable(CarbonImmutable $dateTime): DateTime
8082
{
@@ -88,6 +90,7 @@ public static function fromNativeCarbonImmutable(CarbonImmutable $dateTime): Dat
8890
* Returns current DateTime.
8991
*
9092
* @throws InvalidDateException
93+
* @throws TypeException
9194
*/
9295
public static function now(): DateTime
9396
{

0 commit comments

Comments
 (0)