chore: update php dependencies to latest

This commit is contained in:
Yassine Doghri 2021-08-11 15:47:23 +00:00
parent f15f26240c
commit 3ff1364906
33 changed files with 3428 additions and 9673 deletions

View File

@ -34,7 +34,7 @@ class Analytics extends AnalyticsBase
* *
* @param string|string[] $audioFilePath * @param string|string[] $audioFilePath
*/ */
public function getAudioFileUrl($audioFilePath): string public function getAudioFileUrl(string|array $audioFilePath): string
{ {
helper('media'); helper('media');

View File

@ -102,7 +102,7 @@ class Services extends BaseService
} }
/** /**
* @return mixed * @return mixed|$this
*/ */
public static function authorization( public static function authorization(
Model $groupModel = null, Model $groupModel = null,
@ -122,12 +122,14 @@ class Services extends BaseService
$permissionModel = new PermissionModel(); $permissionModel = new PermissionModel();
} }
/* @phpstan-ignore-next-line */
$instance = new FlatAuthorization($groupModel, $permissionModel); $instance = new FlatAuthorization($groupModel, $permissionModel);
if ($userModel === null) { if ($userModel === null) {
$userModel = new UserModel(); $userModel = new UserModel();
} }
/* @phpstan-ignore-next-line */
return $instance->setUserModel($userModel); return $instance->setUserModel($userModel);
} }

View File

@ -27,7 +27,7 @@ class ContributorController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }

View File

@ -21,7 +21,7 @@ class PageController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -22,7 +22,7 @@ class PersonController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -27,7 +27,7 @@ class PodcastController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -34,7 +34,7 @@ class PodcastImportController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -22,7 +22,7 @@ class PodcastPersonController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }

View File

@ -23,7 +23,7 @@ class PodcastPlatformController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -23,7 +23,7 @@ class UserController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -20,7 +20,7 @@ class PageController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }

View File

@ -30,7 +30,7 @@ class PodcastController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) === 0) { if ($params === []) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }

View File

@ -35,7 +35,7 @@ class Actor extends ActivityPubActor
throw new RuntimeException('Podcast id must be set before getting associated podcast.'); throw new RuntimeException('Podcast id must be set before getting associated podcast.');
} }
if ($this->podcast === null) { if (! $this->podcast instanceof Podcast) {
$this->podcast = (new PodcastModel())->getPodcastByActorId($this->id); $this->podcast = (new PodcastModel())->getPodcastByActorId($this->id);
} }

View File

@ -59,7 +59,7 @@ class Credit extends Entity
throw new RuntimeException('Credit must have person_id before getting person.'); throw new RuntimeException('Credit must have person_id before getting person.');
} }
if ($this->person === null) { if (! $this->person instanceof Person) {
$this->person = (new PersonModel())->getPersonById($this->person_id); $this->person = (new PersonModel())->getPersonById($this->person_id);
} }
@ -72,7 +72,7 @@ class Credit extends Entity
throw new RuntimeException('Credit must have podcast_id before getting podcast.'); throw new RuntimeException('Credit must have podcast_id before getting podcast.');
} }
if ($this->podcast === null) { if (! $this->podcast instanceof Podcast) {
$this->podcast = (new PodcastModel())->getPodcastById($this->podcast_id); $this->podcast = (new PodcastModel())->getPodcastById($this->podcast_id);
} }
@ -85,7 +85,7 @@ class Credit extends Entity
throw new RuntimeException('Credit must have episode_id before getting episode.'); throw new RuntimeException('Credit must have episode_id before getting episode.');
} }
if ($this->episode === null) { if (! $this->episode instanceof Episode) {
$this->episode = (new EpisodeModel())->getPublishedEpisodeById($this->podcast_id, $this->episode_id); $this->episode = (new EpisodeModel())->getPublishedEpisodeById($this->podcast_id, $this->episode_id);
} }

View File

@ -261,7 +261,7 @@ class Podcast extends Entity
throw new RuntimeException('Podcast must be created before getting category.'); throw new RuntimeException('Podcast must be created before getting category.');
} }
if ($this->category === null) { if (! $this->category instanceof Category) {
$this->category = (new CategoryModel())->getCategoryById($this->category_id); $this->category = (new CategoryModel())->getCategoryById($this->category_id);
} }

View File

