ci: fix lint and formatting issues

This commit is contained in:
Yassine Doghri 2023-02-22 16:29:45 +00:00
parent 34777598dd
commit 84a6447fd4
94 changed files with 987 additions and 1104 deletions

View File

@ -1 +1 @@
{"version":1,"defects":[],"times":{"Tests\\Database\\ExampleDatabaseTest::testModelFindAll":0.003,"Tests\\Database\\ExampleDatabaseTest::testSoftDeleteLeavesRow":0.004,"modules\\Api\\Rest\\V1\\PodcastTest::testList":0.033,"modules\\Api\\Rest\\V1\\PodcastTest::testView":0.004,"modules\\Api\\Rest\\V1\\PodcastTest::testViewNotFound":0.01,"modules\\Api\\Rest\\V1\\PodcastTest::testListEmpty":4.313,"Tests\\Session\\ExampleSessionTest::testSessionSimple":0,"HealthTest::testIsDefinedAppPath":0,"HealthTest::testBaseUrlHasBeenSet":0.005}} {"version":1,"defects":[],"times":{"Tests\\Database\\ExampleDatabaseTest::testModelFindAll":0.002,"Tests\\Database\\ExampleDatabaseTest::testSoftDeleteLeavesRow":0.002,"modules\\Api\\Rest\\V1\\PodcastTest::testList":0.008,"modules\\Api\\Rest\\V1\\PodcastTest::testView":0.003,"modules\\Api\\Rest\\V1\\PodcastTest::testViewNotFound":0.002,"modules\\Api\\Rest\\V1\\PodcastTest::testListEmpty":0.633,"Tests\\Session\\ExampleSessionTest::testSessionSimple":0,"HealthTest::testIsDefinedAppPath":0,"HealthTest::testBaseUrlHasBeenSet":0.001}}

View File

@ -49,8 +49,6 @@ class Database extends Config
/** /**
* This database connection is used when running PHPUnit database tests. * This database connection is used when running PHPUnit database tests.
* *
* @noRector StringClassNameToClassConstantRector
*
* @var array<string, mixed> * @var array<string, mixed>
*/ */
public array $tests = [ public array $tests = [
@ -84,7 +82,6 @@ class Database extends Config
// Ensure that we always set the database group to 'tests' if // Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that // we are currently running an automated test suite, so that
// we don't overwrite live data on accident. // we don't overwrite live data on accident.
/** @noRector RemoveAlwaysTrueIfConditionRector */
if (ENVIRONMENT === 'testing') { if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests'; $this->defaultGroup = 'tests';
} }

View File

@ -7,6 +7,7 @@ namespace Config;
use App\Entities\Actor; use App\Entities\Actor;
use App\Entities\Post; use App\Entities\Post;
use App\Models\EpisodeModel; use App\Models\EpisodeModel;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Events\Events; use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Exceptions\FrameworkException;
@ -47,7 +48,7 @@ Events::on('pre_system', static function () {
* If you delete, they will no longer be collected. * If you delete, they will no longer be collected.
*/ */
if (CI_DEBUG && ! is_cli()) { if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); Events::on('DBQuery', Database::class . '::collect');
Services::toolbar()->respond(); Services::toolbar()->respond();
} }
}); });

View File

