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 * Populate values for un-serializing data
* *
* @param $properties * @param $properties
* @return mixed * @return self
*/ */
public static function __set_state($properties): 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 * Type representing an anime watch list item
*/ */
final class AnimeListItem extends AbstractType { final class AnimeListItem extends AbstractType {
/**
* @var string
*/
public $id; public $id;
/**
* @var string
*/
public $mal_id; public $mal_id;
/**
* @var string
*/
public $anilist_item_id; public $anilist_item_id;
/**
* @var array
*/
public $episodes = [ public $episodes = [
'length' => 0, 'length' => 0,
'total' => 0, 'total' => 0,
'watched' => '', 'watched' => '',
]; ];
/**
* @var array
*/
public $airing = [ public $airing = [
'status' => '', 'status' => '',
'started' => '', 'started' => '',
'ended' => '', 'ended' => '',
]; ];
/**
* @var Anime
*/
public $anime; public $anime;
/**
* @var string
*/
public $notes = ''; public $notes = '';
/**
* @var bool
*/
public $private; public $private;
/**
* @var bool
*/
public $rewatching; public $rewatching;
/**
* @var number
*/
public $rewatched; public $rewatched;
/**
* @var number
*/
public $user_rating; public $user_rating;
/**
* One of Aviat\AnimeClient\API\Enum\AnimeWatchingStatus
*
* @var string
*/
public $watching_status; public $watching_status;
public function setAnime($anime): void public function setAnime($anime): void

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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