Do you wish to register an account?
Browse Source

Move to PHP 8

pull/37/head
Timothy Warren 3 weeks ago
parent
commit
6b6c37f015
8 changed files with 37 additions and 25 deletions
  1. +2
    -2
      composer.json
  2. +17
    -8
      src/AnimeClient/API/Kitsu/schema.graphql
  3. +1
    -1
      src/AnimeClient/AnimeClient.php
  4. +9
    -5
      src/AnimeClient/Command/BaseCommand.php
  5. +1
    -1
      src/AnimeClient/Command/ClearThumbnails.php
  6. +2
    -6
      src/AnimeClient/Controller/Anime.php
  7. +1
    -1
      src/AnimeClient/Model/Settings.php
  8. +4
    -1
      src/AnimeClient/Types/Config/Anilist.php

+ 2
- 2
composer.json View File

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


+ 17
- 8
src/AnimeClient/API/Kitsu/schema.graphql View File

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


+ 1
- 1
src/AnimeClient/AnimeClient.php View File

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


+ 9
- 5
src/AnimeClient/Command/BaseCommand.php View File

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


+ 1
- 1
src/AnimeClient/Command/ClearThumbnails.php View File

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


+ 2
- 6
src/AnimeClient/Controller/Anime.php View File

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


+ 1
- 1
src/AnimeClient/Model/Settings.php View File

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


+ 4
- 1
src/AnimeClient/Types/Config/Anilist.php View File

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


Loading…
Cancel
Save