phpstan add types

This commit is contained in:
2025-03-10 16:27:45 +05:00
parent 3701265a0a
commit 11df811e0c
4 changed files with 32 additions and 9 deletions

View File

@@ -142,6 +142,10 @@ function storeAuthEvent(string $name, Request $request): void
/**
* Store resource events
*
* @param string $name Event name
* @param array<int, mixed> $data Event data
* @param Request $request
*/
function storeResourceEvent(string $name, array $data, Request $request): void
{
@@ -205,7 +209,7 @@ function localeAppUrl(): string
/**
* Original quality :D
*/
function convertToOriginalFormat($apiPrice)
function convertToOriginalFormat(int|float|string $apiPrice): string
{
$originalPrice = intval($apiPrice) / 100;
@@ -214,8 +218,11 @@ function convertToOriginalFormat($apiPrice)
/**
* Date day mf
*
* @param string $month
* @param string $year
*/
function lastDayOfMonth($month, $year)
function lastDayOfMonth(string $month, int|string $year): DateTime
{
$date = new DateTime("$year-$month-01");
$date->modify('last day of this month');
@@ -225,8 +232,12 @@ function lastDayOfMonth($month, $year)
/**
* Get index by value from array
*
* @param mixed $value Value to be searched
* @param array<int, mixed> $array Array
* @return null|int
*/
function indexByValue($value, $array)
function indexByValue(mixed $value, array $array): ?int
{
for ($i = 0; $i < count($array); $i++) {
if ($array[$i] == $value) {