Type *Type classes a bit more strictly

This commit is contained in:
Timothy Warren 2020-04-28 12:24:12 -04:00
parent ce0935333b
commit 754cf80c0b
10 changed files with 75 additions and 75 deletions

View File

@ -25,27 +25,27 @@ class Anime extends AbstractType {
/**
* @var string
*/
public ?string $age_rating = '';
public ?string $age_rating;
/**
* @var string
*/
public ?string $age_rating_guide = '';
public ?string $age_rating_guide;
/**
* @var string
*/
public string $cover_image = '';
public ?string $cover_image;
/**
* @var string|int
*/
public ?int $episode_count = 13;
public ?int $episode_count;
/**
* @var string|int
*/
public ?int $episode_length = 24;
public ?int $episode_length;
/**
* @var array
@ -65,12 +65,12 @@ class Anime extends AbstractType {
/**
* @var string
*/
public string $show_type = '';
public ?string $show_type;
/**
* @var string
*/
public string $slug = '';
public ?string $slug;
/**
* @var AnimeAiringStatus
@ -85,12 +85,12 @@ class Anime extends AbstractType {
/**
* @var string
*/
public string $synopsis = '';
public ?string $synopsis;
/**
* @var string
*/
public string $title = '';
public ?string $title;
/**
* @var array
@ -100,10 +100,10 @@ class Anime extends AbstractType {
/**
* @var string
*/
public ?string $trailer_id = '';
public ?string $trailer_id;
/**
* @var string
*/
public string $url = '';
public ?string $url;
}

View File