@ -49,7 +49,7 @@ class Status extends ActivityPubStatus
throw new RuntimeException('Status must have an episode_id before getting episode.'); throw new RuntimeException('Status must have an episode_id before getting episode.');
} }
if ($this->episode === null) { if (! $this->episode instanceof Episode) {
$this->episode = (new EpisodeModel())->getEpisodeById($this->episode_id); $this->episode = (new EpisodeModel())->getEpisodeById($this->episode_id);
} }

View File

@ -50,7 +50,7 @@ class PermissionFilter implements FilterInterface
if ( if (
(str_starts_with($permission, 'podcast-') || (str_starts_with($permission, 'podcast-') ||
str_starts_with($permission, 'podcast_episodes-')) && str_starts_with($permission, 'podcast_episodes-')) &&
count($routerParams) > 0 $routerParams !== []
) { ) {
if ( if (
($groupId = (new PodcastModel())->getContributorGroupId( ($groupId = (new PodcastModel())->getContributorGroupId(

View File

@ -7,7 +7,6 @@ declare(strict_types=1);
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
use App\Entities\Location; use App\Entities\Location;
use App\Entities\Person; use App\Entities\Person;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
@ -111,9 +110,7 @@ if (! function_exists('button')) {
CODE_SAMPLE; CODE_SAMPLE;
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('icon_button')) { if (! function_exists('icon_button')) {
/** /**
* Icon Button component * Icon Button component
@ -147,9 +144,7 @@ if (! function_exists('icon_button')) {
return button(icon($icon), $uri, $options, $attributes); return button(icon($icon), $uri, $options, $attributes);
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('hint_tooltip')) { if (! function_exists('hint_tooltip')) {
/** /**
* Hint component * Hint component
@ -172,9 +167,7 @@ if (! function_exists('hint_tooltip')) {
return $tooltip . '">' . icon('question') . '</span>'; return $tooltip . '">' . icon('question') . '</span>';
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('data_table')) { if (! function_exists('data_table')) {
/** /**
* Data table component * Data table component
@ -230,9 +223,7 @@ if (! function_exists('data_table')) {
'</div>'; '</div>';
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('publication_pill')) { if (! function_exists('publication_pill')) {
/** /**
* Publication pill component * Publication pill component
@ -259,9 +250,7 @@ if (! function_exists('publication_pill')) {
'</span>'; '</span>';
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('publication_button')) { if (! function_exists('publication_button')) {
/** /**
* Publication button component * Publication button component
@ -304,9 +293,7 @@ if (! function_exists('publication_button')) {
]); ]);
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('episode_numbering')) { if (! function_exists('episode_numbering')) {
/** /**
* Returns relevant translated episode numbering. * Returns relevant translated episode numbering.
@ -358,7 +345,6 @@ if (! function_exists('episode_numbering')) {
'</span>'; '</span>';
} }
} }
if (! function_exists('location_link')) { if (! function_exists('location_link')) {
/** /**
* Returns link to display from location info * Returns link to display from location info
@ -382,9 +368,7 @@ if (! function_exists('location_link')) {
); );
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('person_list')) { if (! function_exists('person_list')) {
/** /**
* Returns list of persons images * Returns list of persons images
@ -437,11 +421,7 @@ if (! function_exists('person_list')) {
return $personList . '</div>'; return $personList . '</div>';
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('play_episode_button')) { if (! function_exists('play_episode_button')) {
/** /**
* Returns play episode button * Returns play episode button
@ -460,23 +440,20 @@ if (! function_exists('play_episode_button')) {
return <<<CODE_SAMPLE return <<<CODE_SAMPLE
<play-episode-button <play-episode-button
class="${class}" class="{$class}"
id="${episodeId}" id="{$episodeId}"
imageSrc=${episodeThumbnail} imageSrc={$episodeThumbnail}
title="${episodeTitle}" title="{$episodeTitle}"
podcast="${podcastTitle}" podcast="{$podcastTitle}"
src="${source}" src="{$source}"
mediaType="${mediaType}" mediaType="{$mediaType}"
playLabel="${playLabel}" playLabel="{$playLabel}"
playingLabel="${playingLabel}" playingLabel="{$playingLabel}"
></play-episode-button> ></play-episode-button>
CODE_SAMPLE; CODE_SAMPLE;
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('audio_player')) { if (! function_exists('audio_player')) {
/** /**
* Returns audio player * Returns audio player
@ -490,13 +467,13 @@ if (! function_exists('audio_player')) {
<vm-player <vm-player
id="castopod-vm-player" id="castopod-vm-player"
theme="light" theme="light"
language="${language}" language="{$language}"
icons="castopod-icons" icons="castopod-icons"
class="${class}" class="{$class}"
style="--vm-player-box-shadow:0; --vm-player-theme: #009486; --vm-control-spacing: 4px;" style="--vm-player-box-shadow:0; --vm-player-theme: #009486; --vm-control-spacing: 4px;"
> >
<vm-audio preload="none"> <vm-audio preload="none">
<source src="${source}" type="${mediaType}" /> <source src="{$source}" type="{$mediaType}" />
</vm-audio> </vm-audio>
<vm-ui> <vm-ui>
<vm-icon-library name="castopod-icons"></vm-icon-library> <vm-icon-library name="castopod-icons"></vm-icon-library>
@ -514,9 +491,7 @@ if (! function_exists('audio_player')) {
CODE_SAMPLE; CODE_SAMPLE;
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('relative_time')) { if (! function_exists('relative_time')) {
function relative_time(Time $time, string $class = ''): string function relative_time(Time $time, string $class = ''): string
{ {
@ -524,18 +499,16 @@ if (! function_exists('relative_time')) {
$datetime = $time->toDateTimeString(); $datetime = $time->toDateTimeString();
return <<<CODE_SAMPLE return <<<CODE_SAMPLE
<time-ago class="${class}" datetime="${datetime}"> <time-ago class="{$class}" datetime="{$datetime}">
<time <time
itemprop="published" itemprop="published"
datetime="${datetime}" datetime="{$datetime}"
title="${time}">${translatedDate}</time> title="{$time}">{$translatedDate}</time>
</time-ago> </time-ago>
CODE_SAMPLE; CODE_SAMPLE;
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
if (! function_exists('xml_editor')) { if (! function_exists('xml_editor')) {
/** /**
* XML Editor field * XML Editor field
@ -554,9 +527,8 @@ if (! function_exists('xml_editor')) {
$textarea = form_textarea($data, $value, $extra); $textarea = form_textarea($data, $value, $extra);
return <<<CODE_SAMPLE return <<<CODE_SAMPLE
<xml-editor>${textarea}</time-ago> <xml-editor>{$textarea}</time-ago>
CODE_SAMPLE; CODE_SAMPLE;
} }
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

@ -17,10 +17,8 @@ use Config\Services;
if (! function_exists('save_media')) { if (! function_exists('save_media')) {
/** /**
* Saves a file to the corresponding podcast folder in `public/media` * Saves a file to the corresponding podcast folder in `public/media`
*
* @param File|UploadedFile $file
*/ */
function save_media(File $file, string $folder = '', string $filename = ''): string function save_media(File|UploadedFile $file, string $folder = '', string $filename = ''): string
{ {
if (($extension = $file->getExtension()) !== '') { if (($extension = $file->getExtension()) !== '') {
$filename = $filename . '.' . $extension; $filename = $filename . '.' . $extension;

View File

@ -182,10 +182,12 @@ if (! function_exists('get_rss_feed')) {
$channel->addChild('type', $podcast->type, $itunesNamespace); $channel->addChild('type', $podcast->type, $itunesNamespace);
$podcast->copyright && $podcast->copyright &&
$channel->addChild('copyright', $podcast->copyright); $channel->addChild('copyright', $podcast->copyright);
$podcast->is_blocked && if ($podcast->is_blocked) {
$channel->addChild('block', 'Yes', $itunesNamespace); $channel->addChild('block', 'Yes', $itunesNamespace);
$podcast->is_completed && }
if ($podcast->is_completed) {
$channel->addChild('complete', 'Yes', $itunesNamespace); $channel->addChild('complete', 'Yes', $itunesNamespace);
}
$image = $channel->addChild('image'); $image = $channel->addChild('image');
$image->addChild('url', $podcast->image->feed_url); $image->addChild('url', $podcast->image->feed_url);
@ -306,8 +308,9 @@ if (! function_exists('get_rss_feed')) {
} }
} }
$episode->is_blocked && if ($episode->is_blocked) {
$item->addChild('block', 'Yes', $itunesNamespace); $item->addChild('block', 'Yes', $itunesNamespace);
}
if ($episode->custom_rss !== null) { if ($episode->custom_rss !== null) {
array_to_rss([ array_to_rss([

View File

@ -319,121 +319,113 @@ if (! function_exists('linkify')) {
// Extract text links for each protocol // Extract text links for each protocol
foreach ($protocols as $protocol) { foreach ($protocols as $protocol) {
/** @phpstan-ignore-next-line */ $text = match ($protocol) {
switch ($protocol) { 'http', 'https' => preg_replace_callback(
case 'http': '~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
case 'https': function (array $match) use ($protocol, &$links) {
$text = preg_replace_callback( if ($match[1]) {
'~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', $protocol = $match[1];
function (array $match) use ($protocol, &$links) { }
if ($match[1]) { $link = $match[2] ?: $match[3];
$protocol = $match[1];
}
$link = $match[2] ?: $match[3];
helper('text'); helper('text');
$link = preg_replace('~^www\.(.+\.)~i', '$1', $link); $link = preg_replace('~^www\.(.+\.)~i', '$1', $link);
return '<' . return '<' .
array_push( array_push(
$links, $links,
anchor( anchor(
"{$protocol}://{$link}", "{$protocol}://{$link}",
ellipsize(rtrim($link, '/'), 30), ellipsize(rtrim($link, '/'), 30),
[ [
'target' => '_blank',
'rel' => 'noopener noreferrer',
],
),
) .
'>';
},
$text,
),
'handle' => preg_replace_callback(
'~(?<!\w)@(?<username>\w++)(?:@(?<domain>(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]))?~',
function ($match) use (&$links) {
// check if host is set and look for actor in database
if (isset($match['host'])) {
if (
$actor = model(
'ActorModel',
)->getActorByUsername($match['username'], $match['domain'])
) {
// TODO: check that host is local to remove target blank?
return '<' .
array_push(
$links,
anchor($actor->uri, $match[0], [
'target' => '_blank', 'target' => '_blank',
'rel' => 'noopener noreferrer', 'rel' => 'noopener noreferrer',
], ]),
), ) .
) . '>';
'>'; }
},
$text,
);
break;
case 'handle':
$text = preg_replace_callback(
'~(?<!\w)@(?<username>\w++)(?:@(?<domain>(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]))?~',
function ($match) use (&$links) {
// check if host is set and look for actor in database
if (isset($match['host'])) {
if (
$actor = model(
'ActorModel',
)->getActorByUsername($match['username'], $match['domain'])
) {
// TODO: check that host is local to remove target blank?
return '<' .
array_push(
$links,
anchor($actor->uri, $match[0], [
'target' => '_blank',
'rel' => 'noopener noreferrer',
]),
) .
'>';
}
try {
$actor = get_or_create_actor($match['username'], $match['domain']);
return '<' .
array_push(
$links,
anchor($actor->uri, $match[0], [
'target' => '_blank',
'rel' => 'noopener noreferrer',
]),
) .
'>';
} catch (\CodeIgniter\HTTP\Exceptions\HTTPException) {
// Couldn't retrieve actor, do not wrap the text in link
return '<' .
array_push($links, $match[0]) .
'>';
}
} else {
if (
$actor = model('ActorModel')
->getActorByUsername($match['username'])
) {
return '<' .
array_push($links, anchor($actor->uri, $match[0])) .
'>';
}
try {
$actor = get_or_create_actor($match['username'], $match['domain']);
return '<' .
array_push(
$links,
anchor($actor->uri, $match[0], [
'target' => '_blank',
'rel' => 'noopener noreferrer',
]),
) .
'>';
} catch (HTTPException) {
// Couldn't retrieve actor, do not wrap the text in link
return '<' . return '<' .
array_push($links, $match[0]) . array_push($links, $match[0]) .
'>'; '>';
} }
}, } else {
$text, if (
); $actor = model('ActorModel')
break; ->getActorByUsername($match['username'])
default: ) {
$text = preg_replace_callback( return '<' .
'~' . array_push($links, anchor($actor->uri, $match[0])) .
preg_quote($protocol, '~') . '>';
'://([^\s<]+?)(?<![\.,:])~i', }
function (array $match) use ($protocol, &$links) {
return '<' . return '<' .
array_push( array_push($links, $match[0]) .
$links,
anchor(
"{$protocol}://{$match[1]}",
$match[1],
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
],
),
) .
'>'; '>';
}, }
$text, },
); $text,
break; ),
} default => preg_replace_callback(
'~' .
preg_quote($protocol, '~') .
'://([^\s<]+?)(?<![\.,:])~i',
function (array $match) use ($protocol, &$links) {
return '<' .
array_push(
$links,
anchor(
"{$protocol}://{$match[1]}",
$match[1],
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
],
),
) .
'>';
},
$text,
),
};
} }
// Insert all links // Insert all links

View File

@ -164,7 +164,7 @@ class StatusModel extends UuidModel
->get() ->get()
->getResultArray(); ->getResultArray();
return count($result) !== 0 return $result !== []
? (int) $result[0]['timestamp_diff'] ? (int) $result[0]['timestamp_diff']
: false; : false;
} }

View File

@ -18,7 +18,7 @@ class NoteObject extends ActivityPubNoteObject
/** /**
* @param Status $status * @param Status $status
*/ */
public function __construct($status) public function __construct(\ActivityPub\Entities\Status $status)
{ {
parent::__construct($status); parent::__construct($status);

View File

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace App\Libraries; namespace App\Libraries;
use DOMDocument;
use SimpleXMLElement; use SimpleXMLElement;
class SimpleRSSElement extends SimpleXMLElement class SimpleRSSElement extends SimpleXMLElement
@ -60,7 +61,7 @@ class SimpleRSSElement extends SimpleXMLElement
if ($node !== null) { if ($node !== null) {
$no = $node->ownerDocument; $no = $node->ownerDocument;
$value = $escape ? esc($value ?? '') : $value ?? ''; $value = $escape ? esc($value ?? '') : $value ?? '';
if ($no === null) { if (! $no instanceof DOMDocument) {
return $newChild; return $newChild;
} }
if (is_array($value)) { if (is_array($value)) {
@ -68,7 +69,6 @@ class SimpleRSSElement extends SimpleXMLElement
} }
/** @noRector RecastingRemovalRector */ /** @noRector RecastingRemovalRector */
$node->appendChild($no->createTextNode((string) $value)); $node->appendChild($no->createTextNode((string) $value));
return $newChild;
} }
} }

View File

@ -255,7 +255,7 @@ class PodcastModel extends Model
->getResultObject(); ->getResultObject();
} }
return count($userPodcast) > 0 return $userPodcast !== []
? (int) $userPodcast[0]->group_id ? (int) $userPodcast[0]->group_id
: false; : false;
} }

View File

@ -28,7 +28,7 @@
], ],
[ [
'header' => lang('Contributor.list.role'), 'header' => lang('Contributor.list.role'),
'cell' => function ($contributor) { 'cell' => function ($contributor): string {
return lang('Contributor.roles.' . $contributor->podcast_role); return lang('Contributor.roles.' . $contributor->podcast_role);
}, },
], ],

View File

@ -18,10 +18,12 @@
<?= $this->section('content') ?> <?= $this->section('content') ?>
<p class="mb-4 text-sm italic text-gray-700"><?= lang('Common.pageInfo', [ <p class="mb-4 text-sm italic text-gray-700">
'currentPage' => $pager->getDetails()['currentPage'], <?= lang('Common.pageInfo', [
'pageCount' => $pager->getDetails()['pageCount'], 'currentPage' => $pager->getDetails()['currentPage'],
]) ?></p> 'pageCount' => $pager->getDetails()['pageCount'],
]) ?>
</p>
<?= data_table( <?= data_table(
[ [
@ -59,7 +61,7 @@
], ],
[ [
'header' => lang('Episode.list.visibility'), 'header' => lang('Episode.list.visibility'),
'cell' => function ($episode) { 'cell' => function ($episode): string {
return publication_pill( return publication_pill(
$episode->published_at, $episode->published_at,
$episode->publication_status, $episode->publication_status,
@ -68,7 +70,7 @@
], ],
[ [
'header' => lang('Episode.list.comments'), 'header' => lang('Episode.list.comments'),
'cell' => function ($episode) { 'cell' => function ($episode): int {
return count($episode->comments); return count($episode->comments);
}, },
], ],
@ -123,4 +125,4 @@
<?= $pager->links() ?> <?= $pager->links() ?>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -1,7 +1,6 @@
<?php <?php
use CodeIgniter\CLI\CLI; use CodeIgniter\CLI\CLI;
// The main Exception // The main Exception
CLI::newLine(); CLI::newLine();
CLI::write('[' . $exception::class . ']', 'light_gray', 'red'); CLI::write('[' . $exception::class . ']', 'light_gray', 'red');
@ -16,7 +15,6 @@ CLI::write(
), ),
); );
CLI::newLine(); CLI::newLine();
// The backtrace // The backtrace
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) { if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$backtraces = $exception->getTrace(); $backtraces = $exception->getTrace();
@ -56,16 +54,12 @@ if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$args = implode( $args = implode(
', ', ', ',
array_map(function ($value) { array_map(function ($value) {
switch (true) { return match (true) {
case is_object($value): is_object($value) => 'Object(' . $value::class . ')',
return 'Object(' . $value::class . ')'; is_array($value) => $value !== [] ? '[...]' : '[]',
case is_array($value): is_null($value) => 'null',
return count($value) > 0 ? '[...]' : '[]'; default => var_export($value, true),
case is_null($value): };
return 'null'; // return the lowercased version
default:
return var_export($value, true);
}
}, array_values($error['args'] ?? [])), }, array_values($error['args'] ?? [])),
); );

View File

@ -91,7 +91,7 @@ $errorId = uniqid('error', true); ?>
<?php <?php
$params = null; $params = null;
// Reflection by name is not available for closure function // Reflection by name is not available for closure function
if (substr($row['function'], -1) !== '}') { if (!str_ends_with($row['function'], '}')) {
$mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']); $mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']);
$params = $mirror->getParameters(); $params = $mirror->getParameters();
} }

View File

@ -12,9 +12,9 @@
"geoip2/geoip2": "^v2.11.0", "geoip2/geoip2": "^v2.11.0",
"myth/auth": "dev-develop", "myth/auth": "dev-develop",
"codeigniter4/codeigniter4": "dev-develop", "codeigniter4/codeigniter4": "dev-develop",
"league/commonmark": "^1.6.2", "league/commonmark": "^1.6.6",
"vlucas/phpdotenv": "^v5.3.0", "vlucas/phpdotenv": "^v5.3.0",
"league/html-to-markdown": "^4.10.0", "league/html-to-markdown": "^5.0.0",
"opawg/user-agents-php": "^v1.0", "opawg/user-agents-php": "^v1.0",
"podlibre/ipcat": "^v1.0", "podlibre/ipcat": "^v1.0",
"podlibre/podcast-namespace": "^v1.0.6", "podlibre/podcast-namespace": "^v1.0.6",
@ -23,16 +23,16 @@
"essence/essence": "^3.5.4" "essence/essence": "^3.5.4"
}, },
"require-dev": { "require-dev": {
"mikey179/vfsstream": "^v1.6.8", "mikey179/vfsstream": "^1.6.9",
"phpunit/phpunit": "^9.5.4", "phpunit/phpunit": "^9.5.8",
"rector/rector": "^0.11.5", "rector/rector": "^0.11.46",
"captainhook/captainhook": "^5.10.0", "captainhook/captainhook": "^5.10.1",
"phpstan/phpstan": "^0.12.85", "phpstan/phpstan": "^0.12.94",
"phpstan/extension-installer": "^1.1.0", "phpstan/extension-installer": "^1.1.0",
"rector/rector-phpstan-rules": "^0.2.9", "symplify/phpstan-extensions": "^9.4.27",
"symplify/phpstan-extensions": "^v9.3.12", "symplify/easy-coding-standard": "^9.4.27",
"symplify/easy-coding-standard": "^v9.3.12", "symplify/coding-standard": "^9.4.27",
"symplify/coding-standard": "^v9.3.12" "rector/phpstan-rules": "^0.3.4"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

1571
composer.lock generated

File diff suppressed because it is too large Load Diff

11148
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@ parameters:
- '#Access to an undefined property CodeIgniter\\Database\\BaseBuilder::\$pager#' - '#Access to an undefined property CodeIgniter\\Database\\BaseBuilder::\$pager#'
- '#Function \"preg_.*\(\)\" cannot be used/left in the code#' - '#Function \"preg_.*\(\)\" cannot be used/left in the code#'
- '#Function "property_exists\(\)" cannot be used/left in the code#' - '#Function "property_exists\(\)" cannot be used/left in the code#'
- '#Instead of "instanceof/is_a\(\)" use ReflectionProvider service or "\(new ObjectType\(<desired_type\>\)\)\-\>isSuperTypeOf\(<element_type\>\)" for static reflection to work#'
- -
message: '#Function "function_exists\(\)" cannot be used/left in the code#' message: '#Function "function_exists\(\)" cannot be used/left in the code#'
paths: paths: