Add PHP type hints

This commit is contained in:
Shift
2023-03-30 14:15:39 +00:00
parent 5e7a2d9254
commit afb0f41611
220 changed files with 523 additions and 469 deletions
+8 -6
View File
@@ -2,6 +2,8 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Model;
/**
@@ -64,7 +66,7 @@ class Video extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function alias()
public function alias(): HasMany
{
return $this->hasMany(VideoAlias::class, 'videos_id');
}
@@ -72,7 +74,7 @@ class Video extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function release()
public function release(): HasMany
{
return $this->hasMany(Release::class, 'videos_id');
}
@@ -80,7 +82,7 @@ class Video extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function episode()
public function episode(): HasMany
{
return $this->hasMany(TvEpisode::class, 'videos_id');
}
@@ -107,7 +109,7 @@ class Video extends Model
* @param string $showname
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public static function getRange($showname = '')
public static function getRange(string $showname = ''): LengthAwarePaginator
{
$sql = self::query()
->select(['videos.*', 'tv_info.summary', 'tv_info.publisher', 'tv_info.image'])
@@ -126,7 +128,7 @@ class Video extends Model
*
* @param string $showname
*/
public static function getCount($showname = ''): int
public static function getCount(string $showname = ''): int
{
$res = self::query()->join('tv_info', 'videos.id', '=', 'tv_info.videos_id');
@@ -143,7 +145,7 @@ class Video extends Model
* @param string $letter
* @param string $showname
*/
public static function getSeriesList($uid, $letter = '', $showname = ''): array
public static function getSeriesList($uid, string $letter = '', string $showname = ''): array
{
if (($letter !== '') && $letter === '0-9') {
$letter = '[0-9]';