Move to PHP 8

This commit is contained in:
Timothy Warren 2021-02-03 09:46:36 -05:00
parent 461914a929
commit 6b6c37f015
8 changed files with 37 additions and 25 deletions

View File

@ -30,7 +30,7 @@
"config": { "config": {
"lock": false, "lock": false,
"platform": { "platform": {
"php": "7.4" "php": "8"
} }
}, },
"require": { "require": {
@ -53,7 +53,7 @@
"laminas/laminas-httphandlerrunner": "^1.1.0", "laminas/laminas-httphandlerrunner": "^1.1.0",
"maximebf/consolekit": "^1.0.3", "maximebf/consolekit": "^1.0.3",
"monolog/monolog": "^2.0.2", "monolog/monolog": "^2.0.2",
"php": "^7.4 || ~8.0.0", "php": "^8.0.0",
"psr/container": "^1.0.0", "psr/container": "^1.0.0",
"psr/http-message": "^1.0.1", "psr/http-message": "^1.0.1",
"psr/log": "^1.1.3", "psr/log": "^1.1.3",

View File

@ -152,8 +152,6 @@ interface Media {
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int last: Int
): MediaReactionConnection! ): MediaReactionConnection!
"The season this was released in"
season: ReleaseSeasonEnum
"Whether the media is Safe-for-Work" "Whether the media is Safe-for-Work"
sfw: Boolean! sfw: Boolean!
"The URL-friendly identifier of this media" "The URL-friendly identifier of this media"
@ -1256,8 +1254,6 @@ type Manga implements Media & WithTimestamps {
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int last: Int
): MediaReactionConnection! ): MediaReactionConnection!
"The season this was released in"
season: ReleaseSeasonEnum
"Whether the media is Safe-for-Work" "Whether the media is Safe-for-Work"
sfw: Boolean! sfw: Boolean!
"The URL-friendly identifier of this media" "The URL-friendly identifier of this media"
@ -1475,14 +1471,14 @@ type MediaEdge {
"The role a company played in the creation or localization of a media" "The role a company played in the creation or localization of a media"
type MediaProduction implements WithTimestamps { type MediaProduction implements WithTimestamps {
"The production company"
company: Producer!
createdAt: ISO8601DateTime! createdAt: ISO8601DateTime!
id: ID! id: ID!
"The media" "The media"
media: Media! media: Media!
"The producer"
person: Producer!
"The role this company played" "The role this company played"
role: String! role: MediaProductionRoleEnum!
updatedAt: ISO8601DateTime! updatedAt: ISO8601DateTime!
} }
@ -1997,6 +1993,8 @@ type Query {
findPersonById(id: ID!): Person findPersonById(id: ID!): Person
"Find a single Person by Slug" "Find a single Person by Slug"
findPersonBySlug(slug: String!): Person findPersonBySlug(slug: String!): Person
"Find a single Post by ID"
findPostById(id: ID!): Post
"Find a single User by ID" "Find a single User by ID"
findProfileById(id: ID!): Profile findProfileById(id: ID!): Profile
"Find a single User by Slug" "Find a single User by Slug"
@ -2112,7 +2110,7 @@ type Query {
last: Int, last: Int,
title: String! title: String!
): MangaConnection! ): MangaConnection!
"Search for any media (Anime, Manga) by title using Algolia. The most relevant results will be at the top." "Search for any media (Anime, Manga) by title using Algolia. If no media_type is supplied, it will search for both. The most relevant results will be at the top."
searchMediaByTitle( searchMediaByTitle(
"Returns the elements in the list that come after the specified cursor." "Returns the elements in the list that come after the specified cursor."
after: String, after: String,
@ -2122,6 +2120,8 @@ type Query {
first: Int, first: Int,
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int, last: Int,
"Dynamically choose a specific media_type. If left blank, it will return results for both."
mediaType: MediaTypeEnum,
title: String! title: String!
): MediaConnection! ): MediaConnection!
"Search for User by username using Algolia. The most relevant results will be at the top." "Search for User by username using Algolia. The most relevant results will be at the top."
@ -2217,6 +2217,8 @@ type QuoteLineEdge {
type Session { type Session {
"The account associated with this session" "The account associated with this session"
account: Account account: Account
"Single sign-on token for Nolt"
noltToken: String!
"The profile associated with this session" "The profile associated with this session"
profile: Profile profile: Profile
} }
@ -2539,6 +2541,13 @@ enum MappingItemEnum {
PRODUCER PRODUCER
} }
enum MediaProductionRoleEnum {
LICENSOR
PRODUCER
SERIALIZATION
STUDIO
}
"これはアニメやマンガです" "これはアニメやマンガです"
enum MediaTypeEnum { enum MediaTypeEnum {
ANIME ANIME

View File

@ -237,7 +237,7 @@ function getApiClient (): HttpClient
* @return Response * @return Response
* @throws Throwable * @throws Throwable
*/ */
function getResponse ($request): Response function getResponse (Request|string $request): Response
{ {
$client = getApiClient(); $client = getApiClient();

View File

@ -17,6 +17,10 @@
namespace Aviat\AnimeClient\Command; namespace Aviat\AnimeClient\Command;
use Monolog\Formatter\JsonFormatter; use Monolog\Formatter\JsonFormatter;
use function Aviat\Ion\_dir;
use const Aviat\AnimeClient\SRC_DIR;
use function Aviat\AnimeClient\loadConfig; use function Aviat\AnimeClient\loadConfig;
use function Aviat\AnimeClient\loadTomlFile; use function Aviat\AnimeClient\loadTomlFile;
@ -108,14 +112,14 @@ abstract class BaseCommand extends Command {
*/ */
public function setupContainer(): ContainerInterface public function setupContainer(): ContainerInterface
{ {
$APP_DIR = realpath(__DIR__ . '/../../../app'); $APP_DIR = _dir(dirname(SRC_DIR), 'app');
$APPCONF_DIR = realpath("{$APP_DIR}/appConf/"); $APPCONF_DIR = realpath(_dir($APP_DIR, 'appConf'));
$CONF_DIR = realpath("{$APP_DIR}/config/"); $CONF_DIR = realpath(_dir($APP_DIR, 'config'));
$baseConfig = require $APPCONF_DIR . '/base_config.php'; $baseConfig = require _dir($APPCONF_DIR, 'base_config.php');
$config = loadConfig($CONF_DIR); $config = loadConfig($CONF_DIR);
$overrideFile = $CONF_DIR . '/admin-override.toml'; $overrideFile = _dir($CONF_DIR, 'admin-override.toml');
$overrideConfig = file_exists($overrideFile) $overrideConfig = file_exists($overrideFile)
? loadTomlFile($overrideFile) ? loadTomlFile($overrideFile)
: []; : [];

View File

@ -29,7 +29,7 @@ class ClearThumbnails extends BaseCommand {
private function clearThumbs(): void private function clearThumbs(): void
{ {
$imgDir = realpath(__DIR__ . '/../../public/images'); $imgDir = dirname(__DIR__, 3) . '/public/images';
$paths = [ $paths = [
'anime/*.jpg', 'anime/*.jpg',

View File

@ -138,8 +138,6 @@ final class Anime extends BaseController {
/** /**
* Add an anime to the list * Add an anime to the list
* *
* @throws ContainerException
* @throws NotFoundException
* @throws Throwable * @throws Throwable
* @return void * @return void
*/ */
@ -215,8 +213,6 @@ final class Anime extends BaseController {
/** /**
* Update an anime item via a form submission * Update an anime item via a form submission
* *
* @throws ContainerException
* @throws NotFoundException
* @throws Throwable * @throws Throwable
* @return void * @return void
*/ */
@ -338,7 +334,7 @@ final class Anime extends BaseController {
'data' => $data, 'data' => $data,
]); ]);
} }
catch (TypeError $e) catch (TypeError)
{ {
$this->notFound( $this->notFound(
$this->config->get('whose_list') . $this->config->get('whose_list') .
@ -376,7 +372,7 @@ final class Anime extends BaseController {
'data' => $data, 'data' => $data,
]); ]);
} }
catch (TypeError $e) catch (TypeError)
{ {
$this->notFound( $this->notFound(
$this->config->get('whose_list') . $this->config->get('whose_list') .

View File

@ -206,7 +206,7 @@ final class Settings {
return FALSE; return FALSE;
} }
$savePath = realpath(_dir(__DIR__, '..', '..', '..', 'app', 'config')); $savePath = _dir(dirname(__DIR__, 3), 'app', 'config');
$saveFile = _dir($savePath, 'admin-override.toml'); $saveFile = _dir($savePath, 'admin-override.toml');
$saved = file_put_contents($saveFile, arrayToToml($settings)); $saved = file_put_contents($saveFile, arrayToToml($settings));

View File

@ -19,7 +19,10 @@ namespace Aviat\AnimeClient\Types\Config;
use Aviat\AnimeClient\Types\AbstractType; use Aviat\AnimeClient\Types\AbstractType;
class Anilist extends AbstractType { class Anilist extends AbstractType {
public bool $enabled = FALSE; /**
* @var bool|string
*/
public $enabled = FALSE;
public ?string $client_id; public ?string $client_id;