chore: update rector to latest and use parallel for faster processing

update composer dependencies to latest
This commit is contained in:
Yassine Doghri 2022-09-28 14:00:05 +00:00
parent 9eab54e085
commit b6114d3d93
33 changed files with 194 additions and 271 deletions

View File

@ -84,6 +84,7 @@ 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

@ -28,7 +28,7 @@ use Modules\Auth\Entities\User;
* Events::on('create', [$myInstance, 'myMethod']); * Events::on('create', [$myInstance, 'myMethod']);
*/ */
Events::on('pre_system', function () { Events::on('pre_system', static function () {
// @phpstan-ignore-next-line // @phpstan-ignore-next-line
if (ENVIRONMENT !== 'testing') { if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) { if (ini_get('zlib.output_compression')) {
@ -56,9 +56,8 @@ Events::on('pre_system', function () {
} }
}); });
Events::on('login', function (User $user): void { Events::on('login', static function (User $user): void {
helper('auth'); helper('auth');
// set interact_as_actor_id value // set interact_as_actor_id value
$userPodcasts = $user->podcasts; $userPodcasts = $user->podcasts;
if ($userPodcasts = $user->podcasts) { if ($userPodcasts = $user->podcasts) {
@ -66,9 +65,8 @@ Events::on('login', function (User $user): void {
} }
}); });
Events::on('logout', function (User $user): void { Events::on('logout', static function (User $user): void {
helper('auth'); helper('auth');
// remove user's interact_as_actor session // remove user's interact_as_actor session
remove_interact_as_actor(); remove_interact_as_actor();
}); });
@ -82,7 +80,7 @@ Events::on('logout', function (User $user): void {
* @param Actor $actor * @param Actor $actor
* @param Actor $targetActor * @param Actor $targetActor
*/ */
Events::on('on_follow', function ($actor, $targetActor): void { Events::on('on_follow', static function ($actor, $targetActor): void {
if ($actor->is_podcast) { if ($actor->is_podcast) {
cache() cache()
->deleteMatching("podcast#{$actor->podcast->id}*"); ->deleteMatching("podcast#{$actor->podcast->id}*");
@ -102,7 +100,7 @@ Events::on('on_follow', function ($actor, $targetActor): void {
* @param Actor $actor * @param Actor $actor
* @param Actor $targetActor * @param Actor $targetActor
*/ */
Events::on('on_undo_follow', function ($actor, $targetActor): void { Events::on('on_undo_follow', static function ($actor, $targetActor): void {
if ($actor->is_podcast) { if ($actor->is_podcast) {
cache() cache()
->deleteMatching("podcast#{$actor->podcast->id}*"); ->deleteMatching("podcast#{$actor->podcast->id}*");
@ -121,11 +119,10 @@ Events::on('on_undo_follow', function ($actor, $targetActor): void {
/** /**
* @param Post $post * @param Post $post
*/ */
Events::on('on_post_add', function ($post): void { Events::on('on_post_add', static function ($post): void {
model(EpisodeModel::class, false)->builder() model(EpisodeModel::class, false)->builder()
->where('id', $post->episode_id) ->where('id', $post->episode_id)
->increment('posts_count'); ->increment('posts_count');
if ($post->actor->is_podcast) { if ($post->actor->is_podcast) {
// Removing all of the podcast pages is a bit overkill, but works to avoid caching bugs // Removing all of the podcast pages is a bit overkill, but works to avoid caching bugs
// same for other events below // same for other events below
@ -139,7 +136,7 @@ Events::on('on_post_add', function ($post): void {
/** /**
* @param Post $post * @param Post $post
*/ */
Events::on('on_post_remove', function ($post): void { Events::on('on_post_remove', static function ($post): void {
if ($episodeId = $post->episode_id) { if ($episodeId = $post->episode_id) {
model(EpisodeModel::class, false)->builder() model(EpisodeModel::class, false)->builder()
->where('id', $episodeId) ->where('id', $episodeId)
@ -161,7 +158,7 @@ Events::on('on_post_remove', function ($post): void {
* @param Actor $actor * @param Actor $actor
* @param Post $post * @param Post $post
*/ */
Events::on('on_post_reblog', function ($actor, $post): void { Events::on('on_post_reblog', static function ($actor, $post): void {
if ($post->actor->is_podcast) { if ($post->actor->is_podcast) {
cache() cache()
->deleteMatching("podcast#{$post->actor->podcast->id}*"); ->deleteMatching("podcast#{$post->actor->podcast->id}*");
@ -177,7 +174,6 @@ Events::on('on_post_reblog', function ($actor, $post): void {
cache() cache()
->deleteMatching("page_post#{$post->id}*"); ->deleteMatching("page_post#{$post->id}*");
if ($post->in_reply_to_id !== null) { if ($post->in_reply_to_id !== null) {
cache()->deleteMatching("page_post#{$post->in_reply_to_id}"); cache()->deleteMatching("page_post#{$post->in_reply_to_id}");
} }
@ -186,9 +182,8 @@ Events::on('on_post_reblog', function ($actor, $post): void {
/** /**
* @param Post $reblogPost * @param Post $reblogPost
*/ */
Events::on('on_post_undo_reblog', function ($reblogPost): void { Events::on('on_post_undo_reblog', static function ($reblogPost): void {
$post = $reblogPost->reblog_of_post; $post = $reblogPost->reblog_of_post;
if ($post->actor->is_podcast) { if ($post->actor->is_podcast) {
cache() cache()
->deleteMatching("podcast#{$post->actor->podcast->id}*"); ->deleteMatching("podcast#{$post->actor->podcast->id}*");
@ -200,7 +195,6 @@ Events::on('on_post_undo_reblog', function ($reblogPost): void {
->deleteMatching("page_post#{$post->id}*"); ->deleteMatching("page_post#{$post->id}*");
cache() cache()
->deleteMatching("page_post#{$reblogPost->id}*"); ->deleteMatching("page_post#{$reblogPost->id}*");
if ($post->in_reply_to_id !== null) { if ($post->in_reply_to_id !== null) {
cache()->deleteMatching("page_post#{$post->in_reply_to_id}"); cache()->deleteMatching("page_post#{$post->in_reply_to_id}");
} }
@ -216,9 +210,8 @@ Events::on('on_post_undo_reblog', function ($reblogPost): void {
/** /**
* @param Post $reply * @param Post $reply
*/ */
Events::on('on_post_reply', function ($reply): void { Events::on('on_post_reply', static function ($reply): void {
$post = $reply->reply_to_post; $post = $reply->reply_to_post;
if ($post->in_reply_to_id === null) { if ($post->in_reply_to_id === null) {
model(EpisodeModel::class, false)->builder() model(EpisodeModel::class, false)->builder()
->where('id', $post->episode_id) ->where('id', $post->episode_id)
@ -241,9 +234,8 @@ Events::on('on_post_reply', function ($reply): void {
/** /**
* @param Post $reply * @param Post $reply
*/ */
Events::on('on_reply_remove', function ($reply): void { Events::on('on_reply_remove', static function ($reply): void {
$post = $reply->reply_to_post; $post = $reply->reply_to_post;
if ($post->in_reply_to_id === null) { if ($post->in_reply_to_id === null) {
model(EpisodeModel::class, false)->builder() model(EpisodeModel::class, false)->builder()
->where('id', $post->episode_id) ->where('id', $post->episode_id)
@ -269,7 +261,7 @@ Events::on('on_reply_remove', function ($reply): void {
* @param Actor $actor * @param Actor $actor
* @param Post $post * @param Post $post
*/ */
Events::on('on_post_favourite', function ($actor, $post): void { Events::on('on_post_favourite', static function ($actor, $post): void {
if ($post->actor->is_podcast) { if ($post->actor->is_podcast) {
cache() cache()
->deleteMatching("podcast#{$post->actor->podcast->id}*"); ->deleteMatching("podcast#{$post->actor->podcast->id}*");
@ -279,7 +271,6 @@ Events::on('on_post_favourite', function ($actor, $post): void {
cache() cache()
->deleteMatching("page_post#{$post->id}*"); ->deleteMatching("page_post#{$post->id}*");
if ($post->in_reply_to_id !== null) { if ($post->in_reply_to_id !== null) {
cache()->deleteMatching("page_post#{$post->in_reply_to_id}*"); cache()->deleteMatching("page_post#{$post->in_reply_to_id}*");
} }
@ -295,7 +286,7 @@ Events::on('on_post_favourite', function ($actor, $post): void {
* @param Actor $actor * @param Actor $actor
* @param Post $post * @param Post $post
*/ */
Events::on('on_post_undo_favourite', function ($actor, $post): void { Events::on('on_post_undo_favourite', static function ($actor, $post): void {
if ($post->actor->is_podcast) { if ($post->actor->is_podcast) {
cache() cache()
->deleteMatching("podcast#{$post->actor->podcast->id}*"); ->deleteMatching("podcast#{$post->actor->podcast->id}*");
@ -305,7 +296,6 @@ Events::on('on_post_undo_favourite', function ($actor, $post): void {
cache() cache()
->deleteMatching("page_post#{$post->id}*"); ->deleteMatching("page_post#{$post->id}*");
if ($post->in_reply_to_id !== null) { if ($post->in_reply_to_id !== null) {
cache()->deleteMatching("page_post#{$post->in_reply_to_id}*"); cache()->deleteMatching("page_post#{$post->in_reply_to_id}*");
} }
@ -317,7 +307,7 @@ Events::on('on_post_undo_favourite', function ($actor, $post): void {
} }
}); });
Events::on('on_block_actor', function (int $actorId): void { Events::on('on_block_actor', static function (int $actorId): void {
cache()->deleteMatching('page_podcast*'); cache()->deleteMatching('page_podcast*');
cache() cache()
->deleteMatching('podcast*'); ->deleteMatching('podcast*');
@ -325,7 +315,7 @@ Events::on('on_block_actor', function (int $actorId): void {
->deleteMatching('page_post*'); ->deleteMatching('page_post*');
}); });
Events::on('on_unblock_actor', function (int $actorId): void { Events::on('on_unblock_actor', static function (int $actorId): void {
cache()->deleteMatching('page_podcast*'); cache()->deleteMatching('page_podcast*');
cache() cache()
->deleteMatching('podcast*'); ->deleteMatching('podcast*');
@ -333,7 +323,7 @@ Events::on('on_unblock_actor', function (int $actorId): void {
->deleteMatching('page_post*'); ->deleteMatching('page_post*');
}); });
Events::on('on_block_domain', function (string $domainName): void { Events::on('on_block_domain', static function (string $domainName): void {
cache()->deleteMatching('page_podcast*'); cache()->deleteMatching('page_podcast*');
cache() cache()
->deleteMatching('podcast*'); ->deleteMatching('podcast*');
@ -341,7 +331,7 @@ Events::on('on_block_domain', function (string $domainName): void {
->deleteMatching('page_post*'); ->deleteMatching('page_post*');
}); });
Events::on('on_unblock_domain', function (string $domainName): void { Events::on('on_unblock_domain', static function (string $domainName): void {
cache()->deleteMatching('page_podcast*'); cache()->deleteMatching('page_podcast*');
cache() cache()
->deleteMatching('podcast*'); ->deleteMatching('podcast*');

View File

@ -69,14 +69,13 @@ $routes->get('/', 'HomeController', [
$routes->get('.well-known/platforms', 'Platform'); $routes->get('.well-known/platforms', 'Platform');
// Podcast's Public routes // Podcast's Public routes
$routes->group('@(:podcastHandle)', function ($routes): void { $routes->group('@(:podcastHandle)', static function ($routes): void {
$routes->get('/', 'PodcastController::activity/$1', [ $routes->get('/', 'PodcastController::activity/$1', [
'as' => 'podcast-activity', 'as' => 'podcast-activity',
]); ]);
$routes->get('manifest.webmanifest', 'WebmanifestController::podcastManifest/$1', [ $routes->get('manifest.webmanifest', 'WebmanifestController::podcastManifest/$1', [
'as' => 'podcast-webmanifest', 'as' => 'podcast-webmanifest',
]); ]);
// override default Fediverse Library's actor route // override default Fediverse Library's actor route
$routes->options('/', 'ActivityPubController::preflight'); $routes->options('/', 'ActivityPubController::preflight');
$routes->get('/', 'PodcastController::activity/$1', [ $routes->get('/', 'PodcastController::activity/$1', [
@ -116,7 +115,7 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
], ],
'filter' => 'allow-cors', 'filter' => 'allow-cors',
]); ]);
$routes->group('episodes/(:slug)', function ($routes): void { $routes->group('episodes/(:slug)', static function ($routes): void {
$routes->options('/', 'ActivityPubController::preflight'); $routes->options('/', 'ActivityPubController::preflight');
$routes->get('/', 'EpisodeController/$1/$2', [ $routes->get('/', 'EpisodeController/$1/$2', [
'as' => 'episode', 'as' => 'episode',
@ -176,7 +175,7 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
$routes->get('oembed.xml', 'EpisodeController::oembedXML/$1/$2', [ $routes->get('oembed.xml', 'EpisodeController::oembedXML/$1/$2', [
'as' => 'episode-oembed-xml', 'as' => 'episode-oembed-xml',
]); ]);
$routes->group('embed', function ($routes): void { $routes->group('embed', static function ($routes): void {
$routes->get('/', 'EpisodeController::embed/$1/$2', [ $routes->get('/', 'EpisodeController::embed/$1/$2', [
'as' => 'embed', 'as' => 'embed',
]); ]);
@ -185,7 +184,6 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
],); ],);
}); });
}); });
$routes->head('feed.xml', 'FeedController/$1', [ $routes->head('feed.xml', 'FeedController/$1', [
'as' => 'podcast_feed', 'as' => 'podcast_feed',
]); ]);
@ -211,14 +209,13 @@ $routes->get('/pages/(:slug)', 'PageController/$1', [
/** /**
* Overwriting Fediverse routes file * Overwriting Fediverse routes file
*/ */
$routes->group('@(:podcastHandle)', function ($routes): void { $routes->group('@(:podcastHandle)', static function ($routes): void {
$routes->post('posts/new', 'PostController::attemptCreate/$1', [ $routes->post('posts/new', 'PostController::attemptCreate/$1', [
'as' => 'post-attempt-create', 'as' => 'post-attempt-create',
'filter' => 'permission:podcast-manage_publications', 'filter' => 'permission:podcast-manage_publications',
]); ]);
// Post // Post
$routes->group('posts/(:uuid)', function ($routes): void { $routes->group('posts/(:uuid)', static function ($routes): void {
$routes->options('/', 'ActivityPubController::preflight'); $routes->options('/', 'ActivityPubController::preflight');
$routes->get('/', 'PostController::view/$1/$2', [ $routes->get('/', 'PostController::view/$1/$2', [
'as' => 'post', 'as' => 'post',
@ -249,13 +246,11 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
], ],
'filter' => 'allow-cors', 'filter' => 'allow-cors',
]); ]);
// Actions // Actions
$routes->post('action', 'PostController::attemptAction/$1/$2', [ $routes->post('action', 'PostController::attemptAction/$1/$2', [
'as' => 'post-attempt-action', 'as' => 'post-attempt-action',
'filter' => 'permission:podcast-interact_as', 'filter' => 'permission:podcast-interact_as',
]); ]);
$routes->post( $routes->post(
'block-actor', 'block-actor',
'PostController::attemptBlockActor/$1/$2', 'PostController::attemptBlockActor/$1/$2',
@ -276,7 +271,6 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
'as' => 'post-attempt-delete', 'as' => 'post-attempt-delete',
'filter' => 'permission:podcast-manage_publications', 'filter' => 'permission:podcast-manage_publications',
]); ]);
$routes->get( $routes->get(
'remote/(:postAction)', 'remote/(:postAction)',
'PostController::remoteAction/$1/$2/$3', 'PostController::remoteAction/$1/$2/$3',
@ -285,7 +279,6 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
], ],
); );
}); });
$routes->get('follow', 'ActorController::follow/$1', [ $routes->get('follow', 'ActorController::follow/$1', [
'as' => 'follow', 'as' => 'follow',
]); ]);

View File

@ -29,7 +29,7 @@ class MapController extends BaseController
); );
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
$found = view('pages/map', [], [ return view('pages/map', [], [
'cache' => DECADE, 'cache' => DECADE,
'cache_name' => $cacheName, 'cache_name' => $cacheName,
]); ]);

View File

@ -42,8 +42,8 @@ class Location extends Entity
$longitude = null; $longitude = null;
if ($geo !== null) { if ($geo !== null) {
$geoArray = explode(',', substr($geo, 4)); $geoArray = explode(',', substr($geo, 4));
$latitude = floatval($geoArray[0]); $latitude = (float) $geoArray[0];
$longitude = floatval($geoArray[1]); $longitude = (float) $geoArray[1];
} }
parent::__construct([ parent::__construct([

View File

@ -50,7 +50,7 @@ if (! function_exists('data_table')) {
* @param mixed[] $data data to loop through and display in rows * @param mixed[] $data data to loop through and display in rows
* @param mixed ...$rest Any other argument to pass to the `cell` function * @param mixed ...$rest Any other argument to pass to the `cell` function
*/ */
function data_table(array $columns, array $data = [], string $class = '', ...$rest): string function data_table(array $columns, array $data = [], string $class = '', mixed ...$rest): string
{ {
$table = new Table(); $table = new Table();

View File

@ -5,11 +5,8 @@ declare(strict_types=1);
if (! function_exists('form_textarea')) { if (! function_exists('form_textarea')) {
/** /**
* Adapted textarea field from CI4 core: without value escaping. * Adapted textarea field from CI4 core: without value escaping.
*
* @param mixed $data
* @param mixed $extra
*/ */
function form_textarea($data = '', string $value = '', $extra = ''): string function form_textarea(mixed $data = '', string $value = '', mixed $extra = ''): string
{ {
$defaults = [ $defaults = [
'name' => is_array($data) ? '' : $data, 'name' => is_array($data) ? '' : $data,

View File

@ -34,7 +34,7 @@ if (! function_exists('icon')) {
} }
if ($class !== '') { if ($class !== '') {
$svgContents = str_replace('<svg', '<svg class="' . $class . '"', $svgContents); return str_replace('<svg', '<svg class="' . $class . '"', $svgContents);
} }
return $svgContents; return $svgContents;
@ -53,7 +53,7 @@ if (! function_exists('svg')) {
{ {
$svgContents = file_get_contents('assets/images/' . $name . '.svg'); $svgContents = file_get_contents('assets/images/' . $name . '.svg');
if ($class) { if ($class) {
$svgContents = str_replace('<svg', '<svg class="' . $class . '"', $svgContents); return str_replace('<svg', '<svg class="' . $class . '"', $svgContents);
} }
return $svgContents; return $svgContents;

View File

@ -27,15 +27,10 @@ class SimpleRSSElement extends SimpleXMLElement
public function addChildWithCDATA(string $name, string $value = '', ?string $namespace = null): static public function addChildWithCDATA(string $name, string $value = '', ?string $namespace = null): static
{ {
$newChild = parent::addChild($name, null, $namespace); $newChild = parent::addChild($name, null, $namespace);
$node = dom_import_simplexml($newChild);
if ($newChild !== null) { $no = $node->ownerDocument;
$node = dom_import_simplexml($newChild); if ($no !== null) {
if ($node !== null) { $node->appendChild($no->createCDATASection($value));
$no = $node->ownerDocument;
if ($no !== null) {
$node->appendChild($no->createCDATASection($value));
}
}
} }
return $newChild; return $newChild;
@ -55,24 +50,19 @@ class SimpleRSSElement extends SimpleXMLElement
public function addChild($name, $value = null, $namespace = null, $escape = true): static public function addChild($name, $value = null, $namespace = null, $escape = true): static
{ {
$newChild = parent::addChild($name, null, $namespace); $newChild = parent::addChild($name, null, $namespace);
$node = dom_import_simplexml($newChild);
if ($newChild !== null) { $no = $node->ownerDocument;
$node = dom_import_simplexml($newChild); $value = $escape ? esc($value ?? '') : $value ?? '';
if ($node !== null) { if (! $no instanceof DOMDocument) {
$no = $node->ownerDocument; return $newChild;
$value = $escape ? esc($value ?? '') : $value ?? '';
if (! $no instanceof DOMDocument) {
return $newChild;
}
if (is_array($value)) {
return $newChild;
}
$node->appendChild($no->createTextNode($value));
}
} }
if (is_array($value)) {
return $newChild;
}
$node->appendChild($no->createTextNode($value));
return $newChild; return $newChild;
} }
} }

View File

@ -246,7 +246,7 @@ class ComponentRenderer
*/ */
private function renderView(string $view, array $data): string private function renderView(string $view, array $data): string
{ {
return (function (string $view, $data): string { return (static function (string $view, $data): string {
extract($data); extract($data);
ob_start(); ob_start();
eval('?>' . file_get_contents($view)); eval('?>' . file_get_contents($view));

View File

@ -10,7 +10,7 @@ if (! function_exists('flatten_attributes')) {
* *
* @param mixed $attributes string, array, object * @param mixed $attributes string, array, object
*/ */
function flatten_attributes($attributes, bool $js = false): string function flatten_attributes(mixed $attributes, bool $js = false): string
{ {
$atts = ''; $atts = '';

View File

@ -64,7 +64,7 @@ class CategoryModel extends Model
$options = array_reduce( $options = array_reduce(
$categories, $categories,
function (array $result, Category $category): array { static function (array $result, Category $category): array {
$result[$category->id] = ''; $result[$category->id] = '';
if ($category->parent !== null) { if ($category->parent !== null) {
$result[$category->id] = lang( $result[$category->id] = lang(
@ -114,12 +114,11 @@ class CategoryModel extends Model
// prepare data for `podcasts_categories` table // prepare data for `podcasts_categories` table
$data = array_reduce( $data = array_reduce(
$categoriesIds, $categoriesIds,
function (array $result, int $categoryId) use ($podcastId): array { static function (array $result, int $categoryId) use ($podcastId): array {
$result[] = [ $result[] = [
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,
'category_id' => $categoryId, 'category_id' => $categoryId,
]; ];
return $result; return $result;
}, },
[], [],

View File

@ -214,7 +214,7 @@ class EpisodeCommentModel extends UuidModel
$episodePostsReplies = $episodePostsRepliesBuilder->select( $episodePostsReplies = $episodePostsRepliesBuilder->select(
'id, uri, episode_id, actor_id, in_reply_to_id, message, message_html, favourites_count as likes_count, replies_count, published_at as created_at, created_by, 1 as is_from_post' 'id, uri, episode_id, actor_id, in_reply_to_id, message, message_html, favourites_count as likes_count, replies_count, published_at as created_at, created_by, 1 as is_from_post'
) )
->whereIn('in_reply_to_id', function (BaseBuilder $builder) use (&$episodeId): BaseBuilder { ->whereIn('in_reply_to_id', static function (BaseBuilder $builder) use (&$episodeId): BaseBuilder {
return $builder->select('id') return $builder->select('id')
->from(config('Fediverse')->tablesPrefix . 'posts') ->from(config('Fediverse')->tablesPrefix . 'posts')
->where([ ->where([

View File

@ -55,7 +55,7 @@ class LanguageModel extends Model
$options = array_reduce( $options = array_reduce(
$languages, $languages,
function (array $result, Language $language): array { static function (array $result, Language $language): array {
$result[$language->code] = $language->native_name; $result[$language->code] = $language->native_name;
return $result; return $result;
}, },

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace App\Models; namespace App\Models;
use App\Entities\Person; use App\Entities\Person;
use CodeIgniter\Database\Query;
use CodeIgniter\Model; use CodeIgniter\Model;
class PersonModel extends Model class PersonModel extends Model
@ -147,7 +146,7 @@ class PersonModel extends Model
$this->select('`id`, `full_name`') $this->select('`id`, `full_name`')
->orderBy('`full_name`', 'ASC') ->orderBy('`full_name`', 'ASC')
->findAll(), ->findAll(),
function ($result, $person) { static function ($result, $person) {
$result[$person->id] = $person->full_name; $result[$person->id] = $person->full_name;
return $result; return $result;
}, },
@ -255,7 +254,7 @@ class PersonModel extends Model
int $personId, int $personId,
string $groupSlug, string $groupSlug,
string $roleSlug string $roleSlug
): bool | Query { ): bool {
return $this->db->table('episodes_persons') return $this->db->table('episodes_persons')
->insert([ ->insert([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,
@ -266,12 +265,8 @@ class PersonModel extends Model
]); ]);
} }
public function addPodcastPerson( public function addPodcastPerson(int $podcastId, int $personId, string $groupSlug, string $roleSlug): bool
int $podcastId, {
int $personId,
string $groupSlug,
string $roleSlug
): bool | Query {
return $this->db->table('podcasts_persons') return $this->db->table('podcasts_persons')
->insert([ ->insert([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,

View File

@ -20,7 +20,7 @@ class Icon extends Component
} }
if ($this->attributes['class'] !== '') { if ($this->attributes['class'] !== '') {
$svgContents = str_replace('<svg', '<svg class="' . $this->attributes['class'] . '"', $svgContents); return str_replace('<svg', '<svg class="' . $this->attributes['class'] . '"', $svgContents);
} }
return $svgContents; return $svgContents;

View File

@ -18,20 +18,20 @@
"opawg/user-agents-php": "^v1.0", "opawg/user-agents-php": "^v1.0",
"adaures/ipcat-php": "^v1.0.0", "adaures/ipcat-php": "^v1.0.0",
"adaures/podcast-persons-taxonomy": "^v1.0.0", "adaures/podcast-persons-taxonomy": "^v1.0.0",
"phpseclib/phpseclib": "~2.0.37", "phpseclib/phpseclib": "~2.0.38",
"michalsn/codeigniter4-uuid": "dev-develop", "michalsn/codeigniter4-uuid": "dev-develop",
"essence/essence": "^3.5.4", "essence/essence": "^3.5.4",
"codeigniter4/settings": "^v2.1.0", "codeigniter4/settings": "^v2.1.0",
"chrisjean/php-ico": "^1.0.4", "chrisjean/php-ico": "^1.0.4",
"melbahja/seo": "^v2.1.0" "melbahja/seo": "^v2.1.1"
}, },
"require-dev": { "require-dev": {
"mikey179/vfsstream": "^v1.6.11", "mikey179/vfsstream": "^v1.6.11",
"phpunit/phpunit": "^9.5.24", "phpunit/phpunit": "^9.5.25",
"captainhook/captainhook": "^5.10.11", "captainhook/captainhook": "^5.10.11",
"symplify/easy-coding-standard": "^10.3.3", "symplify/easy-coding-standard": "^10.3.3",
"phpstan/phpstan": "^1.8.4", "phpstan/phpstan": "^1.8.6",
"rector/rector": "^0.12.23", "rector/rector": "^0.14.4",
"symplify/coding-standard": "^10.3.3" "symplify/coding-standard": "^10.3.3"
}, },
"autoload": { "autoload": {
@ -47,8 +47,8 @@
"scripts": { "scripts": {
"test": "vendor/bin/phpunit", "test": "vendor/bin/phpunit",
"analyse": "vendor/bin/phpstan analyse --ansi", "analyse": "vendor/bin/phpstan analyse --ansi",
"rector": "vendor/bin/rector process --dry-run --ansi", "rector": "vendor/bin/rector process --dry-run --ansi --memory-limit=1G",
"rector:fix": "vendor/bin/rector process --ansi", "rector:fix": "vendor/bin/rector process --ansi --memory-limit=1G",
"style": "vendor/bin/ecs check --ansi", "style": "vendor/bin/ecs check --ansi",
"style:fix": "vendor/bin/ecs check --fix --ansi", "style:fix": "vendor/bin/ecs check --fix --ansi",
"post-install-cmd": [ "post-install-cmd": [

157
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "ccfd204614b036fccba778ba59e771fa", "content-hash": "e6899d9a3dfff0e17318420d4e3b22c5",
"packages": [ "packages": [
{ {
"name": "adaures/ipcat-php", "name": "adaures/ipcat-php",
@ -778,16 +778,16 @@
}, },
{ {
"name": "kint-php/kint", "name": "kint-php/kint",
"version": "4.2.0", "version": "4.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/kint-php/kint.git", "url": "https://github.com/kint-php/kint.git",
"reference": "0518ee9e1b5b3c7bbf3c9ad837a6591e39dbfab0" "reference": "9230c016c976ff446f0be5cf82272db278344f69"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/kint-php/kint/zipball/0518ee9e1b5b3c7bbf3c9ad837a6591e39dbfab0", "url": "https://api.github.com/repos/kint-php/kint/zipball/9230c016c976ff446f0be5cf82272db278344f69",
"reference": "0518ee9e1b5b3c7bbf3c9ad837a6591e39dbfab0", "reference": "9230c016c976ff446f0be5cf82272db278344f69",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -829,9 +829,9 @@
"keywords": ["debug", "kint", "php"], "keywords": ["debug", "kint", "php"],
"support": { "support": {
"issues": "https://github.com/kint-php/kint/issues", "issues": "https://github.com/kint-php/kint/issues",
"source": "https://github.com/kint-php/kint/tree/4.2.0" "source": "https://github.com/kint-php/kint/tree/4.2.2"
}, },
"time": "2022-08-27T12:15:40+00:00" "time": "2022-09-24T10:11:09+00:00"
}, },
{ {
"name": "laminas/laminas-escaper", "name": "laminas/laminas-escaper",
@ -1264,16 +1264,16 @@
}, },
{ {
"name": "melbahja/seo", "name": "melbahja/seo",
"version": "v2.1.0", "version": "v2.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/melbahja/seo.git", "url": "https://github.com/melbahja/seo.git",
"reference": "0ef0a7c2b7191a3ec034a3291d76401880e28492" "reference": "22b0b3273bf9c8867cadf018e4daa3e426525929"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/melbahja/seo/zipball/0ef0a7c2b7191a3ec034a3291d76401880e28492", "url": "https://api.github.com/repos/melbahja/seo/zipball/22b0b3273bf9c8867cadf018e4daa3e426525929",
"reference": "0ef0a7c2b7191a3ec034a3291d76401880e28492", "reference": "22b0b3273bf9c8867cadf018e4daa3e426525929",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1316,9 +1316,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/melbahja/seo/issues", "issues": "https://github.com/melbahja/seo/issues",
"source": "https://github.com/melbahja/seo/tree/v2.1.0" "source": "https://github.com/melbahja/seo/tree/v2.1.1"
}, },
"time": "2022-05-31T14:18:06+00:00" "time": "2022-09-11T11:16:07+00:00"
}, },
{ {
"name": "michalsn/codeigniter4-uuid", "name": "michalsn/codeigniter4-uuid",
@ -1489,20 +1489,20 @@
}, },
{ {
"name": "nette/utils", "name": "nette/utils",
"version": "v3.2.7", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/utils.git", "url": "https://github.com/nette/utils.git",
"reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99" "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/0af4e3de4df9f1543534beab255ccf459e7a2c99", "url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368",
"reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99", "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2 <8.2" "php": ">=7.2 <8.3"
}, },
"conflict": { "conflict": {
"nette/di": "<3.0.6" "nette/di": "<3.0.6"
@ -1562,9 +1562,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nette/utils/issues", "issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v3.2.7" "source": "https://github.com/nette/utils/tree/v3.2.8"
}, },
"time": "2022-01-24T11:29:14+00:00" "time": "2022-09-12T23:36:20+00:00"
}, },
{ {
"name": "opawg/user-agents-php", "name": "opawg/user-agents-php",
@ -1979,20 +1979,20 @@
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
"version": "4.4.0", "version": "4.5.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ramsey/uuid.git", "url": "https://github.com/ramsey/uuid.git",
"reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a" "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/373f7bacfcf3de038778ff27dcce5672ddbf4c8a", "url": "https://api.github.com/repos/ramsey/uuid/zipball/a161a26d917604dc6d3aa25100fddf2556e9f35d",
"reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a", "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"brick/math": "^0.8 || ^0.9 || ^0.10", "brick/math": "^0.8.8 || ^0.9 || ^0.10",
"ext-ctype": "*", "ext-ctype": "*",
"ext-json": "*", "ext-json": "*",
"php": "^8.0", "php": "^8.0",
@ -2013,12 +2013,13 @@
"php-mock/php-mock-mockery": "^1.3", "php-mock/php-mock-mockery": "^1.3",
"php-parallel-lint/php-parallel-lint": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.1",
"phpbench/phpbench": "^1.0", "phpbench/phpbench": "^1.0",
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^0.12", "phpstan/phpstan": "^1.8",
"phpstan/phpstan-mockery": "^0.12", "phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^0.12", "phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^8.5 || ^9", "phpunit/phpunit": "^8.5 || ^9",
"slevomat/coding-standard": "^7.0", "ramsey/composer-repl": "^1.4",
"slevomat/coding-standard": "^8.4",
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.9" "vimeo/psalm": "^4.9"
}, },
@ -2048,7 +2049,7 @@
"keywords": ["guid", "identifier", "uuid"], "keywords": ["guid", "identifier", "uuid"],
"support": { "support": {
"issues": "https://github.com/ramsey/uuid/issues", "issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.4.0" "source": "https://github.com/ramsey/uuid/tree/4.5.1"
}, },
"funding": [ "funding": [
{ {
@ -2060,7 +2061,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-08-05T17:58:37+00:00" "time": "2022-09-16T03:22:46+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -3356,16 +3357,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.8.4", "version": "1.8.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5" "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/eed4c9da531f6ebb4787235b6fb486e2c20f34e5", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c386ab2741e64cc9e21729f891b28b2b10fe6618",
"reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5", "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3385,7 +3386,7 @@
"keywords": ["dev", "static analysis"], "keywords": ["dev", "static analysis"],
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.8.4" "source": "https://github.com/phpstan/phpstan/tree/1.8.6"
}, },
"funding": [ "funding": [
{ {
@ -3401,7 +3402,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-03T13:08:04+00:00" "time": "2022-09-23T09:54:39+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -3690,16 +3691,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.5.24", "version": "9.5.25",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d",
"reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3721,14 +3722,14 @@
"phpunit/php-timer": "^5.0.2", "phpunit/php-timer": "^5.0.2",
"sebastian/cli-parser": "^1.0.1", "sebastian/cli-parser": "^1.0.1",
"sebastian/code-unit": "^1.0.6", "sebastian/code-unit": "^1.0.6",
"sebastian/comparator": "^4.0.5", "sebastian/comparator": "^4.0.8",
"sebastian/diff": "^4.0.3", "sebastian/diff": "^4.0.3",
"sebastian/environment": "^5.1.3", "sebastian/environment": "^5.1.3",
"sebastian/exporter": "^4.0.3", "sebastian/exporter": "^4.0.5",
"sebastian/global-state": "^5.0.1", "sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3", "sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3", "sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^3.1", "sebastian/type": "^3.2",
"sebastian/version": "^3.0.2" "sebastian/version": "^3.0.2"
}, },
"suggest": { "suggest": {
@ -3760,7 +3761,7 @@
"keywords": ["phpunit", "testing", "xunit"], "keywords": ["phpunit", "testing", "xunit"],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25"
}, },
"funding": [ "funding": [
{ {
@ -3770,9 +3771,13 @@
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
"type": "github" "type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
"type": "tidelift"
} }
], ],
"time": "2022-08-30T07:42:16+00:00" "time": "2022-09-25T03:44:45+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@ -3827,38 +3832,36 @@
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "0.12.23", "version": "0.14.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "690b31768b322db886b35845f8452025eba2cacb" "reference": "149764b07abdbfd23e98c4bb33fa6c49e2ad57cc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/690b31768b322db886b35845f8452025eba2cacb", "url": "https://api.github.com/repos/rectorphp/rector/zipball/149764b07abdbfd23e98c4bb33fa6c49e2ad57cc",
"reference": "690b31768b322db886b35845f8452025eba2cacb", "reference": "149764b07abdbfd23e98c4bb33fa6c49e2ad57cc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2|^8.0", "php": "^7.2|^8.0",
"phpstan/phpstan": "^1.6" "phpstan/phpstan": "^1.8.3"
}, },
"conflict": { "conflict": {
"phpstan/phpdoc-parser": "<1.2",
"rector/rector-cakephp": "*", "rector/rector-cakephp": "*",
"rector/rector-doctrine": "*", "rector/rector-doctrine": "*",
"rector/rector-laravel": "*", "rector/rector-laravel": "*",
"rector/rector-nette": "*", "rector/rector-php-parser": "*",
"rector/rector-phpoffice": "*", "rector/rector-phpoffice": "*",
"rector/rector-phpunit": "*", "rector/rector-phpunit": "*",
"rector/rector-prefixed": "*",
"rector/rector-symfony": "*" "rector/rector-symfony": "*"
}, },
"bin": ["bin/rector"], "bin": ["bin/rector"],
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "0.12-dev" "dev-main": "0.14-dev"
} }
}, },
"autoload": { "autoload": {
@ -3869,7 +3872,7 @@
"description": "Instant Upgrade and Automated Refactoring of any PHP code", "description": "Instant Upgrade and Automated Refactoring of any PHP code",
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/0.12.23" "source": "https://github.com/rectorphp/rector/tree/0.14.4"
}, },
"funding": [ "funding": [
{ {
@ -3877,7 +3880,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-05-01T15:50:16+00:00" "time": "2022-09-27T23:39:09+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -4036,16 +4039,16 @@
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
"version": "4.0.6", "version": "4.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git", "url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "55f4261989e546dc112258c7a75935a81a7ce382" "reference": "fa0f136dd2334583309d32b62544682ee972b51a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a",
"reference": "55f4261989e546dc112258c7a75935a81a7ce382", "reference": "fa0f136dd2334583309d32b62544682ee972b51a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4090,7 +4093,7 @@
"keywords": ["comparator", "compare", "equality"], "keywords": ["comparator", "compare", "equality"],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues", "issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8"
}, },
"funding": [ "funding": [
{ {
@ -4098,7 +4101,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-10-26T15:49:45+00:00" "time": "2022-09-14T12:41:17+00:00"
}, },
{ {
"name": "sebastian/complexity", "name": "sebastian/complexity",
@ -4267,16 +4270,16 @@
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
"version": "4.0.4", "version": "4.0.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git", "url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d",
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4325,7 +4328,7 @@
"keywords": ["export", "exporter"], "keywords": ["export", "exporter"],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues", "issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5"
}, },
"funding": [ "funding": [
{ {
@ -4333,7 +4336,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-11-11T14:18:36+00:00" "time": "2022-09-14T06:03:37+00:00"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
@ -4662,16 +4665,16 @@
}, },
{ {
"name": "sebastian/type", "name": "sebastian/type",
"version": "3.1.0", "version": "3.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/type.git", "url": "https://github.com/sebastianbergmann/type.git",
"reference": "fb44e1cc6e557418387ad815780360057e40753e" "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e",
"reference": "fb44e1cc6e557418387ad815780360057e40753e", "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4683,7 +4686,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -4702,7 +4705,7 @@
"homepage": "https://github.com/sebastianbergmann/type", "homepage": "https://github.com/sebastianbergmann/type",
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/type/issues", "issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/3.1.0" "source": "https://github.com/sebastianbergmann/type/tree/3.2.0"
}, },
"funding": [ "funding": [
{ {
@ -4710,7 +4713,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-08-29T06:55:37+00:00" "time": "2022-09-12T14:47:03+00:00"
}, },
{ {
"name": "sebastian/version", "name": "sebastian/version",

View File

@ -18,12 +18,11 @@ $routes->group(
[ [
'namespace' => 'Modules\Admin\Controllers', 'namespace' => 'Modules\Admin\Controllers',
], ],
function ($routes): void { static function ($routes): void {
$routes->get('/', 'DashboardController', [ $routes->get('/', 'DashboardController', [
'as' => 'admin', 'as' => 'admin',
]); ]);
$routes->group('settings', static function ($routes): void {
$routes->group('settings', function ($routes): void {
$routes->get('/', 'SettingsController', [ $routes->get('/', 'SettingsController', [
'as' => 'settings-general', 'as' => 'settings-general',
'filter' => 'permission:settings-manage', 'filter' => 'permission:settings-manage',
@ -53,8 +52,7 @@ $routes->group(
'filter' => 'permission:settings-manage', 'filter' => 'permission:settings-manage',
]); ]);
}); });
$routes->group('persons', static function ($routes): void {
$routes->group('persons', function ($routes): void {
$routes->get('/', 'PersonController', [ $routes->get('/', 'PersonController', [
'as' => 'person-list', 'as' => 'person-list',
'filter' => 'permission:person-list', 'filter' => 'permission:person-list',
@ -66,7 +64,7 @@ $routes->group(
$routes->post('new', 'PersonController::attemptCreate', [ $routes->post('new', 'PersonController::attemptCreate', [
'filter' => 'permission:person-create', 'filter' => 'permission:person-create',
]); ]);
$routes->group('(:num)', function ($routes): void { $routes->group('(:num)', static function ($routes): void {
$routes->get('/', 'PersonController::view/$1', [ $routes->get('/', 'PersonController::view/$1', [
'as' => 'person-view', 'as' => 'person-view',
'filter' => 'permission:person-view', 'filter' => 'permission:person-view',
@ -84,9 +82,8 @@ $routes->group(
]); ]);
}); });
}); });
// Podcasts // Podcasts
$routes->group('podcasts', function ($routes): void { $routes->group('podcasts', static function ($routes): void {
$routes->get('/', 'PodcastController::list', [ $routes->get('/', 'PodcastController::list', [
'as' => 'podcast-list', 'as' => 'podcast-list',
]); ]);
@ -104,10 +101,9 @@ $routes->group(
$routes->post('import', 'PodcastImportController::attemptImport', [ $routes->post('import', 'PodcastImportController::attemptImport', [
'filter' => 'permission:podcasts-import', 'filter' => 'permission:podcasts-import',
]); ]);
// Podcast // Podcast
// Use ids in admin area to help permission and group lookups // Use ids in admin area to help permission and group lookups
$routes->group('(:num)', function ($routes): void { $routes->group('(:num)', static function ($routes): void {
$routes->get('/', 'PodcastController::view/$1', [ $routes->get('/', 'PodcastController::view/$1', [
'as' => 'podcast-view', 'as' => 'podcast-view',
'filter' => 'permission:podcasts-view,podcast-view', 'filter' => 'permission:podcasts-view,podcast-view',
@ -177,8 +173,7 @@ $routes->group(
'as' => 'podcast-update-feed', 'as' => 'podcast-update-feed',
'filter' => 'permission:podcasts-import', 'filter' => 'permission:podcasts-import',
]); ]);
$routes->group('persons', static function ($routes): void {
$routes->group('persons', function ($routes): void {
$routes->get('/', 'PodcastPersonController/$1', [ $routes->get('/', 'PodcastPersonController/$1', [
'as' => 'podcast-persons-manage', 'as' => 'podcast-persons-manage',
'filter' => 'permission:podcast-edit', 'filter' => 'permission:podcast-edit',
@ -190,7 +185,6 @@ $routes->group(
'filter' => 'permission:podcast-edit', 'filter' => 'permission:podcast-edit',
], ],
); );
$routes->get( $routes->get(
'(:num)/remove', '(:num)/remove',
'PodcastPersonController::remove/$1/$2', 'PodcastPersonController::remove/$1/$2',
@ -200,8 +194,7 @@ $routes->group(
], ],
); );
}); });
$routes->group('analytics', static function ($routes): void {
$routes->group('analytics', function ($routes): void {
$routes->get('/', 'PodcastController::viewAnalytics/$1', [ $routes->get('/', 'PodcastController::viewAnalytics/$1', [
'as' => 'podcast-analytics', 'as' => 'podcast-analytics',
'filter' => 'permission:podcasts-view,podcast-view', 'filter' => 'permission:podcasts-view,podcast-view',
@ -255,9 +248,8 @@ $routes->group(
], ],
); );
}); });
// Podcast episodes // Podcast episodes
$routes->group('episodes', function ($routes): void { $routes->group('episodes', static function ($routes): void {
$routes->get('/', 'EpisodeController::list/$1', [ $routes->get('/', 'EpisodeController::list/$1', [
'as' => 'episode-list', 'as' => 'episode-list',
'filter' => 'filter' =>
@ -274,9 +266,8 @@ $routes->group(
'filter' => 'permission:podcast_episodes-create', 'filter' => 'permission:podcast_episodes-create',
], ],
); );
// Episode // Episode
$routes->group('(:num)', function ($routes): void { $routes->group('(:num)', static function ($routes): void {
$routes->get('/', 'EpisodeController::view/$1/$2', [ $routes->get('/', 'EpisodeController::view/$1/$2', [
'as' => 'episode-view', 'as' => 'episode-view',
'filter' => 'filter' =>
@ -474,8 +465,7 @@ $routes->group(
'filter' => 'permission:podcast_episodes-edit', 'filter' => 'permission:podcast_episodes-edit',
], ],
); );
$routes->group('persons', static function ($routes): void {
$routes->group('persons', function ($routes): void {
$routes->get('/', 'EpisodePersonController/$1/$2', [ $routes->get('/', 'EpisodePersonController/$1/$2', [
'as' => 'episode-persons-manage', 'as' => 'episode-persons-manage',
'filter' => 'permission:podcast_episodes-edit', 'filter' => 'permission:podcast_episodes-edit',
@ -498,8 +488,7 @@ $routes->group(
], ],
); );
}); });
$routes->group('comments', static function ($routes): void {
$routes->group('comments', function ($routes): void {
$routes->post( $routes->post(
'new', 'new',
'EpisodeController::attemptCommentCreate/$1/$2', 'EpisodeController::attemptCommentCreate/$1/$2',
@ -527,9 +516,8 @@ $routes->group(
}); });
}); });
}); });
// Podcast contributors // Podcast contributors
$routes->group('contributors', function ($routes): void { $routes->group('contributors', static function ($routes): void {
$routes->get('/', 'ContributorController::list/$1', [ $routes->get('/', 'ContributorController::list/$1', [
'as' => 'contributor-list', 'as' => 'contributor-list',
'filter' => 'filter' =>
@ -547,9 +535,8 @@ $routes->group(
'permission:podcast-manage_contributors', 'permission:podcast-manage_contributors',
], ],
); );
// Contributor // Contributor
$routes->group('(:num)', function ($routes): void { $routes->group('(:num)', static function ($routes): void {
$routes->get('/', 'ContributorController::view/$1/$2', [ $routes->get('/', 'ContributorController::view/$1/$2', [
'as' => 'contributor-view', 'as' => 'contributor-view',
'filter' => 'filter' =>
@ -583,8 +570,7 @@ $routes->group(
); );
}); });
}); });
$routes->group('platforms', static function ($routes): void {
$routes->group('platforms', function ($routes): void {
$routes->get( $routes->get(
'/', '/',
'PodcastPlatformController::platforms/$1/podcasting', 'PodcastPlatformController::platforms/$1/podcasting',
@ -626,9 +612,8 @@ $routes->group(
], ],
); );
}); });
// Podcast notifications // Podcast notifications
$routes->group('notifications', function ($routes): void { $routes->group('notifications', static function ($routes): void {
$routes->get('/', 'NotificationController::list/$1', [ $routes->get('/', 'NotificationController::list/$1', [
'as' => 'notification-list', 'as' => 'notification-list',
]); ]);
@ -641,9 +626,8 @@ $routes->group(
}); });
}); });
}); });
// Instance wide Fediverse config // Instance wide Fediverse config
$routes->group('fediverse', function ($routes): void { $routes->group('fediverse', static function ($routes): void {
$routes->get('/', 'FediverseController::dashboard', [ $routes->get('/', 'FediverseController::dashboard', [
'as' => 'fediverse-dashboard', 'as' => 'fediverse-dashboard',
]); ]);
@ -664,9 +648,8 @@ $routes->group(
], ],
); );
}); });
// Pages // Pages
$routes->group('pages', function ($routes): void { $routes->group('pages', static function ($routes): void {
$routes->get('/', 'PageController::list', [ $routes->get('/', 'PageController::list', [
'as' => 'page-list', 'as' => 'page-list',
]); ]);
@ -677,8 +660,7 @@ $routes->group(
$routes->post('new', 'PageController::attemptCreate', [ $routes->post('new', 'PageController::attemptCreate', [
'filter' => 'permission:pages-manage', 'filter' => 'permission:pages-manage',
]); ]);
$routes->group('(:num)', static function ($routes): void {
$routes->group('(:num)', function ($routes): void {
$routes->get('/', 'PageController::view/$1', [ $routes->get('/', 'PageController::view/$1', [
'as' => 'page-view', 'as' => 'page-view',
]); ]);
@ -689,16 +671,14 @@ $routes->group(
$routes->post('edit', 'PageController::attemptEdit/$1', [ $routes->post('edit', 'PageController::attemptEdit/$1', [
'filter' => 'permission:pages-manage', 'filter' => 'permission:pages-manage',
]); ]);
$routes->get('delete', 'PageController::delete/$1', [ $routes->get('delete', 'PageController::delete/$1', [
'as' => 'page-delete', 'as' => 'page-delete',
'filter' => 'permission:pages-manage', 'filter' => 'permission:pages-manage',
]); ]);
}); });
}); });
// Users // Users
$routes->group('users', function ($routes): void { $routes->group('users', static function ($routes): void {
$routes->get('/', 'UserController::list', [ $routes->get('/', 'UserController::list', [
'as' => 'user-list', 'as' => 'user-list',
'filter' => 'permission:users-list', 'filter' => 'permission:users-list',
@ -710,9 +690,8 @@ $routes->group(
$routes->post('new', 'UserController::attemptCreate', [ $routes->post('new', 'UserController::attemptCreate', [
'filter' => 'permission:users-create', 'filter' => 'permission:users-create',
]); ]);
// User // User
$routes->group('(:num)', function ($routes): void { $routes->group('(:num)', static function ($routes): void {
$routes->get('/', 'UserController::view/$1', [ $routes->get('/', 'UserController::view/$1', [
'as' => 'user-view', 'as' => 'user-view',
'filter' => 'permission:users-view', 'filter' => 'permission:users-view',
@ -746,9 +725,8 @@ $routes->group(
]); ]);
}); });
}); });
// My account // My account
$routes->group('my-account', function ($routes): void { $routes->group('my-account', static function ($routes): void {
$routes->get('/', 'MyAccountController', [ $routes->get('/', 'MyAccountController', [
'as' => 'my-account', 'as' => 'my-account',
]); ]);

View File

@ -81,7 +81,7 @@ class ContributorController extends BaseController
$users = (new UserModel())->findAll(); $users = (new UserModel())->findAll();
$userOptions = array_reduce( $userOptions = array_reduce(
$users, $users,
function ($result, $user) { static function ($result, $user) {
$result[$user->id] = $user->username; $result[$user->id] = $user->username;
return $result; return $result;
}, },
@ -91,7 +91,7 @@ class ContributorController extends BaseController
$roles = (new GroupModel())->getContributorRoles(); $roles = (new GroupModel())->getContributorRoles();
$roleOptions = array_reduce( $roleOptions = array_reduce(
$roles, $roles,
function ($result, $role) { static function ($result, $role) {
$result[$role->id] = lang('Contributor.roles.' . $role->name); $result[$role->id] = lang('Contributor.roles.' . $role->name);
return $result; return $result;
}, },
@ -135,7 +135,7 @@ class ContributorController extends BaseController
$roles = (new GroupModel())->getContributorRoles(); $roles = (new GroupModel())->getContributorRoles();
$roleOptions = array_reduce( $roleOptions = array_reduce(
$roles, $roles,
function ($result, $role) { static function ($result, $role) {
$result[$role->id] = lang('Contributor.roles.' . $role->name); $result[$role->id] = lang('Contributor.roles.' . $role->name);
return $result; return $result;
}, },

View File

@ -120,7 +120,7 @@ class UserController extends BaseController
$roles = (new GroupModel())->getUserRoles(); $roles = (new GroupModel())->getUserRoles();
$roleOptions = array_reduce( $roleOptions = array_reduce(
$roles, $roles,
function ($result, $role) { static function ($result, $role) {
$result[$role->name] = lang('User.roles.' . $role->name); $result[$role->name] = lang('User.roles.' . $role->name);
return $result; return $result;
}, },

View File

@ -24,8 +24,8 @@ $routes->addPlaceholder(
$routes->group('', [ $routes->group('', [
'namespace' => 'Modules\Analytics\Controllers', 'namespace' => 'Modules\Analytics\Controllers',
], function ($routes): void { ], static function ($routes): void {
$routes->group(config('Analytics')->gateway . '/(:num)/(:class)', function ($routes): void { $routes->group(config('Analytics')->gateway . '/(:num)/(:class)', static function ($routes): void {
$routes->get('/', 'AnalyticsController::getData/$1/$2', [ $routes->get('/', 'AnalyticsController::getData/$1/$2', [
'as' => 'analytics-full-data', 'as' => 'analytics-full-data',
'filter' => config('Analytics') 'filter' => config('Analytics')
@ -33,13 +33,11 @@ $routes->group('', [
'analytics-full-data' 'analytics-full-data'
], ],
]); ]);
$routes->get('(:filter)', 'AnalyticsController::getData/$1/$2/$3', [ $routes->get('(:filter)', 'AnalyticsController::getData/$1/$2/$3', [
'as' => 'analytics-data', 'as' => 'analytics-data',
'filter' => config('Analytics') 'filter' => config('Analytics')
->routeFilters['analytics-data'], ->routeFilters['analytics-data'],
]); ]);
$routes->get( $routes->get(
'(:filter)/(:num)', '(:filter)/(:num)',
'AnalyticsController::getData/$1/$2/$3/$4', 'AnalyticsController::getData/$1/$2/$3/$4',
@ -52,11 +50,9 @@ $routes->group('', [
], ],
); );
}); });
$routes->get(config('Analytics')->gateway . '/(:class)/(:filter)', 'AnalyticsController::getData/$1/$2', [ $routes->get(config('Analytics')->gateway . '/(:class)/(:filter)', 'AnalyticsController::getData/$1/$2', [
'as' => 'analytics-data-instance', 'as' => 'analytics-data-instance',
]); ]);
// Route for podcast audio file analytics (/audio/pack(podcast_id,episode_id,bytes_threshold,filesize,duration,date)/podcast_folder/filename.mp3) // Route for podcast audio file analytics (/audio/pack(podcast_id,episode_id,bytes_threshold,filesize,duration,date)/podcast_folder/filename.mp3)
$routes->head( $routes->head(
'audio/(:base64)/(:any)', 'audio/(:base64)/(:any)',

View File

@ -13,7 +13,7 @@ $routes->group(
'namespace' => 'Modules\Api\Rest\V1\Controllers', 'namespace' => 'Modules\Api\Rest\V1\Controllers',
'filter' => 'rest-api', 'filter' => 'rest-api',
], ],
function ($routes): void { static function ($routes): void {
$routes->get('/', 'PodcastController::list'); $routes->get('/', 'PodcastController::list');
$routes->get('(:num)', 'PodcastController::view/$1'); $routes->get('(:num)', 'PodcastController::view/$1');
$routes->get('(:any)', 'ExceptionController::notFound'); $routes->get('(:any)', 'ExceptionController::notFound');

View File

@ -23,7 +23,7 @@ class PodcastController extends Controller
public function list(): Response public function list(): Response
{ {
$data = (new PodcastModel())->findAll(); $data = (new PodcastModel())->findAll();
array_map(function ($podcast): void { array_map(static function ($podcast): void {
$podcast->feed_url = $podcast->getFeedUrl(); $podcast->feed_url = $podcast->getFeedUrl();
}, $data); }, $data);
return $this->respond($data); return $this->respond($data);

View File

@ -15,7 +15,7 @@ $routes->group(
[ [
'namespace' => 'Modules\Auth\Controllers', 'namespace' => 'Modules\Auth\Controllers',
], ],
function ($routes): void { static function ($routes): void {
// Login/out // Login/out
$routes->get('login', 'AuthController::login', [ $routes->get('login', 'AuthController::login', [
'as' => 'login', 'as' => 'login',
@ -24,13 +24,11 @@ $routes->group(
$routes->get('logout', 'AuthController::logout', [ $routes->get('logout', 'AuthController::logout', [
'as' => 'logout', 'as' => 'logout',
]); ]);
// Registration // Registration
$routes->get('register', 'AuthController::register', [ $routes->get('register', 'AuthController::register', [
'as' => 'register', 'as' => 'register',
]); ]);
$routes->post('register', 'AuthController::attemptRegister'); $routes->post('register', 'AuthController::attemptRegister');
// Activation // Activation
$routes->get('activate-account', 'AuthController::activateAccount', [ $routes->get('activate-account', 'AuthController::activateAccount', [
'as' => 'activate-account', 'as' => 'activate-account',
@ -42,7 +40,6 @@ $routes->group(
'as' => 'resend-activate-account', 'as' => 'resend-activate-account',
], ],
); );
// Forgot/Resets // Forgot/Resets
$routes->get('forgot', 'AuthController::forgotPassword', [ $routes->get('forgot', 'AuthController::forgotPassword', [
'as' => 'forgot', 'as' => 'forgot',
@ -52,7 +49,6 @@ $routes->group(
'as' => 'reset-password', 'as' => 'reset-password',
]); ]);
$routes->post('reset-password', 'AuthController::attemptReset'); $routes->post('reset-password', 'AuthController::attemptReset');
// interacting as an actor // interacting as an actor
$routes->post('interact-as-actor', 'AuthController::attemptInteractAsActor', [ $routes->post('interact-as-actor', 'AuthController::attemptInteractAsActor', [
'as' => 'interact-as-actor', 'as' => 'interact-as-actor',

View File

@ -23,19 +23,17 @@ $routes->addPlaceholder('postAction', '\bfavourite|\breblog|\breply');
$routes->group('', [ $routes->group('', [
'namespace' => 'Modules\Fediverse\Controllers', 'namespace' => 'Modules\Fediverse\Controllers',
], function ($routes): void { ], static function ($routes): void {
// webfinger // webfinger
$routes->get('.well-known/webfinger', 'WebFingerController', [ $routes->get('.well-known/webfinger', 'WebFingerController', [
'as' => 'webfinger', 'as' => 'webfinger',
]); ]);
// nodeInfo2 // nodeInfo2
$routes->get('.well-known/x-nodeinfo2', 'NodeInfo2Controller', [ $routes->get('.well-known/x-nodeinfo2', 'NodeInfo2Controller', [
'as' => 'nodeInfo2', 'as' => 'nodeInfo2',
]); ]);
// Actor // Actor
$routes->group('@(:actorUsername)', function ($routes): void { $routes->group('@(:actorUsername)', static function ($routes): void {
// Actor // Actor
$routes->get('/', 'ActorController/$1', [ $routes->get('/', 'ActorController/$1', [
'as' => 'actor', 'as' => 'actor',
@ -60,20 +58,16 @@ $routes->group('', [
'as' => 'activity', 'as' => 'activity',
]); ]);
}); });
// Post // Post
$routes->post('posts/new', 'PostController::attemptCreate/$1', [ $routes->post('posts/new', 'PostController::attemptCreate/$1', [
'as' => 'post-attempt-create', 'as' => 'post-attempt-create',
]); ]);
$routes->get('posts/(:uuid)', 'PostController/$1', [ $routes->get('posts/(:uuid)', 'PostController/$1', [
'as' => 'post', 'as' => 'post',
]); ]);
$routes->get('posts/(:uuid)/replies', 'PostController/$1', [ $routes->get('posts/(:uuid)/replies', 'PostController/$1', [
'as' => 'post-replies', 'as' => 'post-replies',
]); ]);
$routes->post( $routes->post(
'posts/(:uuid)/remote/(:postAction)', 'posts/(:uuid)/remote/(:postAction)',
'PostController::attemptRemoteAction/$1/$2/$3', 'PostController::attemptRemoteAction/$1/$2/$3',
@ -81,7 +75,6 @@ $routes->group('', [
'as' => 'post-attempt-remote-action', 'as' => 'post-attempt-remote-action',
], ],
); );
// Blocking actors and domains // Blocking actors and domains
$routes->post( $routes->post(
'fediverse-block-actor', 'fediverse-block-actor',
@ -90,7 +83,6 @@ $routes->group('', [
'as' => 'fediverse-attempt-block-actor', 'as' => 'fediverse-attempt-block-actor',
], ],
); );
$routes->post( $routes->post(
'fediverse-block-domain', 'fediverse-block-domain',
'BlockController::attemptBlockDomain', 'BlockController::attemptBlockDomain',
@ -98,7 +90,6 @@ $routes->group('', [
'as' => 'fediverse-attempt-block-domain', 'as' => 'fediverse-attempt-block-domain',
], ],
); );
$routes->post( $routes->post(
'fediverse-unblock-actor', 'fediverse-unblock-actor',
'BlockController::attemptUnblockActor', 'BlockController::attemptUnblockActor',
@ -106,7 +97,6 @@ $routes->group('', [
'as' => 'fediverse-attempt-unblock-actor', 'as' => 'fediverse-attempt-unblock-actor',
], ],
); );
$routes->post( $routes->post(
'fediverse-unblock-domain', 'fediverse-unblock-domain',
'BlockController::attemptUnblockDomain', 'BlockController::attemptUnblockDomain',
@ -114,6 +104,5 @@ $routes->group('', [
'as' => 'fediverse-attempt-unblock-domain', 'as' => 'fediverse-attempt-unblock-domain',
], ],
); );
$routes->cli('scheduled-activities', 'SchedulerController::activity'); $routes->cli('scheduled-activities', 'SchedulerController::activity');
}); });

View File

@ -16,10 +16,7 @@ namespace Modules\Fediverse\Core;
abstract class AbstractObject abstract class AbstractObject
{ {
/** public function set(string $property, mixed $value): static
* @param mixed $value
*/
public function set(string $property, $value): static
{ {
$this->{$property} = $value; $this->{$property} = $value;
@ -45,7 +42,7 @@ abstract class AbstractObject
} }
// removes all NULL, FALSE and Empty Strings but leaves 0 (zero) values // removes all NULL, FALSE and Empty Strings but leaves 0 (zero) values
return array_filter($array, function ($value): bool { return array_filter($array, static function ($value): bool {
return $value !== null && $value !== false && $value !== ''; return $value !== null && $value !== false && $value !== '';
}); });
} }

View File

@ -362,17 +362,14 @@ if (! function_exists('linkify')) {
$text = match ($protocol) { $text = match ($protocol) {
'http', 'https' => preg_replace_callback( 'http', 'https' => preg_replace_callback(
'~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', '~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
function (array $match) use ($protocol, &$links) { static function (array $match) use ($protocol, &$links) {
if ($match[1] !== '' && $match[1] !== '0') { if ($match[1] !== '' && $match[1] !== '0') {
$protocol = $match[1]; $protocol = $match[1];
} }
$link = $match[2] ?: $match[3]; $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,
@ -391,7 +388,7 @@ if (! function_exists('linkify')) {
), ),
'handle' => preg_replace_callback( '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]))?~', '~(?<!\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) { static function ($match) use (&$links) {
// check if host is set and look for actor in database // check if host is set and look for actor in database
if (isset($match['host'])) { if (isset($match['host'])) {
if ( if (
@ -449,7 +446,7 @@ if (! function_exists('linkify')) {
'~' . '~' .
preg_quote($protocol, '~') . preg_quote($protocol, '~') .
'://([^\s<]+?)(?<![\.,:])~i', '://([^\s<]+?)(?<![\.,:])~i',
function (array $match) use ($protocol, &$links) { static function (array $match) use ($protocol, &$links) {
return '<' . return '<' .
array_push( array_push(
$links, $links,
@ -472,7 +469,7 @@ if (! function_exists('linkify')) {
// Insert all links // Insert all links
return preg_replace_callback( return preg_replace_callback(
'~<(\d+)>~', '~<(\d+)>~',
function ($match) use (&$links) { static function ($match) use (&$links) {
return $links[$match[1] - 1]; return $links[$match[1] - 1];
}, },
$text, $text,

View File

@ -13,7 +13,7 @@ $routes->group(
[ [
'namespace' => 'Modules\Install\Controllers', 'namespace' => 'Modules\Install\Controllers',
], ],
function ($routes): void { static function ($routes): void {
$routes->get('/', 'InstallController', [ $routes->get('/', 'InstallController', [
'as' => 'install', 'as' => 'install',
]); ]);

View File

@ -121,10 +121,12 @@ class InstallController extends Controller
if ( if (
$db->tableExists('users') && $db->tableExists('users') &&
(new UserModel())->countAll() > 0 (new UserModel())->countAll() > 0
) { ) {
// 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
@ -355,7 +357,7 @@ class InstallController extends Controller
$replaced = false; $replaced = false;
$keyVal = $key . '="' . $value . '"' . PHP_EOL; $keyVal = $key . '="' . $value . '"' . PHP_EOL;
$envData = array_map( $envData = array_map(
function ($line) use ($key, $keyVal, &$replaced) { static function ($line) use ($key, $keyVal, &$replaced) {
if (str_starts_with($line, $key)) { if (str_starts_with($line, $key)) {
$replaced = true; $replaced = true;
return $keyVal; return $keyVal;

View File

@ -16,6 +16,6 @@ $routes = service('routes');
$routes->group('', [ $routes->group('', [
'namespace' => 'Modules\WebSub\Controllers', 'namespace' => 'Modules\WebSub\Controllers',
], function ($routes): void { ], static function ($routes): void {
$routes->cli('scheduled-websub-publish', 'WebSubController::publish'); $routes->cli('scheduled-websub-publish', 'WebSubController::publish');
}); });

View File

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

View File

@ -13,7 +13,7 @@ use Rector\Core\ValueObject\PhpVersion;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php80\Rector\ClassMethod\OptionalParametersAfterRequiredRector; use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Set\ValueObject\SetList; use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void { return static function (RectorConfig $rectorConfig): void {
@ -42,12 +42,13 @@ return static function (RectorConfig $rectorConfig): void {
// auto import fully qualified class names // auto import fully qualified class names
$rectorConfig->importNames(); $rectorConfig->importNames();
// TODO: add parallel run
// $rectorConfig->parallel();
$rectorConfig->phpVersion(PhpVersion::PHP_80); $rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->skip([ $rectorConfig->skip([
// .mp3 files were somehow processed by rector, so skip all media files
__DIR__ . '/public/media/*',
__DIR__ . '/app/Views/errors/*', __DIR__ . '/app/Views/errors/*',
// skip specific generated files // skip specific generated files
@ -59,6 +60,7 @@ return static function (RectorConfig $rectorConfig): void {
EncapsedStringsToSprintfRector::class, EncapsedStringsToSprintfRector::class,
UnSpreadOperatorRector::class, UnSpreadOperatorRector::class,
ExplicitMethodCallOverMagicGetSetRector::class, ExplicitMethodCallOverMagicGetSetRector::class,
RemoveExtraParametersRector::class,
// skip rule in specific directory // skip rule in specific directory
StringClassNameToClassConstantRector::class => [ StringClassNameToClassConstantRector::class => [
@ -69,9 +71,6 @@ return static function (RectorConfig $rectorConfig): void {
__DIR__ . '/app/Language/*', __DIR__ . '/app/Language/*',
__DIR__ . '/modules/*/Language/*', __DIR__ . '/modules/*/Language/*',
], ],
OptionalParametersAfterRequiredRector::class => [
__DIR__ . '/app/Validation',
],
NewlineAfterStatementRector::class => [ NewlineAfterStatementRector::class => [
__DIR__ . '/app/Views', __DIR__ . '/app/Views',