Skip to content
Snippets Groups Projects
Commit 80fcb757 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

prevent php8 warnings, fixes #2279

Closes #2279

Merge request studip/studip!1504
parent 7f3db492
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
...@@ -26,6 +26,8 @@ class Instance extends SchemaProvider ...@@ -26,6 +26,8 @@ class Instance extends SchemaProvider
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @param \Courseware\Instance $resource
*/ */
public function getAttributes($resource, ContextInterface $context): iterable public function getAttributes($resource, ContextInterface $context): iterable
{ {
......
...@@ -284,7 +284,11 @@ class Instance ...@@ -284,7 +284,11 @@ class Instance
*/ */
public function isValidCertificateSettings($certificateSettings): bool public function isValidCertificateSettings($certificateSettings): bool
{ {
return (int) $certificateSettings['threshold'] >= 0 && (int) $certificateSettings['threshold'] <= 100; return !isset($certificateSettings['threshold'])
|| (
$certificateSettings['threshold'] >= 0
&& $certificateSettings['threshold'] <= 100
);
} }
private function validateCertificateSettings($certificateSettings): void private function validateCertificateSettings($certificateSettings): void
...@@ -335,7 +339,7 @@ class Instance ...@@ -335,7 +339,7 @@ class Instance
*/ */
public function isValidReminderSettings($reminderSettings): bool public function isValidReminderSettings($reminderSettings): bool
{ {
$valid = in_array($reminderSettings['interval'], [0, 7, 14, 30, 90, 180, 365]); $valid = in_array($reminderSettings['interval'] ?? 0, [0, 7, 14, 30, 90, 180, 365]);
return $valid; return $valid;
} }
...@@ -388,7 +392,7 @@ class Instance ...@@ -388,7 +392,7 @@ class Instance
*/ */
public function isValidResetProgressSettings($resetProgressSettings): bool public function isValidResetProgressSettings($resetProgressSettings): bool
{ {
$valid = in_array($resetProgressSettings['interval'], [0, 14, 30, 90, 180, 365]); $valid = in_array($resetProgressSettings['interval'] ?? 0, [0, 14, 30, 90, 180, 365]);
return $valid; return $valid;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment