diff --git a/.travis.yml b/.travis.yml
index 9b4749a9..b4fcd505 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,8 @@ install:
- composer install --ignore-platform-reqs
php:
+ - 8.0
+ - 8.1
- nightly
script:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21bb4913..b5e0a904 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+## Version 5.3
+* Updated to support PHP 8.1
+
## Version 5.2
* Updated PHP requirement to 8
diff --git a/app/templates/manga-cover.php b/app/templates/manga-cover.php
index feb646bc..fbb0f3a3 100644
--- a/app/templates/manga-cover.php
+++ b/app/templates/manga-cover.php
@@ -2,7 +2,6 @@
isAuthenticated()): ?>
- +1 Volume */ ?>
= $helper->picture("images/manga/{$item['manga']['id']}.webp") ?>
@@ -64,11 +63,6 @@
Chapters: = $item['chapters']['read'] ?> /
= $item['chapters']['total'] ?>
-
- */ ?>
-
- Volumes: = $item['volumes']['total'] ?>
-
\ No newline at end of file
diff --git a/app/views/manga/edit.php b/app/views/manga/edit.php
index 58eb076c..7180b471 100644
--- a/app/views/manga/edit.php
+++ b/app/views/manga/edit.php
@@ -46,13 +46,6 @@
value="= $item['chapters']['read'] ?>"/> / = $item['chapters']['total'] ?>
-
- |
-
- */ ?>
- - / = $item['volumes']['total'] ?>
- |
-
|
diff --git a/app/views/manga/list.php b/app/views/manga/list.php
index ffcb53f7..45b5b543 100644
--- a/app/views/manga/list.php
+++ b/app/views/manga/list.php
@@ -22,7 +22,6 @@
| Title |
Rating |
Completed Chapters |
- # of Volumes |
Attributes |
Type |
@@ -49,7 +48,6 @@
= $item['user_rating'] ?> / 10 |
= $item['chapters']['read'] ?> / = $item['chapters']['total'] ?> |
- = $item['volumes']['total'] ?> |
diff --git a/index.php b/index.php
index efb78c5a..e5b904c1 100644
--- a/index.php
+++ b/index.php
@@ -25,7 +25,7 @@ setlocale(LC_CTYPE, 'en_US');
// Load composer autoloader
require_once __DIR__ . '/vendor/autoload.php';
-Debugger::$strictMode = true;
+Debugger::$strictMode = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED; // all errors except deprecated notices
Debugger::$showBar = false;
Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/app/logs');
diff --git a/src/AnimeClient/API/APIRequestBuilder.php b/src/AnimeClient/API/APIRequestBuilder.php
index 00bcffa5..2e98620d 100644
--- a/src/AnimeClient/API/APIRequestBuilder.php
+++ b/src/AnimeClient/API/APIRequestBuilder.php
@@ -318,7 +318,7 @@ abstract class APIRequestBuilder {
* @param string $type
* @return void
*/
- private function resetState(?string $url, $type = 'GET'): void
+ private function resetState(?string $url, string $type = 'GET'): void
{
$requestUrl = $url ?: $this->baseUrl;
diff --git a/src/AnimeClient/API/CacheTrait.php b/src/AnimeClient/API/CacheTrait.php
index c8726a78..22ecc210 100644
--- a/src/AnimeClient/API/CacheTrait.php
+++ b/src/AnimeClient/API/CacheTrait.php
@@ -33,7 +33,7 @@ trait CacheTrait {
* Inject the cache object
*
* @param CacheInterface $cache
- * @return $this
+ * @return self
*/
public function setCache(CacheInterface $cache): self
{
diff --git a/src/AnimeClient/API/Kitsu/Auth.php b/src/AnimeClient/API/Kitsu/Auth.php
index 0d0b5c5e..045433d7 100644
--- a/src/AnimeClient/API/Kitsu/Auth.php
+++ b/src/AnimeClient/API/Kitsu/Auth.php
@@ -123,7 +123,7 @@ final class Auth {
/**
* Retrieve the authentication token from the session
*
- * @return string
+ * @return string|null
*/
public function getAuthToken(): ?string
{
diff --git a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php
index 16ed9a29..76dddc97 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php
@@ -90,7 +90,7 @@ final class AnimeTransformer extends AbstractTransformer {
// If this person object is so broken as to not have a proper image object,
// just skip it. No point in showing a role with nothing in it.
- if ($person === null || $person['id'] === null || $person['image'] === null || $person['image']['original'] === null)
+ if ($person === null || $person['id'] === null || $person['image'] === null)
{
continue;
}
@@ -104,7 +104,7 @@ final class AnimeTransformer extends AbstractTransformer {
'id' => $person['id'],
'name' => $name,
'image' => [
- 'original' => $person['image']['original']['url'],
+ 'original' => $person['image']['original']['url'] ?? '',
],
'slug' => $person['slug'],
];
diff --git a/src/AnimeClient/API/Kitsu/Transformer/CharacterTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/CharacterTransformer.php
index 87cb5f9f..6f80bfcb 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/CharacterTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/CharacterTransformer.php
@@ -105,7 +105,7 @@ final class CharacterTransformer extends AbstractTransformer {
];
// And now, reorganize voice actor relationships
- $rawVoices = array_filter($data, fn($item) => count((array)$item['voices']['nodes']) > 0);
+ $rawVoices = array_filter($data, fn($item) => (! empty($item['voices'])) && count((array)$item['voices']['nodes']) > 0);
if (empty($rawVoices))
{
diff --git a/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php
index 7c01a4d6..a15fc4e9 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php
@@ -21,7 +21,7 @@ use Aviat\AnimeClient\Types\MangaPage;
use Aviat\Ion\Transformer\AbstractTransformer;
/**
- * Transformer for anime description page
+ * Transformer for manga description page
*/
final class MangaTransformer extends AbstractTransformer {
@@ -87,6 +87,13 @@ final class MangaTransformer extends AbstractTransformer {
$role = $staffing['role'];
$name = $person['names']['localized'][$person['names']['canonical']];
+ // If this person object is so broken as to not have a proper image object,
+ // just skip it. No point in showing a role with nothing in it.
+ if ($person === null || $person['id'] === null || $person['image'] === null)
+ {
+ continue;
+ }
+
if ( ! array_key_exists($role, $staff))
{
$staff[$role] = [];
@@ -97,7 +104,7 @@ final class MangaTransformer extends AbstractTransformer {
'slug' => $person['slug'],
'name' => $name,
'image' => [
- 'original' => $person['image']['original']['url'],
+ 'original' => $person['image']['original']['url'] ?? '',
],
];
diff --git a/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php
index 16d235ab..71e387ea 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php
@@ -69,6 +69,11 @@ final class PersonTransformer extends AbstractTransformer {
foreach ($data['mediaStaff']['nodes'] as $staffing)
{
+ if (empty($staffing['media']))
+ {
+ continue;
+ }
+
$media = $staffing['media'];
$role = $staffing['role'];
$title = $media['titles']['canonical'];
@@ -79,7 +84,7 @@ final class PersonTransformer extends AbstractTransformer {
'title' => $title,
'titles' => array_merge([$title], Kitsu::getFilteredTitles($media['titles'])),
'image' => [
- 'original' => $media['posterImage']['views'][1]['url'],
+ 'original' => $media['posterImage']['views'][1]['url'] ?? '',
],
'slug' => $media['slug'],
];
@@ -120,7 +125,7 @@ final class PersonTransformer extends AbstractTransformer {
'id' => $character['id'],
'slug' => $character['slug'],
'image' => [
- 'original' => $character['image']['original']['url'],
+ 'original' => $character['image']['original']['url'] ?? '',
],
'canonicalName' => $character['names']['canonical'],
],
diff --git a/src/AnimeClient/API/ParallelAPIRequest.php b/src/AnimeClient/API/ParallelAPIRequest.php
index 64374cab..e397c2a7 100644
--- a/src/AnimeClient/API/ParallelAPIRequest.php
+++ b/src/AnimeClient/API/ParallelAPIRequest.php
@@ -39,10 +39,10 @@ final class ParallelAPIRequest {
* Add a request
*
* @param string|Request $request
- * @param string|number $key
+ * @param string|int|null $key
* @return self
*/
- public function addRequest($request, $key = NULL): self
+ public function addRequest(string|Request $request, string|int|null $key = NULL): self
{
if ($key !== NULL)
{
diff --git a/src/AnimeClient/AnimeClient.php b/src/AnimeClient/AnimeClient.php
index 43518e15..3a612abd 100644
--- a/src/AnimeClient/AnimeClient.php
+++ b/src/AnimeClient/AnimeClient.php
@@ -335,7 +335,7 @@ function createPlaceholderImage (string $path, ?int $width, ?int $height, $text
$fontSize = 10;
$fontWidth = imagefontwidth($fontSize);
$fontHeight = imagefontheight($fontSize);
- $length = \strlen($text);
+ $length = strlen($text);
$textWidth = $length * $fontWidth;
$fxPos = (int) ceil((imagesx($img) - $textWidth) / 2);
$fyPos = (int) ceil((imagesy($img) - $fontHeight) / 2);
|