Annotate property types for Types classes

This commit is contained in:
Timothy Warren 2019-12-09 13:40:54 -05:00
parent efede08401
commit 75aa7e3aae
11 changed files with 305 additions and 1 deletions

View File

@ -25,7 +25,7 @@ abstract class AbstractType implements ArrayAccess, Countable {
* Populate values for un-serializing data
*
* @param $properties
* @return mixed
* @return self
*/
public static function __set_state($properties): self
{

View File

@ -20,25 +20,74 @@ namespace Aviat\AnimeClient\Types;
* Type representing an anime watch list item
*/
final class AnimeListItem extends AbstractType {
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $mal_id;
/**
* @var string
*/
public $anilist_item_id;
/**
* @var array
*/
public $episodes = [
'length' => 0,
'total' => 0,
'watched' => '',
];
/**
* @var array
*/
public $airing = [
'status' => '',
'started' => '',
'ended' => '',
];
/**
* @var Anime
*/
public $anime;
/**
* @var string
*/
public $notes = '';
/**
* @var bool
*/
public $private;
/**
* @var bool
*/
public $rewatching;
/**
* @var number
*/
public $rewatched;
/**
* @var number
*/
public $user_rating;
/**
* One of Aviat\AnimeClient\API\Enum\AnimeWatchingStatus
*
* @var string
*/
public $watching_status;
public function setAnime($anime): void

View File

@ -20,6 +20,13 @@ namespace Aviat\AnimeClient\Types;
* Type representing an Anime object for a detail page
*/
final class AnimePage extends Anime {
/**
* @var array
*/
public $characters;
/**
* @var array
*/
public $staff;
}

View File

@ -20,13 +20,44 @@ namespace Aviat\AnimeClient\Types;
* Type representing a character for display
*/
final class Character extends AbstractType {
/**
* @var array
*/
public $castings;
/**
* @var string
*/
public $description;
/**
* @var string
*/
public $id;
/**
* @var array
*/
public $included;
/**
* @var array
*/
public $media;
/**
* @var string
*/
public $name;
/**
* @var array
*/
public $names;
/**
* @var array
*/
public $otherNames;
public function setMedia ($media): void

View File

@ -20,9 +20,24 @@ namespace Aviat\AnimeClient\Types;
* Type representing an Anime object for display
*/
class FormItem extends AbstractType {
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $anilist_item_id;
/**
* @var string
*/
public $mal_id;
/**
* @var FormItemData
*/
public $data;
public function setData($value): void

View File

@ -20,13 +20,44 @@ namespace Aviat\AnimeClient\Types;
* Type representing a Media object for editing/syncing
*/
class FormItemData extends AbstractType {
/**
* @var string
*/
public $notes;
/**
* @var bool
*/
public $private;
/**
* @var int
*/
public $progress;
/**
* @var int
*/
public $rating;
/**
* @var int
*/
public $ratingTwenty;
/**
* @var int
*/
public $reconsumeCount;
/**
* @var bool
*/
public $reconsuming;
/**
* @var string
*/
public $status;
public $updatedAt;
}

View File

@ -20,21 +20,60 @@ namespace Aviat\AnimeClient\Types;
* Type representing an Anime object for display
*/
final class MangaListItem extends AbstractType {
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $mal_id;
/**
* @var array
*/
public $chapters = [
'read' => 0,
'total' => 0,
];
/**
* @var array
*/
public $volumes = [
'read' => '-',
'total' => 0,
];
/**
* @var object
*/
public $manga;
/**
* @var string
*/
public $reading_status;
/**
* @var string
*/
public $notes;
/**
* @var bool
*/
public $rereading;
/**
* @var int
*/
public $reread;
/**
* @var int
*/
public $user_rating;
}

View File

@ -20,12 +20,43 @@ namespace Aviat\AnimeClient\Types;
* Type representing the manga represented by the list item
*/
final class MangaListItemDetail extends AbstractType {
/**
* @var array
*/
public $genres;
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $image;
/**
* @var string
*/
public $slug;
/**
* @var string
*/
public $title;
/**
* @var array
*/
public $titles;
/**
* @var string
*/
public $type;
/**
* @var string
*/
public $url;
}

View File

@ -20,17 +20,68 @@ namespace Aviat\AnimeClient\Types;
* Type representing an Anime object for display
*/
final class MangaPage extends AbstractType {
/**
* @var array
*/
public $characters;
/**
* @var int
*/
public $chapter_count;
/**
* @var string
*/
public $cover_image;
/**
* @var array
*/
public $genres;
/**
* @var string
*/
public $id;
/**
* @var array
*/
public $included;
/**
* @var string
*/
public $manga_type;
/**
* @var array
*/
public $staff;
/**
* @var string
*/
public $synopsis;
/**
* @var string
*/
public $title;
/**
* @var array
*/
public $titles;
/**
* @var string
*/
public $url;
/**
* @var int
*/
public $volume_count;
}

View File

@ -20,9 +20,24 @@ namespace Aviat\AnimeClient\Types;
* Type representing a person for display
*/
final class Person extends AbstractType {
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $name;
/**
* @var object
*/
public $characters;
/**
* @var array
*/
public $staff;
public function setCharacters($characters): void

View File

@ -20,13 +20,48 @@ namespace Aviat\AnimeClient\Types;
* Type representing a Kitsu user for display
*/
final class User extends AbstractType {
/**
* @var string
*/
public $about;
/**
* @var string
*/
public $avatar;
/**
* @var array
*/
public $favorites;
/**
* @var string
*/
public $location;
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $slug;
/**
* @var array
*/
public $stats;
/**
* @var array
*/
public $waifu;
/**
* @var string
*/
public $website;
}