ENH PHP 8.1 compatibility

This commit is contained in:
Steve Boyd 2022-04-13 10:23:56 +12:00
parent 5e313dd7fc
commit 856660192b
4 changed files with 12 additions and 12 deletions

View File

@ -132,13 +132,13 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$familyIDs = $group->collateFamilyIDs();
if (is_array($familyIDs)) {
$groupIDs = array_merge($groupIDs, array_values($familyIDs));
$groupIDs = array_merge($groupIDs, array_values($familyIDs ?? []));
}
}
array_unique($groupIDs);
array_unique($groupIDs ?? []);
if (count($groupIDs)) {
if (count($groupIDs ?? [])) {
$groupMembers = DataObject::get(Member::class)
->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")
->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"")
@ -676,7 +676,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$runHour = Config::inst()->get(ContentReviewNotificationJob::class, "first_run_hour");
$firstRunTime = date(
"Y-m-d H:i:s",
mktime($runHour, 0, 0, date("m"), date("d") + 1, date("y"))
mktime($runHour ?? 0, 0, 0, date("m"), date("d") + 1, date("y"))
);
singleton(QueuedJobService::class)->queueJob(

View File

@ -108,7 +108,7 @@ class ContentReviewNotificationJob extends AbstractQueuedJob implements QueuedJo
$nextRun = new ContentReviewNotificationJob();
$nextRunTime = mktime(
Config::inst()->get(__CLASS__, 'next_run_hour'),
Config::inst()->get(__CLASS__, 'next_run_hour') ?? 0,
Config::inst()->get(__CLASS__, 'next_run_minute'),
0,
date("m"),

View File

@ -77,8 +77,8 @@ class PagesDueForReviewReport extends Report
public function columns()
{
$linkBase = singleton(CMSPageEditController::class)->Link("show");
$linkPath = parse_url($linkBase, PHP_URL_PATH);
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
$linkPath = parse_url($linkBase ?? '', PHP_URL_PATH);
$linkQuery = parse_url($linkBase ?? '', PHP_URL_QUERY);
$fields = [
"Title" => [
@ -182,7 +182,7 @@ class PagesDueForReviewReport extends Report
// TODO Get value from DateField->dataValue() once we have access to form elements here
$nextReviewUnixSec = strtotime(
' + 1 day',
strtotime($params['ReviewDateBefore'])
strtotime($params['ReviewDateBefore'] ?? '')
);
$records = $records->where(
sprintf(
@ -209,7 +209,7 @@ class PagesDueForReviewReport extends Report
$virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class);
$records = $records->where(sprintf(
"\"SiteTree\".\"ClassName\" NOT IN ('%s')",
implode("','", array_values($virtualPageClasses))
implode("','", array_values($virtualPageClasses ?? []))
));
}

View File

@ -46,8 +46,8 @@ class PagesWithoutReviewScheduleReport extends Report
public function columns()
{
$linkBase = singleton(CMSPageEditController::class)->Link("show");
$linkPath = parse_url($linkBase, PHP_URL_PATH);
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
$linkPath = parse_url($linkBase ?? '', PHP_URL_PATH);
$linkQuery = parse_url($linkBase ?? '', PHP_URL_QUERY);
$fields = [
"Title" => [
@ -123,7 +123,7 @@ class PagesWithoutReviewScheduleReport extends Report
$virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class);
$records = $records->where(sprintf(
"\"SiteTree\".\"ClassName\" NOT IN ('%s')",
implode("','", array_values($virtualPageClasses))
implode("','", array_values($virtualPageClasses ?? []))
));
}