Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Avoid PHP 8.0 warnings #238

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Hooks/DataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function processDatamap_afterDatabaseOperations($status, $table, $id, arr
->execute()
->fetch();
if (!empty($record)) {
$timestamp = (int) (!empty($record['publish_date']) ? $record['publish_date'] : time());
$timestamp = (int) (!empty($record['publish_date'] ?? 0) ? $record['publish_date'] : time());
$queryBuilder
->update($table)
->set('publish_date', $timestamp)
Expand Down
2 changes: 1 addition & 1 deletion Classes/Hooks/PageLayoutHeaderHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function drawHeader()
$pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(Permission::PAGE_SHOW));

// Early exit for non-blog pages
if ($pageInfo['doktype'] !== Constants::DOKTYPE_BLOG_POST) {
if (($pageInfo['doktype'] ?? 0) !== Constants::DOKTYPE_BLOG_POST) {
return '';
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Notification/NotificationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct()
{
$notificationRegistry = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['Blog']['notificationRegistry'] ?? [];
foreach ($notificationRegistry as $notificationId => $visitorClassNames) {
if (!\is_array($this->visitorsRegistry[$notificationId])) {
if (!\is_array($this->visitorsRegistry[$notificationId] ?? null)) {
$this->visitorsRegistry[$notificationId] = [];
}
foreach ($visitorClassNames as $visitorClassName) {
Expand All @@ -40,7 +40,7 @@ public function __construct()
public function notify(NotificationInterface $notification): void
{
$notificationId = $notification->getNotificationId();
if (\is_array($this->visitorsRegistry[$notificationId])) {
if (\is_array($this->visitorsRegistry[$notificationId] ?? null)) {
foreach ($this->visitorsRegistry[$notificationId] as $visitorClassName) {
$instance = GeneralUtility::makeInstance($visitorClassName);
if ($instance instanceof ProcessorInterface) {
Expand Down
4 changes: 2 additions & 2 deletions Classes/Utility/ArchiveUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public static function extractDataFromPosts(array $data): array
{
$archiveData = [];
foreach ($data as $result) {
if (empty($archiveData[$result['year']])) {
if (empty($archiveData[$result['year'] ?? null])) {
$archiveData[$result['year']] = [];
}
$dateTime = new \DateTimeImmutable(sprintf('%d-%d-1', (int)$result['year'], (int)$result['month']));
$dateTime = new \DateTimeImmutable(sprintf('%d-%d-1', (int)($result['year'] ?? 0), (int)($result['month'] ?? 0)));
$result['timestamp'] = $dateTime->getTimestamp();
$archiveData[$result['year']][] = $result;
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/sys_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'foreign_table_where' => '' .
' AND sys_category.record_type = ' . (string) \T3G\AgencyPack\Blog\Constants::CATEGORY_TYPE_BLOG . ' ' .
' AND sys_category.pid = ###CURRENT_PID### ' .
$GLOBALS['TCA']['pages']['columns']['categories']['config']['foreign_table_where']
($GLOBALS['TCA']['pages']['columns']['categories']['config']['foreign_table_where'] ?? '')
]
]
];
Expand Down