@ -23,12 +23,12 @@ final class AnimeListItem extends AbstractType {
/**
* @var string
*/
public $id;
public ?string $id;
/**
* @var string
*/
public $mal_id;
public ?string $mal_id;
/**
* @var string
@ -38,7 +38,7 @@ final class AnimeListItem extends AbstractType {
/**
* @var array
*/
public $episodes = [
public array $episodes = [
'length' => 0,
'total' => 0,
'watched' => '',
@ -47,7 +47,7 @@ final class AnimeListItem extends AbstractType {
/**
* @var array
*/
public $airing = [
public array $airing = [
'status' => '',
'started' => '',
'ended' => '',
@ -56,32 +56,32 @@ final class AnimeListItem extends AbstractType {
/**
* @var Anime
*/
public $anime;
public ?Anime $anime;
/**
* @var string
*/
public $notes = '';
public ?string $notes;
/**
* @var bool
*/
public $private;
public bool $private = FALSE;
/**
* @var bool
*/
public $rewatching;
public bool $rewatching = FALSE;
/**
* @var int
*/
public $rewatched;
public int $rewatched = 0;
/**
* @var int
* @var string|int
*/
public $user_rating;
public $user_rating = '';
/**
* One of Aviat\AnimeClient\API\Enum\AnimeWatchingStatus

View File

@ -23,12 +23,12 @@ final class Character extends AbstractType {
/**
* @var array
*/
public $castings;
public array $castings = [];
/**
* @var string
*/
public $description;
public ?string $description;
/**
* @var string
@ -38,27 +38,27 @@ final class Character extends AbstractType {
/**
* @var array
*/
public $included;
public array $included = [];
/**
* @var Media
*/
public $media;
public ?Media $media;
/**
* @var string
*/
public $name;
public ?string $name;
/**
* @var array
*/
public $names;
public array $names = [];
/**
* @var array
*/
public $otherNames;
public array $otherNames = [];
public function setMedia ($media): void
{

View File

@ -20,10 +20,10 @@ final class Characters extends AbstractType {
/**
* @var array
*/
public $main;
public array $main = [];
/**
* @var array
*/
public $supporting;
public array $supporting = [];
}

View File

@ -25,17 +25,17 @@ class Config extends AbstractType {
/**
* @var Config\Anilist
*/
public $anilist;
public ?Config\Anilist $anilist;
/**
* @var Config\Cache
*/
public $cache;
public ?Config\Cache $cache;
/**
* @var Config\Database
*/
public $database;
public ?Config\Database $database;
// ------------------------------------------------------------------------
// Settings in config.toml
@ -44,7 +44,7 @@ class Config extends AbstractType {
/**
* @var string
*/
public $asset_path; // Path to public folder for urls
public ?string $asset_path; // Path to public folder for urls
/**
* @deprecated Use 'theme' instead
@ -63,14 +63,14 @@ class Config extends AbstractType {
*
* @var string
*/
public $default_anime_list_path;
public ?string $default_anime_list_path;
/**
* The list to redirect to from the root url
*
* @var 'anime' | 'manga'
*/
public $default_list;
public ?string $default_list;
/**
* Default Manga list status page, values are listed in
@ -78,44 +78,44 @@ class Config extends AbstractType {
*
* @var string
*/
public $default_manga_list_path;
public ?string $default_manga_list_path;
/**
* @var 'cover_view' | 'list_view'
*/
public $default_view_type;
public ?string $default_view_type;
/**
* @var string
*/
public $kitsu_username;
public ?string $kitsu_username;
/**
* @var bool
*/
public $secure_urls = TRUE;
public bool $secure_urls = TRUE;
/**
* @var bool
*/
public $show_anime_collection;
public bool $show_anime_collection = FALSE;
/**
* @var bool
*/
public $show_manga_collection = FALSE;
public bool $show_manga_collection = FALSE;
/**
* CSS theme: light, dark, or auto-switching
*
* @var 'auto' | 'light' | 'dark'
*/
public $theme;
public ?string $theme;
/**
* @var string
*/
public $whose_list;
public ?string $whose_list;
// ------------------------------------------------------------------------
// Application config
@ -124,12 +124,12 @@ class Config extends AbstractType {
/**
* @var array
*/
public $menus;
public array $menus;
/**
* @var array
*/
public $routes;
public array $routes;
// ------------------------------------------------------------------------
// Generated config values
@ -138,32 +138,32 @@ class Config extends AbstractType {
/**
* @var string
*/
public $asset_dir; // Path to public folder for local files
public ?string $asset_dir; // Path to public folder for local files
/**
* @var string
*/
public $base_config_dir;
public ?string $base_config_dir;
/**
* @var string
*/
public $config_dir;
public ?string $config_dir;
/**
* @var string
*/
public $data_cache_path;
public ?string $data_cache_path;
/**
* @var string
*/
public $img_cache_path;
public ?string $img_cache_path;
/**
* @var string
*/
public $view_path;
public ?string $view_path;
public function setAnilist ($data): void
{

View File

@ -28,17 +28,17 @@ class FormItem extends AbstractType {
/**
* @var string
*/
public $anilist_item_id;
public ?string $anilist_item_id;
/**
* @var string
*/
public $mal_id;
public ?string $mal_id;
/**
* @var FormItemData
*/
public $data;
public ?FormItemData $data;
public function setData($value): void
{

View File

@ -23,12 +23,12 @@ class FormItemData extends AbstractType {
/**
* @var string
*/
public $notes;
public ?string $notes;
/**
* @var bool
*/
public $private;
public bool $private = FALSE;
/**
* @var int
@ -46,14 +46,14 @@ class FormItemData extends AbstractType {
public $ratingTwenty;
/**
* @var int
* @var string|int
*/
public $reconsumeCount;
/**
* @var bool
*/
public $reconsuming;
public bool $reconsuming = FALSE;
/**
* @var string
@ -65,5 +65,5 @@ class FormItemData extends AbstractType {
*
* @var string
*/
public $updatedAt;
public ?string $updatedAt;
}

View File

@ -20,10 +20,10 @@ final class Media extends AbstractType {
/**
* @var array
*/
public $anime = [];
public array $anime = [];
/**
* @var array
*/
public $manga = [];
public array $manga = [];
}

View File

@ -28,17 +28,17 @@ final class Person extends AbstractType {
/**
* @var string
*/
public $name;
public ?string $name;
/**
* @var Characters
*/
public $characters;
public ?Characters $characters;
/**
* @var array
*/
public $staff;
public array $staff = [];
public function setCharacters($characters): void
{

View File

@ -23,45 +23,45 @@ final class User extends AbstractType {
/**
* @var string
*/
public $about;
public ?string $about;
/**
* @var string
*/
public $avatar;
public ?string $avatar;
/**
* @var array
*/
public $favorites;
public ?array $favorites;
/**
* @var string
*/
public $location;
public ?string $location;
/**
* @var string
*/
public $name;
public ?string $name;
/**
* @var string
*/
public $slug;
public ?string $slug;
/**
* @var array
*/
public $stats;
public ?array $stats;
/**
* @var array
*/
public $waifu;
public ?array $waifu;
/**
* @var string
*/
public $website;
public ?string $website;
}