Merge pull request #5146 from Roardom/update-phpstan

(Update) Phpstan
This commit is contained in:
Roardom
2025-12-02 07:48:48 +00:00
committed by GitHub
9 changed files with 68 additions and 57 deletions

View File

@@ -103,7 +103,7 @@ class SystemInformation
protected function formatBytes(int|float $bytes, int $precision = 2): string
{
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1_024));
$pow = (int) floor(($bytes ? log($bytes) : 0) / log(1_024));
$pow = min($pow, (\count(self::UNITS)) - 1);
// Uncomment one of the following alternatives
$bytes /= 1_024 ** $pow;

View File

@@ -29,10 +29,10 @@ use AllowDynamicProperties;
* @property string $name
* @property string $description
* @property float $cost
* @property int $upload_value
* @property int $invite_value
* @property int $bonus_value
* @property int $donor_value
* @property int|null $upload_value
* @property int|null $invite_value
* @property int|null $bonus_value
* @property int|null $donor_value
* @property bool $is_active
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at

View File

@@ -25,42 +25,42 @@ use AllowDynamicProperties;
/**
* App\Models\Group.
*
* @property int $id
* @property string $name
* @property string $slug
* @property int $position
* @property int $level
* @property int|null $download_slots
* @property string $description
* @property string $color
* @property string $icon
* @property string $effect
* @property bool $is_uploader
* @property bool $is_internal
* @property bool $is_editor
* @property bool $is_torrent_modo
* @property bool $is_owner
* @property bool $is_admin
* @property bool $is_modo
* @property bool $is_trusted
* @property bool $is_immune
* @property bool $is_freeleech
* @property bool $is_double_upload
* @property bool $is_refundable
* @property bool $can_chat
* @property bool $can_comment
* @property bool $can_invite
* @property bool $can_request
* @property bool $can_upload
* @property bool $is_incognito
* @property bool $autogroup
* @property bool $system_required
* @property int $min_uploaded
* @property int $min_seedsize
* @property int $min_avg_seedtime
* @property string $min_ratio
* @property int $min_age
* @property int $min_uploads
* @property int $id
* @property string $name
* @property string $slug
* @property int $position
* @property int $level
* @property int|null $download_slots
* @property string $description
* @property string $color
* @property string $icon
* @property string $effect
* @property bool $is_uploader
* @property bool $is_internal
* @property bool $is_editor
* @property bool $is_torrent_modo
* @property bool $is_owner
* @property bool $is_admin
* @property bool $is_modo
* @property bool $is_trusted
* @property bool $is_immune
* @property bool $is_freeleech
* @property bool $is_double_upload
* @property bool $is_refundable
* @property bool $can_chat
* @property bool $can_comment
* @property bool $can_invite
* @property bool $can_request
* @property bool $can_upload
* @property bool $is_incognito
* @property bool $autogroup
* @property bool $system_required
* @property int|null $min_uploaded
* @property int|null $min_seedsize
* @property int|null $min_avg_seedtime
* @property string|null $min_ratio
* @property int|null $min_age
* @property int|null $min_uploads
*/
#[AllowDynamicProperties]
final class Group extends Model

View File

@@ -56,7 +56,7 @@ use AllowDynamicProperties;
* @property int|null $tmdb_movie_id
* @property int|null $tmdb_tv_id
* @property int $mal
* @property int $igdb
* @property int|null $igdb
* @property int|null $season_number
* @property int|null $episode_number
* @property int $free

View File

@@ -36,7 +36,7 @@ use AllowDynamicProperties;
* @property int|null $tmdb_movie_id
* @property int|null $tmdb_tv_id
* @property int|null $mal
* @property int $igdb
* @property int|null $igdb
* @property string $description
* @property int $user_id
* @property string $bounty

View File

@@ -87,9 +87,7 @@ class NewComment extends Notification
// the expression will return false.
return ! \in_array($this->comment->user->group_id, $notifiable->notification?->json_request_groups ?? [], true);
case Ticket::class:
return ! ($this->model->staff_id === $this->comment->id && $this->model->staff_id !== null)
;
return $notifiable->id !== $this->comment->user_id;
case Playlist::class:
case Article::class:
break;

