File tree 4 files changed +11
-4
lines changed
4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
.idea
2
2
vendor
3
3
/.phpunit.result.cache
4
+ composer.lock
Original file line number Diff line number Diff line change 38
38
"scripts" : {
39
39
"test" : [
40
40
" phpunit" ,
41
- " phpstan analyse src --level=7 "
41
+ " phpstan analyse src --level=8 "
42
42
],
43
43
"coverage" : [
44
44
" phpunit --coverage-clover=coverage"
Original file line number Diff line number Diff line change @@ -53,8 +53,11 @@ public static function current(): self
53
53
*/
54
54
public static function of (string $ month , int $ year = null ): self
55
55
{
56
- $ year = $ year === null ? (int ) date ('Y ' ) : $ year ;
57
- $ parsed_month = date_parse ($ month )['month ' ];
56
+ $ year = $ year === null ? (int ) date ('Y ' ) : $ year ;
57
+ $ parsed = date_parse ($ month );
58
+ assert ($ parsed !== false );
59
+
60
+ $ parsed_month = $ parsed ['month ' ];
58
61
if ($ parsed_month !== false ) {
59
62
return new self ($ parsed_month , $ year );
60
63
}
Original file line number Diff line number Diff line change @@ -88,7 +88,10 @@ public function __construct(TimeUnitInterface $unit)
88
88
*/
89
89
public static function from (DateInterval $ interval ): self
90
90
{
91
- return new self (new Days ($ interval ->days ));
91
+ $ days = $ interval ->days ;
92
+ assert ($ days !== false );
93
+
94
+ return new self (new Days ((float ) $ days ));
92
95
}
93
96
94
97
/**
You can’t perform that action at this time.
0 commit comments