@ -21,8 +21,6 @@ class Pager extends BaseConfig
* and the desired group as $pagerGroup; * and the desired group as $pagerGroup;
* *
* @var array<string, string> * @var array<string, string>
*
* @noRector Rector\Php55\Rector\String_\StringClassNameToClassConstantRector
*/ */
public $templates = [ public $templates = [
'default_full' => 'App\Views\pager\default_full', 'default_full' => 'App\Views\pager\default_full',

View File

@ -27,8 +27,6 @@ class Services extends BaseService
/** /**
* The Router class uses a RouteCollection's array of routes, and determines the correct Controller and Method to * The Router class uses a RouteCollection's array of routes, and determines the correct Controller and Method to
* execute. * execute.
*
* @noRector PHPStan\Reflection\MissingMethodFromReflectionException
*/ */
public static function router( public static function router(
?RouteCollectionInterface $routes = null, ?RouteCollectionInterface $routes = null,
@ -48,8 +46,6 @@ class Services extends BaseService
/** /**
* The Negotiate class provides the content negotiation features for working the request to determine correct * The Negotiate class provides the content negotiation features for working the request to determine correct
* language, encoding, charset, and more. * language, encoding, charset, and more.
*
* @noRector PHPStan\Reflection\MissingMethodFromReflectionException
*/ */
public static function negotiator(?RequestInterface $request = null, bool $getShared = true): Negotiate public static function negotiator(?RequestInterface $request = null, bool $getShared = true): Negotiate
{ {

View File

@ -15,9 +15,6 @@ use CodeIgniter\HTTP\Response;
class ColorsController extends Controller class ColorsController extends Controller
{ {
/**
* @noRector ReturnTypeDeclarationRector
*/
public function index(): Response public function index(): Response
{ {
$cacheName = 'colors.css'; $cacheName = 'colors.css';

View File

@ -120,9 +120,6 @@ class EpisodeCommentController extends BaseController
return $cachedView; return $cachedView;
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function commentObject(): Response public function commentObject(): Response
{ {
$commentObject = new CommentObject($this->comment); $commentObject = new CommentObject($this->comment);
@ -132,9 +129,6 @@ class EpisodeCommentController extends BaseController
->setBody($commentObject->toJSON()); ->setBody($commentObject->toJSON());
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function replies(): Response public function replies(): Response
{ {
/** /**

View File

@ -274,9 +274,6 @@ class EpisodeController extends BaseController
return $this->response->setXML($oembed); return $this->response->setXML($oembed);
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function episodeObject(): Response public function episodeObject(): Response
{ {
$podcastObject = new PodcastEpisode($this->episode); $podcastObject = new PodcastEpisode($this->episode);
@ -286,9 +283,6 @@ class EpisodeController extends BaseController
->setBody($podcastObject->toJSON()); ->setBody($podcastObject->toJSON());
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function comments(): Response public function comments(): Response
{ {
/** /**

View File

@ -47,9 +47,6 @@ class PodcastController extends BaseController
return $this->{$method}(...$params); return $this->{$method}(...$params);
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function podcastActor(): Response public function podcastActor(): Response
{ {
$podcastActor = new PodcastActor($this->podcast); $podcastActor = new PodcastActor($this->podcast);
@ -285,9 +282,6 @@ class PodcastController extends BaseController
return $cachedView; return $cachedView;
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function episodeCollection(): Response public function episodeCollection(): Response
{ {
if ($this->podcast->type === 'serial') { if ($this->podcast->type === 'serial') {

View File

@ -45,7 +45,7 @@ class PostController extends FediversePostController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if ( if (
($podcast = (new PodcastModel())->getPodcastByHandle($params[0],)) === null ($podcast = (new PodcastModel())->getPodcastByHandle($params[0])) === null
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }

View File

@ -36,9 +36,6 @@ class Category extends Entity
'google_category' => 'string', 'google_category' => 'string',
]; ];
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getParent(): ?self public function getParent(): ?self
{ {
if ($this->parent_id === null) { if ($this->parent_id === null) {

View File

@ -92,9 +92,6 @@ class Credit extends Entity
return $this->episode; return $this->episode;
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getGroupLabel(): string public function getGroupLabel(): string
{ {
if ($this->person_group === null) { if ($this->person_group === null) {
@ -104,9 +101,6 @@ class Credit extends Entity
return lang("PersonsTaxonomy.persons.{$this->person_group}.label"); return lang("PersonsTaxonomy.persons.{$this->person_group}.label");
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getRoleLabel(): string public function getRoleLabel(): string
{ {
if ($this->person_group === '') { if ($this->person_group === '') {

View File

@ -450,7 +450,7 @@ class Episode extends Entity
public function getEmbedUrl(string $theme = null): string public function getEmbedUrl(string $theme = null): string
{ {
return $theme return $theme
? url_to('embed-theme', esc($this->getPodcast()->handle), esc($this->attributes['slug']), $theme,) ? url_to('embed-theme', esc($this->getPodcast()->handle), esc($this->attributes['slug']), $theme)
: url_to('embed', esc($this->getPodcast()->handle), esc($this->attributes['slug'])); : url_to('embed', esc($this->getPodcast()->handle), esc($this->attributes['slug']));
} }

View File

@ -87,8 +87,6 @@ class EpisodeComment extends UuidEntity
/** /**
* Returns the comment's actor * Returns the comment's actor
*
* @noRector ReturnTypeDeclarationRector
*/ */
public function getActor(): ?Actor public function getActor(): ?Actor
{ {
@ -125,9 +123,6 @@ class EpisodeComment extends UuidEntity
return $this->getReplies() !== []; return $this->getReplies() !== [];
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getReplyToComment(): ?self public function getReplyToComment(): ?self
{ {
if ($this->in_reply_to_id === null) { if ($this->in_reply_to_id === null) {

View File

@ -215,9 +215,6 @@ class Podcast extends Entity
return '@' . $this->handle; return '@' . $this->handle;
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getActor(): ?Actor public function getActor(): ?Actor
{ {
if ($this->actor_id === 0) { if ($this->actor_id === 0) {

View File

@ -61,7 +61,7 @@ if (! function_exists('parse_form_attributes')) {
} }
} }
if (! empty($attributes)) { if ($attributes !== []) {
$default = array_merge($default, $attributes); $default = array_merge($default, $attributes);
} }
} }

View File

@ -239,7 +239,6 @@ if (! function_exists('generate_random_salt')) {
if (! function_exists('file_upload_max_size')) { if (! function_exists('file_upload_max_size')) {
/** /**
* Returns a file size limit in bytes based on the PHP upload_max_filesize and post_max_size Adapted from: * Returns a file size limit in bytes based on the PHP upload_max_filesize and post_max_size Adapted from:
* https://stackoverflow.com/a/25370978 * https://stackoverflow.com/a/25370978

View File

@ -125,7 +125,7 @@ if (! function_exists('get_rss_feed')) {
$castopodSocialElement->addAttribute('accountUrl', $podcast->link); $castopodSocialElement->addAttribute('accountUrl', $podcast->link);
foreach ($podcast->social_platforms as $socialPlatform) { foreach ($podcast->social_platforms as $socialPlatform) {
$socialElement = $channel->addChild('social', null, $podcastNamespace,); $socialElement = $channel->addChild('social', null, $podcastNamespace);
$socialElement->addAttribute('priority', '2'); $socialElement->addAttribute('priority', '2');
$socialElement->addAttribute('platform', $socialPlatform->slug); $socialElement->addAttribute('platform', $socialPlatform->slug);
@ -202,7 +202,7 @@ if (! function_exists('get_rss_feed')) {
foreach ($podcast->persons as $person) { foreach ($podcast->persons as $person) {
foreach ($person->roles as $role) { foreach ($person->roles as $role) {
$personElement = $channel->addChild('person', $person->full_name, $podcastNamespace,); $personElement = $channel->addChild('person', $person->full_name, $podcastNamespace);
$personElement->addAttribute('img', $person->avatar->medium_url); $personElement->addAttribute('img', $person->avatar->medium_url);
@ -294,7 +294,7 @@ if (! function_exists('get_rss_feed')) {
$item->addChild('guid', $episode->guid); $item->addChild('guid', $episode->guid);
$item->addChild('pubDate', $episode->published_at->format(DATE_RFC1123)); $item->addChild('pubDate', $episode->published_at->format(DATE_RFC1123));
if ($episode->location !== null) { if ($episode->location !== null) {
$locationElement = $item->addChild('location', $episode->location->name, $podcastNamespace,); $locationElement = $item->addChild('location', $episode->location->name, $podcastNamespace);
if ($episode->location->geo !== null) { if ($episode->location->geo !== null) {
$locationElement->addAttribute('geo', $episode->location->geo); $locationElement->addAttribute('geo', $episode->location->geo);
} }
@ -376,11 +376,11 @@ if (! function_exists('get_rss_feed')) {
foreach ($episode->persons as $person) { foreach ($episode->persons as $person) {
foreach ($person->roles as $role) { foreach ($person->roles as $role) {
$personElement = $item->addChild('person', esc($person->full_name), $podcastNamespace,); $personElement = $item->addChild('person', esc($person->full_name), $podcastNamespace);
$personElement->addAttribute( $personElement->addAttribute(
'role', 'role',
esc(lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en'),), esc(lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en')),
); );
$personElement->addAttribute( $personElement->addAttribute(

View File

@ -30,7 +30,6 @@ class Router extends CodeIgniterRouter
*/ */
protected function checkRoutes(string $uri): bool protected function checkRoutes(string $uri): bool
{ {
/** @noRector RemoveExtraParametersRector */
$routes = $this->collection->getRoutes($this->collection->getHTTPVerb()); $routes = $this->collection->getRoutes($this->collection->getHTTPVerb());
// Don't waste any time // Don't waste any time

View File

@ -86,7 +86,6 @@ class TranscriptParser
} }
break; break;
} }
} }

View File

@ -70,7 +70,6 @@ class Vite
if (array_key_exists('imports', $manifestElement)) { if (array_key_exists('imports', $manifestElement)) {
foreach ($manifestElement['imports'] as $importPath) { foreach ($manifestElement['imports'] as $importPath) {
if (array_key_exists($importPath, $this->manifestData)) { if (array_key_exists($importPath, $this->manifestData)) {
// import css dependencies if any // import css dependencies if any
if (array_key_exists('css', $this->manifestData[$importPath])) { if (array_key_exists('css', $this->manifestData[$importPath])) {
foreach ($this->manifestData[$importPath]['css'] as $cssFile) { foreach ($this->manifestData[$importPath]['css'] as $cssFile) {

View File

@ -53,9 +53,6 @@ class ClipModel extends Model
'job_ended_at', 'job_ended_at',
]; ];
/**
* @noRector
*/
protected $returnType = BaseClip::class; protected $returnType = BaseClip::class;
/** /**

View File

@ -195,8 +195,6 @@ class EpisodeCommentModel extends UuidModel
* Retrieves all published posts for a given episode ordered by publication date * Retrieves all published posts for a given episode ordered by publication date
* *
* @return EpisodeComment[] * @return EpisodeComment[]
*
* @noRector ReturnTypeDeclarationRector
*/ */
public function getEpisodeComments(int $episodeId): array public function getEpisodeComments(int $episodeId): array
{ {

View File

@ -28,9 +28,6 @@ class MediaModel extends Model
*/ */
protected $table = 'media'; protected $table = 'media';
/**
* @noRector
*/
protected $returnType = Document::class; protected $returnType = Document::class;
/** /**
@ -135,8 +132,6 @@ class MediaModel extends Model
/** /**
* @param Document|Audio|Video|Image|Transcript|Chapters $media * @param Document|Audio|Video|Image|Transcript|Chapters $media
*
* @noRector ReturnTypeDeclarationRector
*/ */
public function saveMedia(object $media): int | false public function saveMedia(object $media): int | false
{ {
@ -150,8 +145,6 @@ class MediaModel extends Model
/** /**
* @param Document|Audio|Video|Image|Transcript|Chapters $media * @param Document|Audio|Video|Image|Transcript|Chapters $media
*
* @noRector ReturnTypeDeclarationRector
*/ */
public function updateMedia(object $media): bool public function updateMedia(object $media): bool
{ {

View File

@ -34,9 +34,7 @@ $pager->setSurroundCount(2);
<?= $link['title'] ?> <?= $link['title'] ?>
</span> </span>
<?php else: ?> <?php else: ?>
<a href="<?= $link[ <a href="<?= $link['uri'] ?>" class="block px-4 py-2 rounded-full text-skin-muted hover:bg-highlight">
'uri'
] ?>" class="block px-4 py-2 rounded-full text-skin-muted hover:bg-highlight">
<?= $link['title'] ?> <?= $link['title'] ?>
</a> </a>
<?php endif; ?> <?php endif; ?>

View File

@ -89,7 +89,7 @@ class PodcastPlatformController extends BaseController
array_key_exists('visible', $podcastPlatform) && array_key_exists('visible', $podcastPlatform) &&
$podcastPlatform['visible'] === 'yes', $podcastPlatform['visible'] === 'yes',
'is_on_embed' => 'is_on_embed' =>
array_key_exists('on_embed', $podcastPlatform,) && $podcastPlatform['on_embed'] === 'yes', array_key_exists('on_embed', $podcastPlatform) && $podcastPlatform['on_embed'] === 'yes',
]; ];
} }

View File

@ -47,7 +47,6 @@ class SchedulerController extends Controller
// Loop through clips to generate them // Loop through clips to generate them
foreach ($scheduledClips as $scheduledClip) { foreach ($scheduledClips as $scheduledClip) {
try { try {
// set clip to pending // set clip to pending
(new ClipModel()) (new ClipModel())
->update($scheduledClip->id, [ ->update($scheduledClip->id, [

View File

@ -117,7 +117,7 @@ class SoundbiteController extends BaseController
$newSoundbite = new Soundbite([ $newSoundbite = new Soundbite([
'title' => $this->request->getPost('title'), 'title' => $this->request->getPost('title'),
'start_time' => (float) $this->request->getPost('start_time'), 'start_time' => (float) $this->request->getPost('start_time'),
'duration' => (float) $this->request->getPost('duration',), 'duration' => (float) $this->request->getPost('duration'),
'type' => 'audio', 'type' => 'audio',
'status' => '', 'status' => '',
'podcast_id' => $this->podcast->id, 'podcast_id' => $this->podcast->id,

View File

@ -165,7 +165,7 @@ class VideoClipsController extends BaseController
$videoClip = new VideoClip([ $videoClip = new VideoClip([
'title' => $this->request->getPost('title'), 'title' => $this->request->getPost('title'),
'start_time' => (float) $this->request->getPost('start_time'), 'start_time' => (float) $this->request->getPost('start_time'),
'duration' => (float) $this->request->getPost('duration',), 'duration' => (float) $this->request->getPost('duration'),
'theme' => $theme, 'theme' => $theme,
'format' => $this->request->getPost('format'), 'format' => $this->request->getPost('format'),
'type' => 'video', 'type' => 'video',

View File

@ -57,8 +57,8 @@ $routes->group('', [
/** /**
* @deprecated Route for podcast audio file analytics (/audio/pack(podcast_id,episode_id,bytes_threshold,filesize,duration,date)/podcast_folder/filename.mp3) * @deprecated Route for podcast audio file analytics (/audio/pack(podcast_id,episode_id,bytes_threshold,filesize,duration,date)/podcast_folder/filename.mp3)
*/ */
$routes->head('audio/(:base64)/(:any)', 'EpisodeAnalyticsController::hit/$1/$2',); $routes->head('audio/(:base64)/(:any)', 'EpisodeAnalyticsController::hit/$1/$2');
$routes->get('audio/(:base64)/(:any)', 'EpisodeAnalyticsController::hit/$1/$2',); $routes->get('audio/(:base64)/(:any)', 'EpisodeAnalyticsController::hit/$1/$2');
}); });
// Show the Unknown UserAgents // Show the Unknown UserAgents

View File

@ -39,9 +39,6 @@ class AnalyticsPodcastsByCountry extends Entity
'hits' => 'integer', 'hits' => 'integer',
]; ];
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getLabels(): string public function getLabels(): string
{ {
return lang('Countries.' . $this->attributes['labels']); return lang('Countries.' . $this->attributes['labels']);

View File

@ -44,9 +44,6 @@ class AnalyticsPodcastsByRegion extends Entity
'hits' => 'integer', 'hits' => 'integer',
]; ];
/**
* @noRector ReturnTypeDeclarationRector
*/
public function getCountryCode(): string public function getCountryCode(): string
{ {
return lang('Countries.' . $this->attributes['country_code']); return lang('Countries.' . $this->attributes['country_code']);

View File

@ -15,9 +15,6 @@ use CodeIgniter\HTTP\Response;
class ActivityPubController extends Controller class ActivityPubController extends Controller
{ {
/**
* @noRector ReturnTypeDeclarationRector
*/
public function preflight(): Response public function preflight(): Response
{ {
return $this->response->setHeader('Access-Control-Allow-Origin', '*') // for allowing any domain, insecure return $this->response->setHeader('Access-Control-Allow-Origin', '*') // for allowing any domain, insecure

View File

@ -56,9 +56,6 @@ class ActorController extends Controller
return $this->{$method}(...$params); return $this->{$method}(...$params);
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function index(): ResponseInterface public function index(): ResponseInterface
{ {
$actorObjectClass = $this->config->actorObject; $actorObjectClass = $this->config->actorObject;
@ -71,8 +68,6 @@ class ActorController extends Controller
/** /**
* Handles incoming requests from fediverse servers * Handles incoming requests from fediverse servers
*
* @noRector ReturnTypeDeclarationRector
*/ */
public function inbox(): ResponseInterface public function inbox(): ResponseInterface
{ {
@ -264,9 +259,6 @@ class ActorController extends Controller
} }
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function outbox(): ResponseInterface public function outbox(): ResponseInterface
{ {
// get published activities by publication date // get published activities by publication date
@ -297,9 +289,6 @@ class ActorController extends Controller
->setBody($collection->toJSON()); ->setBody($collection->toJSON());
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function followers(): ResponseInterface public function followers(): ResponseInterface
{ {
$tablesPrefix = config('Fediverse') $tablesPrefix = config('Fediverse')
@ -386,9 +375,6 @@ class ActorController extends Controller
); );
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function activity(string $activityId): ResponseInterface public function activity(string $activityId): ResponseInterface
{ {
if ( if (

View File

@ -53,9 +53,6 @@ class PostController extends Controller
return $this->{$method}(...$params); return $this->{$method}(...$params);
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function index(): Response public function index(): Response
{ {
$noteObjectClass = $this->config->noteObject; $noteObjectClass = $this->config->noteObject;
@ -66,9 +63,6 @@ class PostController extends Controller
->setBody($noteObject->toJSON()); ->setBody($noteObject->toJSON());
} }
/**
* @noRector ReturnTypeDeclarationRector
*/
public function replies(): Response public function replies(): Response
{ {
/** /**

View File

@ -539,7 +539,7 @@ class PostModel extends BaseUuidModel
->first(); ->first();
$announceActivity = new AnnounceActivity($reblogPost); $announceActivity = new AnnounceActivity($reblogPost);
$announceActivity->set('id', url_to('activity', $reblogPost->actor->username, $activity->id),); $announceActivity->set('id', url_to('activity', $reblogPost->actor->username, $activity->id));
$undoActivity $undoActivity
->set('actor', $reblogPost->actor->uri) ->set('actor', $reblogPost->actor->uri)

View File

@ -115,19 +115,13 @@ class InstallController extends Controller
} }
try { try {
$db = db_connect();
// Check if instance owner has been created, meaning install was completed // Check if instance owner has been created, meaning install was completed
if ( if ((new UserModel())->where('is_owner', true)
$db->tableExists('users') &&
(new UserModel())->where('is_owner', true)
->first() !== null ->first() !== null
) { ) {
// if so, show a 404 page // if so, show a 404 page
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
/** @noRector */
} catch (DatabaseException) { } catch (DatabaseException) {
// Could not connect to the database // Could not connect to the database
// show database config view to fix value // show database config view to fix value

View File

@ -42,9 +42,6 @@ class SubscriptionModel extends Model
'updated_by', 'updated_by',
]; ];
/**
* @noRector
*/
protected $returnType = Subscription::class; protected $returnType = Subscription::class;
/** /**

View File

@ -20,7 +20,6 @@ class WebSubController extends Controller
{ {
public function publish(): void public function publish(): void
{ {
/** @noRector RemoveAlwaysTrueIfConditionRector */
if (ENVIRONMENT !== 'production') { if (ENVIRONMENT !== 'production') {
return; return;
} }

View File

@ -46,12 +46,9 @@ class PodcastTest extends CIUnitTestCase
private readonly string $podcastApiUrl; private readonly string $podcastApiUrl;
/** public function __construct(?string $name = null)
* @param array<mixed> $data
*/
public function __construct(?string $name = null, array $data = [], $dataName = '')
{ {
parent::__construct($name, $data, $dataName); parent::__construct($name);
$this->podcast = FakeSinglePodcastApiSeeder::podcast(); $this->podcast = FakeSinglePodcastApiSeeder::podcast();
$this->podcast['created_at'] = []; $this->podcast['created_at'] = [];
$this->podcast['updated_at'] = []; $this->podcast['updated_at'] = [];

View File

@ -32,7 +32,7 @@
name="cover" name="cover"
label="<?= lang('Episode.form.cover') ?>" label="<?= lang('Episode.form.cover') ?>"
hint="<?= lang('Episode.form.cover_hint') ?>" hint="<?= lang('Episode.form.cover_hint') ?>"
helper="<?= lang('Episode.form.cover_size_hint', ) ?>" helper="<?= lang('Episode.form.cover_size_hint') ?>"
type="file" type="file"
accept=".jpg,.jpeg,.png" /> accept=".jpg,.jpeg,.png" />

View File

@ -111,11 +111,11 @@
<Forms.RadioButton <Forms.RadioButton
value="clean" value="clean"
name="parental_advisory" name="parental_advisory"
isChecked="false" ><?= lang('Podcast.form.parental_advisory.clean', ) ?></Forms.RadioButton> isChecked="false" ><?= lang('Podcast.form.parental_advisory.clean') ?></Forms.RadioButton>
<Forms.RadioButton <Forms.RadioButton
value="explicit" value="explicit"
name="parental_advisory" name="parental_advisory"
isChecked="false" ><?= lang('Podcast.form.parental_advisory.explicit', ) ?></Forms.RadioButton> isChecked="false" ><?= lang('Podcast.form.parental_advisory.explicit') ?></Forms.RadioButton>
</div> </div>
</fieldset> </fieldset>
</Forms.Section> </Forms.Section>

View File

@ -128,11 +128,11 @@
<Forms.RadioButton <Forms.RadioButton
value="clean" value="clean"
name="parental_advisory" name="parental_advisory"
isChecked="<?= $podcast->parental_advisory === 'clean' ? 'true' : 'false' ?>" ><?= lang('Podcast.form.parental_advisory.clean', ) ?></Forms.RadioButton> isChecked="<?= $podcast->parental_advisory === 'clean' ? 'true' : 'false' ?>" ><?= lang('Podcast.form.parental_advisory.clean') ?></Forms.RadioButton>
<Forms.RadioButton <Forms.RadioButton
value="explicit" value="explicit"
name="parental_advisory" name="parental_advisory"
isChecked="<?= $podcast->parental_advisory === 'explicit' ? 'true' : 'false' ?>" ><?= lang('Podcast.form.parental_advisory.explicit', ) ?></Forms.RadioButton> isChecked="<?= $podcast->parental_advisory === 'explicit' ? 'true' : 'false' ?>" ><?= lang('Podcast.form.parental_advisory.explicit') ?></Forms.RadioButton>
</div> </div>
</fieldset> </fieldset>
</Forms.Section> </Forms.Section>

View File

@ -7,7 +7,7 @@ $userPodcasts = get_podcasts_user_can_interact_with(auth()->user()); ?>
<a href="<?= route_to('home') ?>" class="inline-flex items-center h-full px-2 border-r border-navigation focus:ring-inset focus:ring-accent"> <a href="<?= route_to('home') ?>" class="inline-flex items-center h-full px-2 border-r border-navigation focus:ring-inset focus:ring-accent">
<?= svg('castopod-logo-base', 'h-6') ?> <?= svg('castopod-logo-base', 'h-6') ?>
</a> </a>
<a href="<?= route_to('admin', ) ?>" class="inline-flex items-center h-full px-6 text-sm font-semibold hover:underline focus:ring-inset focus:ring-accent"> <a href="<?= route_to('admin') ?>" class="inline-flex items-center h-full px-6 text-sm font-semibold hover:underline focus:ring-inset focus:ring-accent">
<?= lang('Navigation.go_to_admin') ?> <?= lang('Navigation.go_to_admin') ?>
<?= icon('external-link', 'ml-1 opacity-60') ?> <?= icon('external-link', 'ml-1 opacity-60') ?>
</a> </a>

View File

@ -98,7 +98,8 @@
<?php $i = 0; ?> <?php $i = 0; ?>
<?php foreach ($episode->persons as $person): ?> <?php foreach ($episode->persons as $person): ?>
<img src="<?= $person->avatar->thumbnail_url ?>" alt="<?= esc($person->full_name) ?>" class="object-cover w-8 h-8 -ml-4 border-2 rounded-full aspect-square border-background-header last:ml-0" loading="lazy" /> <img src="<?= $person->avatar->thumbnail_url ?>" alt="<?= esc($person->full_name) ?>" class="object-cover w-8 h-8 -ml-4 border-2 rounded-full aspect-square border-background-header last:ml-0" loading="lazy" />
<?php $i++; if ($i === 3) { <?php $i++;
if ($i === 3) {
break; break;
}?> }?>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -22,7 +22,8 @@
<?php $i = 0; ?> <?php $i = 0; ?>
<?php foreach ($podcast->persons as $person): ?> <?php foreach ($podcast->persons as $person): ?>
<img src="<?= $person->avatar->thumbnail_url ?>" alt="<?= esc($person->full_name) ?>" class="object-cover w-8 -ml-4 border-2 rounded-full aspect-square bg-header border-background-base last:ml-0" loading="lazy" /> <img src="<?= $person->avatar->thumbnail_url ?>" alt="<?= esc($person->full_name) ?>" class="object-cover w-8 -ml-4 border-2 rounded-full aspect-square bg-header border-background-base last:ml-0" loading="lazy" />
<?php $i++; if ($i === 3) { <?php $i++;
if ($i === 3) {
break; break;
}?> }?>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -2,29 +2,17 @@
<p class="inline-flex px-6 pt-4 text-xs text-skin-muted"><?= icon( <p class="inline-flex px-6 pt-4 text-xs text-skin-muted"><?= icon(
'repeat', 'repeat',
'text-lg mr-2 opacity-40', 'text-lg mr-2 opacity-40',
) . ) . lang('Post.actor_shared', [
lang('Post.actor_shared', [
'actor' => esc($post->actor->display_name), 'actor' => esc($post->actor->display_name),
]) ?></p> ]) ?></p>
<header class="flex px-6 py-4 gap-x-2"> <header class="flex px-6 py-4 gap-x-2">
<img src="<?= $post->actor <img src="<?= $post->actor->avatar_image_url ?>" alt="<?= esc($post->actor->display_name) ?>" class="w-10 h-10 rounded-full aspect-square" loading="lazy" />
->avatar_image_url ?>" alt="<?= esc($post->actor->display_name) ?>" class="w-10 h-10 rounded-full aspect-square" loading="lazy" />
<div class="flex flex-col min-w-0"> <div class="flex flex-col min-w-0">
<a href="<?= $post->actor <a href="<?= $post->actor->uri ?>" class="flex items-baseline hover:underline" <?= $post->actor->is_local ? '' : 'target="_blank" rel="noopener noreferrer"' ?>>
->uri ?>" class="flex items-baseline hover:underline" <?= $post <span class="mr-2 font-semibold truncate"><?= esc($post->actor->display_name) ?></span>
->actor->is_local <span class="text-sm truncate text-skin-muted">@<?= esc($post->actor->username) . ($post->actor->is_local ? '' : '@' . $post->actor->domain) ?></span>
? ''
: 'target="_blank" rel="noopener noreferrer"' ?>>
<span class="mr-2 font-semibold truncate"><?= esc($post->actor
->display_name) ?></span>
<span class="text-sm truncate text-skin-muted">@<?= esc($post->actor
->username) .
($post->actor->is_local
? ''
: '@' . $post->actor->domain) ?></span>
</a> </a>
<a href="<?= route_to('post', esc($podcast->handle), $post->id) ?>" <a href="<?= route_to('post', esc($podcast->handle), $post->id) ?>" class="text-xs text-skin-muted">
class="text-xs text-skin-muted">
<?= relative_time($post->published_at) ?> <?= relative_time($post->published_at) ?>
</a> </a>
</div> </div>