phpstan add types
This commit is contained in:
@@ -142,6 +142,10 @@ function storeAuthEvent(string $name, Request $request): void
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Store resource events
|
* 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
|
function storeResourceEvent(string $name, array $data, Request $request): void
|
||||||
{
|
{
|
||||||
@@ -205,7 +209,7 @@ function localeAppUrl(): string
|
|||||||
/**
|
/**
|
||||||
* Original quality :D
|
* Original quality :D
|
||||||
*/
|
*/
|
||||||
function convertToOriginalFormat($apiPrice)
|
function convertToOriginalFormat(int|float|string $apiPrice): string
|
||||||
{
|
{
|
||||||
$originalPrice = intval($apiPrice) / 100;
|
$originalPrice = intval($apiPrice) / 100;
|
||||||
|
|
||||||
@@ -214,8 +218,11 @@ function convertToOriginalFormat($apiPrice)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Date day mf
|
* 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 = new DateTime("$year-$month-01");
|
||||||
$date->modify('last day of this month');
|
$date->modify('last day of this month');
|
||||||
@@ -225,8 +232,12 @@ function lastDayOfMonth($month, $year)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get index by value from array
|
* 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++) {
|
for ($i = 0; $i < count($array); $i++) {
|
||||||
if ($array[$i] == $value) {
|
if ($array[$i] == $value) {
|
||||||
|
|||||||
@@ -2,15 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Alert;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
class AlertController extends Controller
|
class AlertController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get alerts for user
|
* Get alerts for user
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index(): JsonResponse
|
||||||
{
|
{
|
||||||
$alerstQuery = auth()->user()->alerts()->whereNull('seen_at');
|
/** @var \App\Models\User */
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
/** @var \Illuminate\Database\Eloquent\Builder<Alert> */
|
||||||
|
$alerstQuery = $user->alerts()->whereNull('seen_at');
|
||||||
|
|
||||||
|
/** @var Collection<array-key, Alert> */
|
||||||
$alerts = $alerstQuery->get();
|
$alerts = $alerstQuery->get();
|
||||||
|
|
||||||
$alerstQuery->update([
|
$alerstQuery->update([
|
||||||
@@ -22,10 +31,13 @@ class AlertController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format
|
* Format
|
||||||
|
*
|
||||||
|
* @param Collection<array-key, Alert> $alerts
|
||||||
|
* @return Collection<array-key, Alert>
|
||||||
*/
|
*/
|
||||||
public function format($alerts)
|
public function format(Collection $alerts): Collection
|
||||||
{
|
{
|
||||||
return $alerts->map(fn ($alert) => [
|
return $alerts->map(fn (Alert $alert) => [
|
||||||
'name' => $alert->name,
|
'name' => $alert->name,
|
||||||
'value' => $alert->value,
|
'value' => $alert->value,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class OnlinePaymentRepo
|
|||||||
'title' => __('Payment is successful'),
|
'title' => __('Payment is successful'),
|
||||||
'pnr' => $paymentHistory->orderNumber,
|
'pnr' => $paymentHistory->orderNumber,
|
||||||
'branch_name' => $bank_branch->name,
|
'branch_name' => $bank_branch->name,
|
||||||
'price_amount' => convertToOriginalFormat($paymentHistory->amount).' TMT',
|
'price_amount' => \convertToOriginalFormat($paymentHistory->amount).' TMT',
|
||||||
'return_url' => $returnURL,
|
'return_url' => $returnURL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ parameters:
|
|||||||
- app/
|
- app/
|
||||||
|
|
||||||
# Level 9 is the highest level
|
# Level 9 is the highest level
|
||||||
level: 5
|
level: 6
|
||||||
|
|
||||||
# ignoreErrors:
|
# ignoreErrors:
|
||||||
# - '#PHPDoc tag @var#'
|
# - '#PHPDoc tag @var#'
|
||||||
|
|||||||
Reference in New Issue
Block a user