Skip to content

Commit 0423c8d

Browse files
committed
Update PHPStan
1 parent 8f8ce0d commit 0423c8d

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"phpunit/phpunit": "<=11.99",
2121
"phpfui/phpunit-syntax-coverage": "^1.0",
2222
"roave/security-advisories": "dev-latest",
23-
"friendsofphp/php-cs-fixer": "^3.0",
23+
"friendsofphp/php-cs-fixer": "*",
2424
"nesbot/carbon": "*",
25-
"phpstan/phpstan": "^1.8"
25+
"phpstan/phpstan": "*"
2626
},
2727
"autoload": {
2828
"psr-4": {"PHPFUI\\": "src/PHPFUI/"}

src/PHPFUI/ORM.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static function getRecordNamespacePath() : string
216216
/**
217217
* @param array<mixed> $input
218218
*
219-
* @return array<string, string> a single row of the first matching record or an empty array if an error
219+
* @return array<string, ?string> a single row of the first matching record or an empty array if an error
220220
*/
221221
public static function getRow(string $sql, array $input = []) : array
222222
{

src/PHPFUI/ORM/DataObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
class DataObject implements \ArrayAccess
99
{
10-
/** @param array<string, string> $current */
10+
/** @param array<string, string | null | int | bool | float> $current */
1111
public function __construct(protected array $current)
1212
{
1313
}

src/PHPFUI/ORM/PDOInstance.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,8 @@ public function getRows(string $sql, array $input = [], int $fetchType = \PDO::F
275275
{
276276
return [];
277277
}
278-
$returnValue = $statement->fetchAll($fetchType);
279278

280-
if (! \is_array($returnValue))
281-
{
282-
$returnValue = [];
283-
}
284-
285-
return $returnValue;
279+
return $statement->fetchAll($fetchType);
286280
}
287281

288282
/**

src/PHPFUI/ORM/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public function count() : int
311311
}
312312

313313
/**
314-
* Delete record matching the requested parameters
314+
* Delete record matching the current where clause
315315
*/
316316
public function delete(bool $allowDeleteAll = false) : static
317317
{

src/PHPFUI/ORM/Validator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ private function validate_date(mixed $value) : string
415415
return '';
416416
}
417417

418-
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), (int)($parts[$day] ?? 0), (int)($parts[$year] ?? 0)), 'date', ['value' => $value]);
418+
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), (int)($parts[$day] ?? 0), (int)$parts[$year]), 'date', ['value' => $value]);
419419
}
420420

421421
private function validate_dateISO(mixed $value) : string
@@ -424,7 +424,7 @@ private function validate_dateISO(mixed $value) : string
424424
$month = 1;
425425
$day = 2;
426426
$parts = \explode('-', (string)$value);
427-
$year = \sprintf('%04d', (int)($parts[$year] ?? 0));
427+
$year = \sprintf('%04d', (int)$parts[$year]);
428428
$month = \sprintf('%02d', (int)($parts[$month] ?? 0));
429429
$day = \sprintf('%02d', (int)($parts[$day] ?? 0));
430430

@@ -465,7 +465,7 @@ private function validate_day_month_year(mixed $value) : string
465465
return '';
466466
}
467467

468-
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), (int)($parts[$day] ?? 0), (int)($parts[$year] ?? 0)), 'day_month_year', ['value' => $value]);
468+
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), (int)$parts[$day], (int)($parts[$year] ?? 0)), 'day_month_year', ['value' => $value]);
469469
}
470470

471471
private function validate_domain(mixed $value) : string
@@ -648,7 +648,7 @@ private function validate_month_day_year(mixed $value) : string
648648
return '';
649649
}
650650

651-
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), (int)($parts[$day] ?? 0), (int)($parts[$year] ?? 0)), 'month_day_year', ['value' => $value]);
651+
return $this->testIt(\checkdate((int)$parts[$month], (int)($parts[$day] ?? 0), (int)($parts[$year] ?? 0)), 'month_day_year', ['value' => $value]);
652652
}
653653

654654
private function validate_month_year(mixed $value) : string
@@ -658,7 +658,7 @@ private function validate_month_year(mixed $value) : string
658658
$day = 1;
659659
$parts = \explode('/', \str_replace(self::$dateSeparators, '/', (string)$value));
660660

661-
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), $day, (int)($parts[$year] ?? 0)), 'month_year', ['value' => $value]);
661+
return $this->testIt(\checkdate((int)$parts[$month], $day, (int)($parts[$year] ?? 0)), 'month_year', ['value' => $value]);
662662
}
663663

664664
private function validate_neq_field(mixed $value) : string
@@ -794,7 +794,7 @@ private function validate_year_month(mixed $value) : string
794794
$day = 1;
795795
$parts = \explode('/', \str_replace(self::$dateSeparators, '/', (string)$value));
796796

797-
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), $day, (int)($parts[$year] ?? 0)), 'year_month', ['value' => $value]);
797+
return $this->testIt(\checkdate((int)($parts[$month] ?? 0), $day, (int)$parts[$year]), 'year_month', ['value' => $value]);
798798
}
799799

800800
/**

0 commit comments

Comments
 (0)