View File

@@ -56,7 +56,7 @@
"pestphp/pest": "^4.0.4",
"pestphp/pest-plugin-laravel": "^4.0.0",
"pestphp/pest-plugin-livewire": "^4.0.1",
"phpstan/phpstan": "^2.1.22",
"phpstan/phpstan": "^2.1.32",
"phpunit/phpunit": "^12.3.7",
"ryoluo/sail-ssl": "^1.4.0",
"spatie/laravel-ignition": "^2.9.1",

15
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "584c406149cfba22c7fc31de2de730d9",
"content-hash": "870e91300f59189b99e27297e921015d",
"packages": [
{
"name": "assada/laravel-achievements",
@@ -10988,16 +10988,11 @@
},
{
"name": "phpstan/phpstan",
"version": "2.1.22",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4"
},
"version": "2.1.32",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4",
"reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e126cad1e30a99b137b8ed75a85a676450ebb227",
"reference": "e126cad1e30a99b137b8ed75a85a676450ebb227",
"shasum": ""
},
"require": {
@@ -11042,7 +11037,7 @@
"type": "github"
}
],
"time": "2025-08-04T19:17:37+00:00"
"time": "2025-11-11T15:18:17+00:00"
},
{
"name": "phpunit/php-code-coverage",

View File

@@ -420,6 +420,24 @@ parameters:
count: 1
path: app/Http/Livewire/MissingMediaSearch.php
-
message: '#^Offset ''game'' might not exist on array\{movie\?\: non\-empty\-array\<int, array\{Movie\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, category_id\: int\}\>, tv\?\: non\-empty\-array\<int, array\{''Complete Pack''\?\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, Specials\?\: non\-empty\-array\<string, array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>\>, Seasons\?\: non\-empty\-array\<string, array\{''Season Pack''\?\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, Episodes\?\: non\-empty\-array\<string, array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>\>\}\>, category_id\: int\}\>, game\?\: non\-empty\-array\<int, array\{Game\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, category_id\: int\}\>\}\.$#'
identifier: offsetAccess.notFound
count: 1
path: app/Http/Livewire/SimilarTorrent.php
-
message: '#^Offset ''movie'' might not exist on array\{movie\?\: non\-empty\-array\<int, array\{Movie\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, category_id\: int\}\>, tv\?\: non\-empty\-array\<int, array\{''Complete Pack''\?\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, Specials\?\: non\-empty\-array\<string, array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>\>, Seasons\?\: non\-empty\-array\<string, array\{''Season Pack''\?\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, Episodes\?\: non\-empty\-array\<string, array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>\>\}\>, category_id\: int\}\>, game\?\: non\-empty\-array\<int, array\{Game\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, category_id\: int\}\>\}\.$#'
identifier: offsetAccess.notFound
count: 1
path: app/Http/Livewire/SimilarTorrent.php
-
message: '#^Offset ''tv'' might not exist on array\{movie\?\: non\-empty\-array\<int, array\{Movie\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, category_id\: int\}\>, tv\?\: non\-empty\-array\<int, array\{''Complete Pack''\?\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, Specials\?\: non\-empty\-array\<string, array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>\>, Seasons\?\: non\-empty\-array\<string, array\{''Season Pack''\?\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, Episodes\?\: non\-empty\-array\<string, array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>\>\}\>, category_id\: int\}\>, game\?\: non\-empty\-array\<int, array\{Game\: non\-empty\-array\<string, non\-empty\-list\<App\\Models\\Torrent\>\>, category_id\: int\}\>\}\.$#'
identifier: offsetAccess.notFound
count: 1
path: app/Http/Livewire/SimilarTorrent.php
-
message: '#^Anonymous function should return Illuminate\\Database\\Eloquent\\Builder\<Illuminate\\Database\\Eloquent\\Model\> but returns Illuminate\\Database\\Eloquent\\Builder\<App\\Models\\Group\>\.$#'
identifier: return.type