Skip to content

Commit 7f82b38

Browse files
committed
Add PHP 8.4 support. Remove PHP 7.* support.
1 parent 0c610c8 commit 7f82b38

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

classes/Internal/Data/Models/ForumCategories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getList(): \IvoPetkov\DataList
5555
{
5656
if (!isset(self::$cache['list'])) {
5757
$list = \BearCMS\Internal\Data::getList('bearcms/forums/categories/category/');
58-
array_walk($list, function (&$value) {
58+
array_walk($list, function (&$value): void {
5959
$value = $this->makeForumCategoryFromRawData($value);
6060
});
6161

classes/Internal/Data/Models/ForumPosts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function get(string $id): ?\BearCMS\Internal\Data\Models\ForumPost
6363
public function getList()
6464
{
6565
$list = \BearCMS\Internal\Data::getList('bearcms/forums/posts/post/');
66-
array_walk($list, function (&$value) {
66+
array_walk($list, function (&$value): void {
6767
$value = $this->makeForumPostFromRawData($value);
6868
});
6969
return new \IvoPetkov\DataList($list);

classes/Internal/ForumsUtilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static function getSlug(string $postID, string $text): string
4444
static function getIDFromSlug(string $slug): string
4545
{
4646
$temp = explode('-', $slug);
47-
return $temp[sizeof($temp) - 1];
47+
return $temp[count($temp) - 1];
4848
}
4949

5050
}

components/bearcmsForumPostsElement/forumPostRepliesList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
return implode('', $newTextParts);
5959
};
6060

61-
$renderItem = function($reply) use ($app, $urlsToHTML) {
61+
$renderItem = function($reply) use ($app, $urlsToHTML): void {
6262
$statusText = '';
6363
if ($reply->status === 'pendingApproval') {
6464
$statusText = __('bearcms.forumPosts.pending approval') . ', ';

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": "7.1.*|7.2.*|7.3.*|7.4.*|8.0.*|8.1.*|8.2.*|8.3.*",
19+
"php": "8.0.*|8.1.*|8.2.*|8.3.*|8.4.*",
2020
"bearcms/bearframework-addon": "^1.83",
2121
"bearframework/localization-addon": "1.*",
2222
"ivopetkov/html-server-components-bearframework-addon": "1.*",

index.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
$app = App::get();
1414

1515
$app->bearCMS->addons
16-
->register('bearcms/forums-addon', function (\BearCMS\Addons\Addon $addon) use ($app) {
17-
$addon->initialize = function (array $options) use ($app) {
16+
->register('bearcms/forums-addon', function (\BearCMS\Addons\Addon $addon) use ($app): void {
17+
$addon->initialize = function (array $options) use ($app): void {
1818
$forumPagesPathPrefix = isset($options['forumPagesPathPrefix']) ? $options['forumPagesPathPrefix'] : '/f/';
1919

2020
$context = $app->contexts->get(__DIR__);
@@ -94,7 +94,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
9494
return function_exists('mb_strlen') ? mb_strlen($string) : strlen($string);
9595
};
9696

97-
$substr = function (string $string, int $start, int $length = null) {
97+
$substr = function (string $string, int $start, ?int $length = null) {
9898
return function_exists('mb_substr') ? mb_substr($string, $start, $length) : substr($string, $start, $length);
9999
};
100100

@@ -131,7 +131,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
131131
}
132132
]);
133133

134-
Internal\Sitemap::addSource(function (Internal\Sitemap\Sitemap $sitemap) use ($app) {
134+
Internal\Sitemap::addSource(function (Internal\Sitemap\Sitemap $sitemap) use ($app): void {
135135
$forumPosts = new Internal\Data\Models\ForumPosts();
136136
$posts = $forumPosts->getList()
137137
->filter(function ($forumPost) {
@@ -185,7 +185,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
185185
}
186186
});
187187

188-
Internal\Themes::$elementsOptions['forumPosts'] = ['v2', function ($options, $idPrefix, $parentSelector, $context, $details) {
188+
Internal\Themes::$elementsOptions['forumPosts'] = ['v2', function ($options, $idPrefix, $parentSelector, $context, $details): void {
189189
$isElementContext = $context === Internal\Themes::OPTIONS_CONTEXT_ELEMENT;
190190
if ($isElementContext) {
191191
$optionsGroup = $options;
@@ -287,7 +287,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
287287
}
288288
}];
289289

290-
Internal\Themes::$pagesOptions['forums'] = function ($options, array $details = []) {
290+
Internal\Themes::$pagesOptions['forums'] = function ($options, array $details = []): void {
291291

292292
$groupForumPostPage = $options->addGroup(__("bearcms.themes.options.Forum post page"));
293293

@@ -439,7 +439,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
439439
}
440440
});
441441

442-
Internal\ServerCommands::add('forumPostSetStatus', function (array $data) {
442+
Internal\ServerCommands::add('forumPostSetStatus', function (array $data): void {
443443
Internal\Data\Utilities\ForumPosts::setStatus($data['forumPostID'], $data['status']);
444444
});
445445

@@ -483,12 +483,12 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
483483
return null;
484484
});
485485

486-
Internal\ServerCommands::add('forumPostReplySetStatus', function (array $data) use (&$forumPostsRepliesListCache) {
486+
Internal\ServerCommands::add('forumPostReplySetStatus', function (array $data) use (&$forumPostsRepliesListCache): void {
487487
Internal\Data\Utilities\ForumPostsReplies::setStatus($data['forumPostID'], $data['replyID'], $data['status']);
488488
$forumPostsRepliesListCache = null;
489489
});
490490

491-
Internal\ServerCommands::add('forumPostReplyDelete', function (array $data) use (&$forumPostsRepliesListCache) {
491+
Internal\ServerCommands::add('forumPostReplyDelete', function (array $data) use (&$forumPostsRepliesListCache): void {
492492
Internal\Data\Utilities\ForumPostsReplies::deleteReplyForever($data['forumPostID'], $data['replyID']);
493493
$forumPostsRepliesListCache = null;
494494
});
@@ -509,7 +509,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
509509

510510
if (Internal\Config::hasFeature('NOTIFICATIONS')) {
511511
$app->tasks
512-
->define('bearcms-send-new-forum-post-notification', function ($data) {
512+
->define('bearcms-send-new-forum-post-notification', function ($data): void {
513513
$forumPostID = $data['forumPostID'];
514514
$forumPosts = new Internal\Data\Models\ForumPosts();
515515
$forumPost = $forumPosts->get($forumPostID);
@@ -521,7 +521,7 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
521521
Internal\Data::sendNotification('forum-posts', $forumPost->status, $profile->name, $forumPost->title, $pendingApprovalCount);
522522
}
523523
})
524-
->define('bearcms-send-new-forum-post-reply-notification', function ($data) {
524+
->define('bearcms-send-new-forum-post-reply-notification', function ($data): void {
525525
$forumPostID = $data['forumPostID'];
526526
$forumPostReplyID = $data['forumPostReplyID'];
527527
$forumPostsReplies = new Internal\Data\Models\ForumPostsReplies();
@@ -540,13 +540,13 @@ function (App\Request $request) use ($app, $context, $forumPagesPathPrefix) {
540540
}
541541

542542
$app->clientPackages
543-
->add('-bearcms-forums-element', function (IvoPetkov\BearFrameworkAddons\ClientPackage $package) {
543+
->add('-bearcms-forums-element', function (IvoPetkov\BearFrameworkAddons\ClientPackage $package): void {
544544
//$js = file_get_contents(__DIR__ . '/dev/forumPostsElement.js');
545545
$js = include __DIR__ . '/assets/forumPostsElement.min.js.php';
546546
$package->addJSCode($js);
547547
$package->embedPackage('modalWindows');
548548
})
549-
->add('-bearcms-forums-element-reply', function (IvoPetkov\BearFrameworkAddons\ClientPackage $package) {
549+
->add('-bearcms-forums-element-reply', function (IvoPetkov\BearFrameworkAddons\ClientPackage $package): void {
550550
//$js = file_get_contents(__DIR__ . '/dev/forumPostReply.js');
551551
$js = include __DIR__ . '/assets/forumPostReply.min.js.php';
552552
$package->addJSCode($js);

0 commit comments

Comments
 (0)