Skip to content

Commit 75d1576

Browse files
committed
Fixed phpstan issues
1 parent 46e62e8 commit 75d1576

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
vendor
33
/.phpunit.result.cache
4+
composer.lock

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"scripts": {
3939
"test": [
4040
"phpunit",
41-
"phpstan analyse src --level=7"
41+
"phpstan analyse src --level=8"
4242
],
4343
"coverage": [
4444
"phpunit --coverage-clover=coverage"

Diff for: src/Month.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ public static function current(): self
5353
*/
5454
public static function of(string $month, int $year = null): self
5555
{
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'];
5861
if ($parsed_month !== false) {
5962
return new self($parsed_month, $year);
6063
}

Diff for: src/TimeUnits.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ public function __construct(TimeUnitInterface $unit)
8888
*/
8989
public static function from(DateInterval $interval): self
9090
{
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));
9295
}
9396

9497
/**

0 commit comments

Comments
 (0)