aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/classes/ActionMenu.php4
-rw-r--r--lib/classes/ConfigurationModel.php2
-rw-r--r--lib/classes/DataFieldEntry.php2
-rw-r--r--lib/classes/DataFieldI18NEntry.php2
-rw-r--r--lib/classes/DataFieldSelectboxEntry.php2
-rw-r--r--lib/classes/DataFieldSelectboxMultipleEntry.php2
-rw-r--r--lib/classes/Feedback.php8
-rw-r--r--lib/classes/FeedbackRange.php2
-rw-r--r--lib/classes/FilesSearch/FilesIndexManager.php8
-rw-r--r--lib/classes/FilesSearch/Filter.php2
-rw-r--r--lib/classes/FilesSearch/Query.php2
-rw-r--r--lib/classes/JsonApi/Errors/BadRequestException.php2
-rw-r--r--lib/classes/JsonApi/Errors/InternalServerError.php2
-rw-r--r--lib/classes/JsonApi/Errors/NotImplementedException.php2
-rw-r--r--lib/classes/JsonApi/Errors/UnprocessableEntityException.php2
-rw-r--r--lib/classes/JsonApi/Errors/UnsupportedRequestError.php2
-rw-r--r--lib/classes/JsonApi/JsonApiIntegration/QueryChecker.php18
-rw-r--r--lib/classes/JsonApi/Routes/Blubber/Authority.php2
-rw-r--r--lib/classes/JsonApi/Routes/Files/RoutesHelperTrait.php6
-rw-r--r--lib/classes/JsonApi/Routes/Messages/MessageCreate.php4
-rw-r--r--lib/classes/LTI13a/RegistrationManager.php4
-rw-r--r--lib/classes/MvvReplaceDataFieldsTrait.php2
-rw-r--r--lib/classes/Pagination.php2
-rw-r--r--lib/classes/Request.php2
-rw-r--r--lib/classes/ResponsiveHelper.php4
-rw-r--r--lib/classes/SQLUnionQuery.php2
-rw-r--r--lib/classes/SimpleCollection.php4
-rw-r--r--lib/classes/SimpleORMapCollection.php4
-rw-r--r--lib/classes/StoredUserData.php16
-rw-r--r--lib/classes/StudipMail.php2
-rw-r--r--lib/classes/TwoFactorAuth.php2
-rw-r--r--lib/classes/Visibility.php4
-rw-r--r--lib/classes/VueApp.php2
-rw-r--r--lib/classes/WidgetContainer.php2
-rw-r--r--lib/classes/ZipArchive.php2
-rw-r--r--lib/classes/admission/AdmissionRule.php2
-rw-r--r--lib/classes/assets/Storage.php2
-rw-r--r--lib/classes/forms/Form.php2
-rw-r--r--lib/classes/forms/Link.php4
-rw-r--r--lib/classes/sidebar/ButtonElement.php2
-rw-r--r--lib/classes/sidebar/LinkElement.php4
-rw-r--r--lib/classes/sidebar/LinksWidget.php2
-rw-r--r--lib/classes/sidebar/SearchWidget.php2
-rw-r--r--lib/cronjobs/courseware.php2
-rw-r--r--lib/exTpl/Context.php2
-rw-r--r--lib/exceptions/AccessDeniedException.php2
-rw-r--r--lib/exceptions/FeatureDisabledException.php2
-rw-r--r--lib/exceptions/InvalidSecurityTokenException.php2
-rw-r--r--lib/exceptions/MethodNotAllowedException.php2
-rw-r--r--lib/flexi/Template.php2
-rw-r--r--lib/language.inc.php2
-rw-r--r--lib/models/BlubberComment.php2
-rw-r--r--lib/models/BlubberGlobalThread.php2
-rw-r--r--lib/models/BlubberStatusgruppeThread.php2
-rw-r--r--lib/models/BlubberThread.php30
-rw-r--r--lib/models/ConsultationBlock.php2
-rw-r--r--lib/models/ConsultationSlot.php2
-rw-r--r--lib/models/Course.php4
-rw-r--r--lib/models/CourseMember.php2
-rw-r--r--lib/models/Courseware/Instance.php2
-rw-r--r--lib/models/Courseware/PeerReviewProcess.php2
-rw-r--r--lib/models/Courseware/StructuralElement.php8
-rw-r--r--lib/models/Courseware/Unit.php4
-rw-r--r--lib/models/Deputy.php6
-rw-r--r--lib/models/FeedbackElement.php6
-rw-r--r--lib/models/FileRef.php2
-rw-r--r--lib/models/Folder.php2
-rw-r--r--lib/models/LtiTool.php2
-rw-r--r--lib/models/OERReview.php4
-rw-r--r--lib/models/User.php2
-rw-r--r--lib/models/resources/Resource.php4
-rw-r--r--lib/resources/ResourceManager.php6
-rw-r--r--lib/trails/Exception.php2
73 files changed, 132 insertions, 132 deletions
diff --git a/lib/classes/ActionMenu.php b/lib/classes/ActionMenu.php
index 593e990..c101d44 100644
--- a/lib/classes/ActionMenu.php
+++ b/lib/classes/ActionMenu.php
@@ -125,7 +125,7 @@ class ActionMenu implements Stringable
* @param mixed $before Optional index to insert this link before the link with given index.
* @return static instance to allow chaining
*/
- public function addLink($url, $label = "", Icon $icon = null, array $attributes = [], $index = null, $before = null)
+ public function addLink($url, $label = "", ?Icon $icon = null, array $attributes = [], $index = null, $before = null)
{
if ($this->checkCondition()) {
if ($url instanceof StudipLink) {
@@ -194,7 +194,7 @@ class ActionMenu implements Stringable
* @param array $attributes Optional attributes to add to the <a> tag
* @return static instance to allow chaining
*/
- public function addButton($name, $label, Icon $icon = null, array $attributes = [])
+ public function addButton($name, $label, ?Icon $icon = null, array $attributes = [])
{
if ($this->checkCondition()) {
$this->actions[] = [
diff --git a/lib/classes/ConfigurationModel.php b/lib/classes/ConfigurationModel.php
index df9f7d6..70dc8fe 100644
--- a/lib/classes/ConfigurationModel.php
+++ b/lib/classes/ConfigurationModel.php
@@ -34,7 +34,7 @@ class ConfigurationModel
* @param string $limit_to Limit entries to certain range type
* @return array()
*/
- public static function searchConfiguration(Range $range = null)
+ public static function searchConfiguration(?Range $range = null)
{
$config = Config::get();
$allconfigs = [];
diff --git a/lib/classes/DataFieldEntry.php b/lib/classes/DataFieldEntry.php
index a5eb059..d8623f6 100644
--- a/lib/classes/DataFieldEntry.php
+++ b/lib/classes/DataFieldEntry.php
@@ -251,7 +251,7 @@ abstract class DataFieldEntry
* range id)
* @param mixed $value Value
*/
- public function __construct(DataField $datafield = null, $rangeID = '', $value = null)
+ public function __construct(?DataField $datafield = null, $rangeID = '', $value = null)
{
$this->model = $datafield;
$this->rangeID = $rangeID;
diff --git a/lib/classes/DataFieldI18NEntry.php b/lib/classes/DataFieldI18NEntry.php
index 63371c2..35dc234 100644
--- a/lib/classes/DataFieldI18NEntry.php
+++ b/lib/classes/DataFieldI18NEntry.php
@@ -26,7 +26,7 @@ abstract class DataFieldI18NEntry extends DataFieldEntry
* range id)
* @param mixed $value Value
*/
- public function __construct(DataField $datafield = null, $rangeID = '', $value = null)
+ public function __construct(?DataField $datafield = null, $rangeID = '', $value = null)
{
$this->model = $datafield;
diff --git a/lib/classes/DataFieldSelectboxEntry.php b/lib/classes/DataFieldSelectboxEntry.php
index bb2d321..585e21c 100644
--- a/lib/classes/DataFieldSelectboxEntry.php
+++ b/lib/classes/DataFieldSelectboxEntry.php
@@ -21,7 +21,7 @@ class DataFieldSelectboxEntry extends DataFieldEntry
* @param String $rangeID Range id
* @param mixed $value Value
*/
- public function __construct(DataField $struct = null, $range_id = '', $value = null)
+ public function __construct(?DataField $struct = null, $range_id = '', $value = null)
{
parent::__construct($struct, $range_id, $value);
diff --git a/lib/classes/DataFieldSelectboxMultipleEntry.php b/lib/classes/DataFieldSelectboxMultipleEntry.php
index 3abb373..6576aa1 100644
--- a/lib/classes/DataFieldSelectboxMultipleEntry.php
+++ b/lib/classes/DataFieldSelectboxMultipleEntry.php
@@ -19,7 +19,7 @@ class DataFieldSelectboxMultipleEntry extends DataFieldSelectboxEntry
* @param String $rangeID Range id
* @param mixed $value Value
*/
- public function __construct(DataField $datafield = null, $rangeID = '', $value = null)
+ public function __construct(?DataField $datafield = null, $rangeID = '', $value = null)
{
parent::__construct($datafield, $rangeID, $value);
diff --git a/lib/classes/Feedback.php b/lib/classes/Feedback.php
index 26dbf55..1f8f9fd 100644
--- a/lib/classes/Feedback.php
+++ b/lib/classes/Feedback.php
@@ -35,7 +35,7 @@ class Feedback
*
* @return boolean
*/
- public static function isActivated(string $course_id = null): bool
+ public static function isActivated(?string $course_id = null): bool
{
$course_id = $course_id ?? Context::getId();
$plugin_manager = PluginManager::getInstance();
@@ -54,7 +54,7 @@ class Feedback
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public static function hasAdminPerm($course_id, string $user_id = null): bool
+ public static function hasAdminPerm($course_id, ?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
$admin_perm_level = CourseConfig::get($course_id)->FEEDBACK_ADMIN_PERM;
@@ -73,7 +73,7 @@ class Feedback
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public static function hasCreatePerm($course_id, string $user_id = null): bool
+ public static function hasCreatePerm($course_id, ?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
$create_perm_level = CourseConfig::get($course_id)->FEEDBACK_CREATE_PERM;
@@ -91,7 +91,7 @@ class Feedback
*
* @return boolean
*/
- public static function hasRangeAccess($range_id, $range_type, string $user_id = null): bool
+ public static function hasRangeAccess($range_id, $range_type, ?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
$range = $range_type::find($range_id);
diff --git a/lib/classes/FeedbackRange.php b/lib/classes/FeedbackRange.php
index 863c197..8023c27 100644
--- a/lib/classes/FeedbackRange.php
+++ b/lib/classes/FeedbackRange.php
@@ -51,5 +51,5 @@ interface FeedbackRange
* @param string $user_id optional; use this ID instead of $GLOBALS['user']->id
* @return bool range object accessebility
*/
- public function isRangeAccessible(string $user_id = null): bool;
+ public function isRangeAccessible(?string $user_id = null): bool;
}
diff --git a/lib/classes/FilesSearch/FilesIndexManager.php b/lib/classes/FilesSearch/FilesIndexManager.php
index 23bac4e..0055b47 100644
--- a/lib/classes/FilesSearch/FilesIndexManager.php
+++ b/lib/classes/FilesSearch/FilesIndexManager.php
@@ -51,7 +51,7 @@ class FilesIndexManager
*
* @return int the number of seconds the indexing took
*/
- public static function sqlIndex(\FileRef $fileRef = null, array $options = [])
+ public static function sqlIndex(?\FileRef $fileRef = null, array $options = [])
{
if (isset($options['verbose'])) {
self::$verbose = $options['verbose'];
@@ -189,7 +189,7 @@ class FilesIndexManager
* @param FileRef $fileRef optional; if the index should be
* created for this FileRef only
*/
- private static function createIndex($sql, $params, \FileRef $fileRef = null)
+ private static function createIndex($sql, $params, ?\FileRef $fileRef = null)
{
$table = isset($fileRef) ? 'files_search_index' : 'files_search_index_temp';
$query = sprintf('INSERT INTO %s (file_ref_id, text, relevance) %s', $table, $sql);
@@ -240,7 +240,7 @@ class FilesIndexManager
* @param FileRef $fileRef optional; if the attributes should be
* filled for this FileRef only
*/
- private static function fillAttributes(\FileRef $fileRef = null)
+ private static function fillAttributes(?\FileRef $fileRef = null)
{
if (isset($fileRef)) {
$table = 'files_search_attributes';
@@ -282,7 +282,7 @@ class FilesIndexManager
DBManager::get()->execute($query, $where['params']);
}
- private static function fillIndex(\FileRef $fileRef = null)
+ private static function fillIndex(?\FileRef $fileRef = null)
{
if (isset($fileRef)) {
$whereCondition = 'WHERE file_refs.id = :filerefid';
diff --git a/lib/classes/FilesSearch/Filter.php b/lib/classes/FilesSearch/Filter.php
index eb82783..20944a2 100644
--- a/lib/classes/FilesSearch/Filter.php
+++ b/lib/classes/FilesSearch/Filter.php
@@ -91,7 +91,7 @@ class Filter
*
* @return Filter return `$this` for chaining
*/
- public function setSemester(\Semester $semester = null)
+ public function setSemester(?\Semester $semester = null)
{
$this->semester = $semester;
diff --git a/lib/classes/FilesSearch/Query.php b/lib/classes/FilesSearch/Query.php
index 6a1b33e..deebed4 100644
--- a/lib/classes/FilesSearch/Query.php
+++ b/lib/classes/FilesSearch/Query.php
@@ -33,7 +33,7 @@ class Query
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public function __construct(\User $user = null)
+ public function __construct(?\User $user = null)
{
$this->user = isset($user) ? $user : $GLOBALS['user'];
$this->error = false;
diff --git a/lib/classes/JsonApi/Errors/BadRequestException.php b/lib/classes/JsonApi/Errors/BadRequestException.php
index c09a96a..3ab92ae 100644
--- a/lib/classes/JsonApi/Errors/BadRequestException.php
+++ b/lib/classes/JsonApi/Errors/BadRequestException.php
@@ -13,7 +13,7 @@ class BadRequestException extends JsonApiException
/**
* TODO.
*/
- public function __construct($detail = null, array $source = null)
+ public function __construct($detail = null, ?array $source = null)
{
$error = new Error(null, null, null, 400, null, 'Bad Request', $detail, $source);
parent::__construct($error, 400);
diff --git a/lib/classes/JsonApi/Errors/InternalServerError.php b/lib/classes/JsonApi/Errors/InternalServerError.php
index ccff364..88626e1 100644
--- a/lib/classes/JsonApi/Errors/InternalServerError.php
+++ b/lib/classes/JsonApi/Errors/InternalServerError.php
@@ -13,7 +13,7 @@ class InternalServerError extends JsonApiException
/**
* TODO.
*/
- public function __construct($detail = null, array $source = null)
+ public function __construct($detail = null, ?array $source = null)
{
$error = new Error(null, null, null, 500, null, 'Internal Server Error', $detail, $source);
parent::__construct($error, 500);
diff --git a/lib/classes/JsonApi/Errors/NotImplementedException.php b/lib/classes/JsonApi/Errors/NotImplementedException.php
index d6f35a1..fabe1a0 100644
--- a/lib/classes/JsonApi/Errors/NotImplementedException.php
+++ b/lib/classes/JsonApi/Errors/NotImplementedException.php
@@ -13,7 +13,7 @@ class NotImplementedException extends JsonApiException
/**
* TODO.
*/
- public function __construct($detail = null, array $source = null)
+ public function __construct($detail = null, ?array $source = null)
{
$error = new Error(null, null, null, 501, null, 'Not Implemented Error', $detail, $source);
parent::__construct($error, 501);
diff --git a/lib/classes/JsonApi/Errors/UnprocessableEntityException.php b/lib/classes/JsonApi/Errors/UnprocessableEntityException.php
index 2af4d89..46d5ba7 100644
--- a/lib/classes/JsonApi/Errors/UnprocessableEntityException.php
+++ b/lib/classes/JsonApi/Errors/UnprocessableEntityException.php
@@ -13,7 +13,7 @@ class UnprocessableEntityException extends JsonApiException
/**
* TODO.
*/
- public function __construct($detail = null, array $source = null)
+ public function __construct($detail = null, ?array $source = null)
{
$error = new Error(null, null, null, 422, null, 'Unprocesssable Entity', $detail, $source);
parent::__construct($error, 422);
diff --git a/lib/classes/JsonApi/Errors/UnsupportedRequestError.php b/lib/classes/JsonApi/Errors/UnsupportedRequestError.php
index 3b8bcd5..41560d1 100644
--- a/lib/classes/JsonApi/Errors/UnsupportedRequestError.php
+++ b/lib/classes/JsonApi/Errors/UnsupportedRequestError.php
@@ -13,7 +13,7 @@ class UnsupportedRequestError extends JsonApiException
/**
* TODO.
*/
- public function __construct($detail = null, array $source = null)
+ public function __construct($detail = null, ?array $source = null)
{
$error = new Error(null, null, null, 403, null, 'Unsupported request.', $detail, $source);
parent::__construct($error, 403);
diff --git a/lib/classes/JsonApi/JsonApiIntegration/QueryChecker.php b/lib/classes/JsonApi/JsonApiIntegration/QueryChecker.php
index 692a8da..2d5c683 100644
--- a/lib/classes/JsonApi/JsonApiIntegration/QueryChecker.php
+++ b/lib/classes/JsonApi/JsonApiIntegration/QueryChecker.php
@@ -39,11 +39,11 @@ class QueryChecker
public function __construct(
bool $allowUnrecognized = true,
- array $includePaths = null,
- array $fieldSetTypes = null,
- array $sortParameters = null,
- array $pagingParameters = null,
- array $filteringParameters = null
+ ?array $includePaths = null,
+ ?array $fieldSetTypes = null,
+ ?array $sortParameters = null,
+ ?array $pagingParameters = null,
+ ?array $filteringParameters = null
) {
$this->includePaths = $includePaths;
$this->allowUnrecognized = $allowUnrecognized;
@@ -145,7 +145,7 @@ class QueryChecker
}
}
- private function getInvalidKeys(iterable $toCheck = null, iterable $allowed = null): array
+ private function getInvalidKeys(?iterable $toCheck = null, ?iterable $allowed = null): array
{
if (null === $toCheck || null === $allowed) {
return [];
@@ -157,7 +157,7 @@ class QueryChecker
));
}
- private function getInvalidValues(iterable $toCheck = null, iterable $allowed = null): array
+ private function getInvalidValues(?iterable $toCheck = null, ?iterable $allowed = null): array
{
if (null === $toCheck || null === $allowed) {
return [];
@@ -174,7 +174,7 @@ class QueryChecker
return is_array($input) ? $input : iterator_to_array($input);
}
- private function flip(array $array = null): ?array
+ private function flip(?array $array = null): ?array
{
return $array === null ? null : array_flip($array);
}
@@ -182,7 +182,7 @@ class QueryChecker
/**
* Check input fields against allowed.
*/
- private function getInvalidFields(iterable $fields = null): iterable
+ private function getInvalidFields(?iterable $fields = null): iterable
{
if ($this->fieldSetTypes !== null && $fields !== null) {
foreach ($fields as $type => $requestedFields) {
diff --git a/lib/classes/JsonApi/Routes/Blubber/Authority.php b/lib/classes/JsonApi/Routes/Blubber/Authority.php
index 5f56abf..bfec8da 100644
--- a/lib/classes/JsonApi/Routes/Blubber/Authority.php
+++ b/lib/classes/JsonApi/Routes/Blubber/Authority.php
@@ -49,7 +49,7 @@ class Authority
return self::userIsAuthor($user) && $resource->isWritable($user->id);
}
- public static function canIndexComments(User $user, BlubberThread $resource = null)
+ public static function canIndexComments(User $user, ?BlubberThread $resource = null)
{
return isset($resource)
? self::canShowBlubberThread($user, $resource)
diff --git a/lib/classes/JsonApi/Routes/Files/RoutesHelperTrait.php b/lib/classes/JsonApi/Routes/Files/RoutesHelperTrait.php
index 65d3b30..f4ccaf3 100644
--- a/lib/classes/JsonApi/Routes/Files/RoutesHelperTrait.php
+++ b/lib/classes/JsonApi/Routes/Files/RoutesHelperTrait.php
@@ -38,7 +38,7 @@ trait RoutesHelperTrait
}
}
- protected function validateFileRefResourceObject($json, \FileRef $fileRef = null)
+ protected function validateFileRefResourceObject($json, ?\FileRef $fileRef = null)
{
if (!self::array_has($json, 'data')) {
return 'Missing `data` member at document´s top level.';
@@ -83,7 +83,7 @@ trait RoutesHelperTrait
}
}
- protected function validateFolderAttributes($json, \FolderType $folder = null, $needsParent = false)
+ protected function validateFolderAttributes($json, ?\FolderType $folder = null, $needsParent = false)
{
// Attributes needed to create a new folder
if (!$folder) {
@@ -113,7 +113,7 @@ trait RoutesHelperTrait
}
}
- protected function validateFolderResourceObject($json, \FolderType $folder = null, $needsParent = false)
+ protected function validateFolderResourceObject($json, ?\FolderType $folder = null, $needsParent = false)
{
if ($err = $this->validateResourceIdentifier($json, FolderSchema::TYPE, null === $folder)) {
return $err;
diff --git a/lib/classes/JsonApi/Routes/Messages/MessageCreate.php b/lib/classes/JsonApi/Routes/Messages/MessageCreate.php
index f875d57..2db7b7b 100644
--- a/lib/classes/JsonApi/Routes/Messages/MessageCreate.php
+++ b/lib/classes/JsonApi/Routes/Messages/MessageCreate.php
@@ -121,8 +121,8 @@ class MessageCreate extends JsonApiController
array $recipients,
string $subject,
string $body,
- array $tags = null,
- string $answerTo = null
+ ?array $tags = null,
+ ?string $answerTo = null
) {
$messageBody = \Studip\Markup::purifyHtml($body);
diff --git a/lib/classes/LTI13a/RegistrationManager.php b/lib/classes/LTI13a/RegistrationManager.php
index 05bcc2e..cbd703c 100644
--- a/lib/classes/LTI13a/RegistrationManager.php
+++ b/lib/classes/LTI13a/RegistrationManager.php
@@ -62,7 +62,7 @@ class RegistrationManager implements RegistrationRepositoryInterface
}
#[\Override]
- public function findByPlatformIssuer(string $issuer, string $clientId = null): ?RegistrationInterface
+ public function findByPlatformIssuer(string $issuer, ?string $clientId = null): ?RegistrationInterface
{
//Only handle requests for registrations of this Stud.IP:
$platform_config = \Studip\LTI13a\PlatformManager::getPlatformConfiguration();
@@ -74,7 +74,7 @@ class RegistrationManager implements RegistrationRepositoryInterface
}
#[\Override]
- public function findByToolIssuer(string $issuer, string $clientId = null): ?RegistrationInterface
+ public function findByToolIssuer(string $issuer, ?string $clientId = null): ?RegistrationInterface
{
//Tool registrations are not supported at this moment.
return null;
diff --git a/lib/classes/MvvReplaceDataFieldsTrait.php b/lib/classes/MvvReplaceDataFieldsTrait.php
index fe0d5e6..e2a70fc 100644
--- a/lib/classes/MvvReplaceDataFieldsTrait.php
+++ b/lib/classes/MvvReplaceDataFieldsTrait.php
@@ -31,7 +31,7 @@ trait MvvReplaceDataFieldsTrait
*/
public function getReplacedValue(
string $field,
- string $abschnitt_id = null
+ ?string $abschnitt_id = null
): string
{
$abschnitt_id = $abschnitt_id ?? $this->replace_df_abschnitt_id;
diff --git a/lib/classes/Pagination.php b/lib/classes/Pagination.php
index 77105df..e1efdfe 100644
--- a/lib/classes/Pagination.php
+++ b/lib/classes/Pagination.php
@@ -157,7 +157,7 @@ class Pagination
* parameters)
* @return string html
*/
- public function asLinks(Closure $link_for = null)
+ public function asLinks(?Closure $link_for = null)
{
if ($this->getPageCount() <= 1) {
return '&nbsp;';
diff --git a/lib/classes/Request.php b/lib/classes/Request.php
index ae294ae..1b67728 100644
--- a/lib/classes/Request.php
+++ b/lib/classes/Request.php
@@ -199,7 +199,7 @@ class Request implements ArrayAccess, IteratorAggregate
*
* @return I18NString parameter value as string (if set), else NULL
*/
- public static function i18n(string $param, $default = null, Callable $op = null)
+ public static function i18n(string $param, $default = null, ?Callable $op = null)
{
$value = self::get($param, $default instanceof I18NString ? $default->original() : $default);
diff --git a/lib/classes/ResponsiveHelper.php b/lib/classes/ResponsiveHelper.php
index a65afbb..b894bad 100644
--- a/lib/classes/ResponsiveHelper.php
+++ b/lib/classes/ResponsiveHelper.php
@@ -90,7 +90,7 @@ class ResponsiveHelper
*
* @return array
*/
- public static function getNavigationObject(string $stored_hash = null): array
+ public static function getNavigationObject(?string $stored_hash = null): array
{
[$navigation, $activated] = self::getNavigationArray();
$hash = md5(json_encode($navigation));
@@ -113,7 +113,7 @@ class ResponsiveHelper
* @param String|null $cid Optional context ID
* @return Array containing the children (+ grandchildren...)
*/
- protected static function getChildren(Navigation $navigation, $path, &$activated = [], string $cid = null)
+ protected static function getChildren(Navigation $navigation, $path, &$activated = [], ?string $cid = null)
{
$children = [];
diff --git a/lib/classes/SQLUnionQuery.php b/lib/classes/SQLUnionQuery.php
index 6254b78..8587a42 100644
--- a/lib/classes/SQLUnionQuery.php
+++ b/lib/classes/SQLUnionQuery.php
@@ -66,7 +66,7 @@ class SQLUnionQuery
/**
* Fetches all rows from the combined query
*/
- public function fetchAll(callable $callable = null): array
+ public function fetchAll(?callable $callable = null): array
{
return DBManager::get()->fetchAll(
$this->getQuery(),
diff --git a/lib/classes/SimpleCollection.php b/lib/classes/SimpleCollection.php
index d44c042..a993a7c 100644
--- a/lib/classes/SimpleCollection.php
+++ b/lib/classes/SimpleCollection.php
@@ -444,7 +444,7 @@ class SimpleCollection extends StudipArrayObject
* @param ?integer $limit limit number of found records
* @return SimpleCollection<T> containing filtered elements
*/
- public function filter(callable $func = null, $limit = null)
+ public function filter(?callable $func = null, $limit = null)
{
$results = [];
$found = 0;
@@ -529,7 +529,7 @@ class SimpleCollection extends StudipArrayObject
* @param ?callable $group_func closure to aggregate grouped entries
* @return array assoc array
*/
- public function toGroupedArray($group_by = 'id', $only_these_fields = null, callable $group_func = null)
+ public function toGroupedArray($group_by = 'id', $only_these_fields = null, ?callable $group_func = null)
{
$result = [];
if (is_string($only_these_fields)) {
diff --git a/lib/classes/SimpleORMapCollection.php b/lib/classes/SimpleORMapCollection.php
index 440af38..d4989cc 100644
--- a/lib/classes/SimpleORMapCollection.php
+++ b/lib/classes/SimpleORMapCollection.php
@@ -80,7 +80,7 @@ class SimpleORMapCollection extends SimpleCollection
* @param ?array $options relationship options
* @param SimpleORMap|null $record related record
*/
- public function __construct(Closure $finder = null, array $options = null, SimpleORMap $record = null)
+ public function __construct(?Closure $finder = null, ?array $options = null, ?SimpleORMap $record = null)
{
$this->relation_options = $options;
$this->related_record = $record;
@@ -195,7 +195,7 @@ class SimpleORMapCollection extends SimpleCollection
* @param ?callable $group_func closure to aggregate grouped entries
* @return array assoc array
*/
- public function toGroupedArray($group_by = 'id', $only_these_fields = null, callable $group_func = null)
+ public function toGroupedArray($group_by = 'id', $only_these_fields = null, ?callable $group_func = null)
{
$result = [];
foreach ($this as $record) {
diff --git a/lib/classes/StoredUserData.php b/lib/classes/StoredUserData.php
index e18783a..3bd8700 100644
--- a/lib/classes/StoredUserData.php
+++ b/lib/classes/StoredUserData.php
@@ -55,7 +55,7 @@ class StoredUserData
* @param array $value Array containing the rows
* @param SimpleORMap $context Optional context
*/
- public function addTabularData($name, $key, array $value, SimpleORMap $context = null)
+ public function addTabularData($name, $key, array $value, ?SimpleORMap $context = null)
{
if ($value) {
$this->addData('tabular', compact('name', 'key', 'value'), $context);
@@ -69,7 +69,7 @@ class StoredUserData
* @param FileRef $fileref
* @param SimpleORMap $context Optional context
*/
- public function addFileRef(FileRef $fileref, SimpleORMap $context = null)
+ public function addFileRef(FileRef $fileref, ?SimpleORMap $context = null)
{
$filetype = $fileref->getFileType();
@@ -92,7 +92,7 @@ class StoredUserData
* @param string $path File path
* @param SimpleORMap $context Optional context
*/
- public function addFileAtPath($name, $path, SimpleORMap $context = null)
+ public function addFileAtPath($name, $path, ?SimpleORMap $context = null)
{
$this->addData('file', compact('name', 'path'), $context);
}
@@ -105,7 +105,7 @@ class StoredUserData
* @param string $contents File contents (text or binary)
* @param SimpleORMap $context Optional context
*/
- public function addFileWithContents($name, $contents, SimpleORMap $context = null)
+ public function addFileWithContents($name, $contents, ?SimpleORMap $context = null)
{
$this->addData('file', compact('name', 'contents'), $context);
}
@@ -117,7 +117,7 @@ class StoredUserData
* @param SimpleORMap $context Optional context
* @return array
*/
- public function getFileData(SimpleORMap $context = null)
+ public function getFileData(?SimpleORMap $context = null)
{
return $this->getData('file', $context);
}
@@ -129,7 +129,7 @@ class StoredUserData
* @param SimpleORMap $context Optional context
* @return array
*/
- public function getTabularData(SimpleORMap $context = null)
+ public function getTabularData(?SimpleORMap $context = null)
{
return $this->getData('tabular', $context);
}
@@ -142,7 +142,7 @@ class StoredUserData
* @param mixed $data
* @param SimpleORMap $context Optional context
*/
- protected function addData($type, $data, SimpleORMap $context = null)
+ protected function addData($type, $data, ?SimpleORMap $context = null)
{
if (!isset($this->data[$type])) {
throw new InvalidArgumentException('Invalid data type');
@@ -159,7 +159,7 @@ class StoredUserData
* @param SimpleORMap $context Optional context
* @return array
*/
- protected function getData($type, SimpleORMap $context = null)
+ protected function getData($type, ?SimpleORMap $context = null)
{
if (!isset($this->data[$type])) {
throw new InvalidArgumentException('Invalid data type');
diff --git a/lib/classes/StudipMail.php b/lib/classes/StudipMail.php
index 78a5d29..e1dd8dd 100644
--- a/lib/classes/StudipMail.php
+++ b/lib/classes/StudipMail.php
@@ -416,7 +416,7 @@ class StudipMail
* @param email_message_class|null $transporter
* @return bool
*/
- public function send(email_message_class $transporter = null)
+ public function send(?email_message_class $transporter = null)
{
if ($transporter === null) {
$transporter = self::$transporter;
diff --git a/lib/classes/TwoFactorAuth.php b/lib/classes/TwoFactorAuth.php
index 73e9f5e..55e0140 100644
--- a/lib/classes/TwoFactorAuth.php
+++ b/lib/classes/TwoFactorAuth.php
@@ -40,7 +40,7 @@ final class TwoFactorAuth
* @param User|null $user User to check (optional, defaults to current user)
* @return boolean
*/
- public static function isEnabledForUser(User $user = null): bool
+ public static function isEnabledForUser(?User $user = null): bool
{
if ($user === null) {
$user = User::findCurrent();
diff --git a/lib/classes/Visibility.php b/lib/classes/Visibility.php
index c164c76..dd382e2 100644
--- a/lib/classes/Visibility.php
+++ b/lib/classes/Visibility.php
@@ -650,7 +650,7 @@ class Visibility
*
* @return bool
*/
- public static function allowExtendedSettings(\User $user = null): bool
+ public static function allowExtendedSettings(?\User $user = null): bool
{
$user = $user ?? User::findCurrent();
@@ -698,7 +698,7 @@ class Visibility
*
* @return bool
*/
- public static function isFieldHideableForUser(string $field, User $user = null): bool
+ public static function isFieldHideableForUser(string $field, ?User $user = null): bool
{
$user = $user ?? User::findCurrent();
diff --git a/lib/classes/VueApp.php b/lib/classes/VueApp.php
index 7e59a66..db65abc 100644
--- a/lib/classes/VueApp.php
+++ b/lib/classes/VueApp.php
@@ -197,7 +197,7 @@ final class VueApp implements Stringable
*
* You may specify a different filename for the plugin.
*/
- public function withPlugin(string $plugin, string $filename = null): VueApp
+ public function withPlugin(string $plugin, ?string $filename = null): VueApp
{
$clone = clone $this;
$clone->plugins[$plugin] = $filename ?? $plugin;
diff --git a/lib/classes/WidgetContainer.php b/lib/classes/WidgetContainer.php
index c702d06..061180b 100644
--- a/lib/classes/WidgetContainer.php
+++ b/lib/classes/WidgetContainer.php
@@ -166,7 +166,7 @@ abstract class WidgetContainer
* @param string|null $widget_class
* @return int
*/
- public function countWidgets(string $widget_class = null): int
+ public function countWidgets(?string $widget_class = null): int
{
$widgets = $this->widgets;
if ($widget_class !== null) {
diff --git a/lib/classes/ZipArchive.php b/lib/classes/ZipArchive.php
index 0ddc6fa..99bf5b5 100644
--- a/lib/classes/ZipArchive.php
+++ b/lib/classes/ZipArchive.php
@@ -166,7 +166,7 @@ class ZipArchive extends \ZipArchive
*/
public function addFile(
string $filepath,
- string $entryname = null,
+ ?string $entryname = null,
int $start = 0,
int $length = 0,
int $flags = self::FL_OVERWRITE
diff --git a/lib/classes/admission/AdmissionRule.php b/lib/classes/admission/AdmissionRule.php
index d6cd03a..0a543c7 100644
--- a/lib/classes/admission/AdmissionRule.php
+++ b/lib/classes/admission/AdmissionRule.php
@@ -75,7 +75,7 @@ abstract class AdmissionRule
/**
* @param class-string<static> $name
*/
- public static function getRule(string $name, string $id = null): ?AdmissionRule
+ public static function getRule(string $name, ?string $id = null): ?AdmissionRule
{
$rules = self::getAvailableAdmissionRules();
if (!array_key_exists($name, $rules)) {
diff --git a/lib/classes/assets/Storage.php b/lib/classes/assets/Storage.php
index d488878..4a139e6 100644
--- a/lib/classes/assets/Storage.php
+++ b/lib/classes/assets/Storage.php
@@ -18,7 +18,7 @@ class Storage
*
* @param Assets\AssetFactory $factory The factory
*/
- public static function setFactory(AssetFactory $factory = null)
+ public static function setFactory(?AssetFactory $factory = null)
{
$old_factory = self::$default_factory;
self::$default_factory = $factory;
diff --git a/lib/classes/forms/Form.php b/lib/classes/forms/Form.php
index 75323b9..4ffd86b 100644
--- a/lib/classes/forms/Form.php
+++ b/lib/classes/forms/Form.php
@@ -502,7 +502,7 @@ class Form extends Part
* @return string
* @throws \Flexi\TemplateNotFoundException
*/
- public function render(string|Template $layout = null)
+ public function render(string|Template|null $layout = null)
{
\NotificationCenter::postNotification('FormWillRender', $this);
if (\Request::isDialog()) {
diff --git a/lib/classes/forms/Link.php b/lib/classes/forms/Link.php
index eeb0244..e198c71 100644
--- a/lib/classes/forms/Link.php
+++ b/lib/classes/forms/Link.php
@@ -11,7 +11,7 @@ class Link extends Part
protected $icon;
protected $attributes = [];
- public function __construct(string $url, string $label, \Icon $icon = null)
+ public function __construct(string $url, string $label, ?\Icon $icon = null)
{
$this->url = $url;
$this->label = $label;
@@ -67,7 +67,7 @@ class Link extends Part
* @param \Icon $icon
* @return $this
*/
- public function setIcon(\Icon $icon = null): Link
+ public function setIcon(?\Icon $icon = null): Link
{
$this->icon = $icon;
return $this;
diff --git a/lib/classes/sidebar/ButtonElement.php b/lib/classes/sidebar/ButtonElement.php
index f60fccf..9b5fabf 100644
--- a/lib/classes/sidebar/ButtonElement.php
+++ b/lib/classes/sidebar/ButtonElement.php
@@ -6,7 +6,7 @@ class ButtonElement extends WidgetElement implements ArrayAccess
public $label;
public $icon = null;
- public function __construct(string $label, \Icon $icon = null, array $attributes = [])
+ public function __construct(string $label, ?\Icon $icon = null, array $attributes = [])
{
parent::__construct();
diff --git a/lib/classes/sidebar/LinkElement.php b/lib/classes/sidebar/LinkElement.php
index 0376a47..4b87337 100644
--- a/lib/classes/sidebar/LinkElement.php
+++ b/lib/classes/sidebar/LinkElement.php
@@ -15,7 +15,7 @@ class LinkElement extends WidgetElement implements ArrayAccess
* @return LinkElement Link element from parsed html
* @throws Exception if html can not be parsed
*/
- public static function fromHTML($html, \Icon $icon = null)
+ public static function fromHTML($html, ?\Icon $icon = null)
{
$matched = preg_match('~(<a(?P<attributes>(?:\s+\w+=".*?")+)>\s*(?P<label>.*?)\s*</a>)~s', $html, $match);
if (!$matched) {
@@ -72,7 +72,7 @@ class LinkElement extends WidgetElement implements ArrayAccess
* @param Icon $icon Icon for the link
* @param array $attributes HTML-attributes for the a-tag in an associative array.
*/
- public function __construct($label, $url, \Icon $icon = null, $attributes = [])
+ public function __construct($label, $url, ?\Icon $icon = null, $attributes = [])
{
parent::__construct();
diff --git a/lib/classes/sidebar/LinksWidget.php b/lib/classes/sidebar/LinksWidget.php
index 72a2fca..2f6645f 100644
--- a/lib/classes/sidebar/LinksWidget.php
+++ b/lib/classes/sidebar/LinksWidget.php
@@ -37,7 +37,7 @@ class LinksWidget extends ListWidget
return $element;
}
- public function addLinkFromHTML($html, Icon $icon = null)
+ public function addLinkFromHTML($html, ?Icon $icon = null)
{
$this->addElement(LinkElement::fromHTML($html, $icon));
}
diff --git a/lib/classes/sidebar/SearchWidget.php b/lib/classes/sidebar/SearchWidget.php
index 58acacb..fdf2abb 100644
--- a/lib/classes/sidebar/SearchWidget.php
+++ b/lib/classes/sidebar/SearchWidget.php
@@ -74,7 +74,7 @@ class SearchWidget extends SidebarWidget
* Note that this parameter is ignored
* when a quick search object is provided!
*/
- public function addNeedle($label, $name, $placeholder = false, SearchType $quick_search = null, $js_func = null, $value = null, array $attributes = [])
+ public function addNeedle($label, $name, $placeholder = false, ?SearchType $quick_search = null, $js_func = null, $value = null, array $attributes = [])
{
$value = $value ?: Request::get($name);
$this->needles[] = compact(['label', 'name', 'placeholder', 'value', 'quick_search', 'js_func', 'attributes']);
diff --git a/lib/cronjobs/courseware.php b/lib/cronjobs/courseware.php
index d80b6ce..e818eca 100644
--- a/lib/cronjobs/courseware.php
+++ b/lib/cronjobs/courseware.php
@@ -230,7 +230,7 @@ class CoursewareCronjob extends CronJob
* @return bool|int|number
* @throws Exception
*/
- private function sendCertificate(Courseware\Unit $unit, string $user_id, int $progress, int $timestamp, string $image = null)
+ private function sendCertificate(Courseware\Unit $unit, string $user_id, int $progress, int $timestamp, ?string $image = null)
{
$user = User::find($user_id);
$course = Course::find($unit->range_id);
diff --git a/lib/exTpl/Context.php b/lib/exTpl/Context.php
index 309174f..3f5517d 100644
--- a/lib/exTpl/Context.php
+++ b/lib/exTpl/Context.php
@@ -26,7 +26,7 @@ class Context
* @param array $bindings symbol table
* @param Context|null $parent parent context (or NULL)
*/
- public function __construct(array $bindings, Context $parent = null)
+ public function __construct(array $bindings, ?Context $parent = null)
{
$this->bindings = $bindings;
$this->parent = $parent;
diff --git a/lib/exceptions/AccessDeniedException.php b/lib/exceptions/AccessDeniedException.php
index 778211d..5593997 100644
--- a/lib/exceptions/AccessDeniedException.php
+++ b/lib/exceptions/AccessDeniedException.php
@@ -19,7 +19,7 @@ class AccessDeniedException extends Exception
* @param integer $code Exception code
* @param Exception $previous Previous exception (optional)
*/
- public function __construct($message = '', $code = 0, Exception $previous = null)
+ public function __construct($message = '', $code = 0, ?Exception $previous = null)
{
if (func_num_args() === 0) {
$message = _('Sie haben nicht die Berechtigung, diese Aktion '
diff --git a/lib/exceptions/FeatureDisabledException.php b/lib/exceptions/FeatureDisabledException.php
index 52cbbdf..ebb7736 100644
--- a/lib/exceptions/FeatureDisabledException.php
+++ b/lib/exceptions/FeatureDisabledException.php
@@ -1,7 +1,7 @@
<?php
class FeatureDisabledException extends Studip\Exception
{
- public function __construct($message = '', $code = 0, Exception $previous = null)
+ public function __construct($message = '', $code = 0, ?Exception $previous = null)
{
if (func_num_args() === 0) {
$message = _('Diese Funktion ist ausgeschaltet.');
diff --git a/lib/exceptions/InvalidSecurityTokenException.php b/lib/exceptions/InvalidSecurityTokenException.php
index 134f54d..b78ad6a 100644
--- a/lib/exceptions/InvalidSecurityTokenException.php
+++ b/lib/exceptions/InvalidSecurityTokenException.php
@@ -19,7 +19,7 @@ class InvalidSecurityTokenException extends AccessDeniedException
/**
* @param string this parameter is ignored but required by PHP
*/
- public function __construct($message = '', $code = 0, Exception $previous = null)
+ public function __construct($message = '', $code = 0, ?Exception $previous = null)
{
parent::__construct(_('Ungültiges oder fehlendes Sicherheits-Token.'));
}
diff --git a/lib/exceptions/MethodNotAllowedException.php b/lib/exceptions/MethodNotAllowedException.php
index 75f3b10..6f2064f 100644
--- a/lib/exceptions/MethodNotAllowedException.php
+++ b/lib/exceptions/MethodNotAllowedException.php
@@ -16,7 +16,7 @@
class MethodNotAllowedException extends Exception
{
- public function __construct($message = '', $code = 0, Exception $previous = null)
+ public function __construct($message = '', $code = 0, ?Exception $previous = null)
{
parent::__construct($message ?: _('Unzulässige Request-Methode beim Aufruf.'), $code, $previous);
}
diff --git a/lib/flexi/Template.php b/lib/flexi/Template.php
index 44eefbe..f0848f7 100644
--- a/lib/flexi/Template.php
+++ b/lib/flexi/Template.php
@@ -109,7 +109,7 @@ abstract class Template
* @return string A string representing the rendered presentation.
* @throws TemplateNotFoundException
*/
- public function render(array $attributes = [], string|Template $layout = null): string
+ public function render(array $attributes = [], string|Template|null $layout = null): string
{
if (isset($layout)) {
$this->set_layout($layout);
diff --git a/lib/language.inc.php b/lib/language.inc.php
index 3af968a..80a1616 100644
--- a/lib/language.inc.php
+++ b/lib/language.inc.php
@@ -47,7 +47,7 @@ use Negotiation\AcceptHeader;
* @return string preferred user language, given in "en_GB"-style
*
*/
-function get_accepted_languages(Psr\Http\Message\RequestInterface $request = null) {
+function get_accepted_languages(?Psr\Http\Message\RequestInterface $request = null) {
$accepted_languages = null;
if ($request === null) {
$accepted_languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? null;
diff --git a/lib/models/BlubberComment.php b/lib/models/BlubberComment.php
index dff5da9..1f50d1d 100644
--- a/lib/models/BlubberComment.php
+++ b/lib/models/BlubberComment.php
@@ -113,7 +113,7 @@ class BlubberComment extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public function isWritable(string $user_id = null)
+ public function isWritable(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
return $user_id === $this['user_id']
diff --git a/lib/models/BlubberGlobalThread.php b/lib/models/BlubberGlobalThread.php
index 14630fe..197c132 100644
--- a/lib/models/BlubberGlobalThread.php
+++ b/lib/models/BlubberGlobalThread.php
@@ -23,7 +23,7 @@
*/
class BlubberGlobalThread extends BlubberThread
{
- public function isReadable(string $user_id = null)
+ public function isReadable(?string $user_id = null)
{
return true;
}
diff --git a/lib/models/BlubberStatusgruppeThread.php b/lib/models/BlubberStatusgruppeThread.php
index 2686bd6..5f859cb 100644
--- a/lib/models/BlubberStatusgruppeThread.php
+++ b/lib/models/BlubberStatusgruppeThread.php
@@ -55,7 +55,7 @@ class BlubberStatusgruppeThread extends BlubberThread
return null;
}
- public function isReadable(string $user_id = null)
+ public function isReadable(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
if ($GLOBALS['perm']->have_studip_perm("tutor", $this['context_id'], $user_id)) {
diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php
index b01664a..780972f 100644
--- a/lib/models/BlubberThread.php
+++ b/lib/models/BlubberThread.php
@@ -166,7 +166,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public static function findMyGlobalThreads($limit = 51, $since = null, $olderthan = null, string $user_id = null, $search = null)
+ public static function findMyGlobalThreads($limit = 51, $since = null, $olderthan = null, ?string $user_id = null, $search = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
@@ -274,7 +274,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
* @param string $search optional; filters the threads by a search string
* @return array
*/
- protected static function getOrderedThreads($thread_ids, $limit = 51, $since = null, $olderthan = null, string $user_id = null, $search = null)
+ protected static function getOrderedThreads($thread_ids, $limit = 51, $since = null, $olderthan = null, ?string $user_id = null, $search = null)
{
$query = SQLQuery::table('blubber_threads')->join(
'blubber_comments',
@@ -340,7 +340,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
* @param string $only_in_stream optional; filter threads by `visible_in_stream`
* @param string $user_id optional; use this ID instead of $GLOBALS['user']->id
*/
- public static function findByInstitut($institut_id, $only_in_stream = false, string $user_id = null)
+ public static function findByInstitut($institut_id, $only_in_stream = false, ?string $user_id = null)
{
return self::findByContext($institut_id, $only_in_stream, 'institute', $user_id);
}
@@ -350,7 +350,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
* @param string $only_in_stream optional; filter threads by `visible_in_stream`
* @param string $user_id optional; use this ID instead of $GLOBALS['user']->id
*/
- public static function findBySeminar($seminar_id, $only_in_stream = false, string $user_id = null)
+ public static function findBySeminar($seminar_id, $only_in_stream = false, ?string $user_id = null)
{
return self::findByContext($seminar_id, $only_in_stream, 'course', $user_id);
}
@@ -361,7 +361,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
* @param string $context_type optional; filter threads by `context_type`
* @param string $user_id optional; use this ID instead of $GLOBALS['user']->id
*/
- public static function findByContext($context_id, $only_in_stream = false, $context_type = 'course', string $user_id = null)
+ public static function findByContext($context_id, $only_in_stream = false, $context_type = 'course', ?string $user_id = null)
{
if (!BlubberThread::findOneBySQL("context_type = :type AND context_id = :context_id AND visible_in_stream = '1' AND content IS NULL AND display_class IS NULL", ['context_id' => $context_id, 'type' => $context_type])) {
//create the default-thread for this context
@@ -616,7 +616,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public function getLastVisit(string $user_id = null)
+ public function getLastVisit(?string $user_id = null)
{
return object_get_visit(
$this->id,
@@ -632,7 +632,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @param string|null $user_id
*/
- public function setLastVisit(string $user_id = null): void
+ public function setLastVisit(?string $user_id = null): void
{
object_set_visit(
$this->id,
@@ -795,7 +795,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public function isWritable(string $user_id = null)
+ public function isWritable(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
if ($this['context_type'] === 'course' || $this['context_type'] === 'institute') {
@@ -810,7 +810,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public function isReadable(string $user_id = null)
+ public function isReadable(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
if ($this['context_type'] === 'public') {
@@ -839,7 +839,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
/**
* @param string $user_id optional; use this ID instead of $GLOBALS['user']->id
*/
- public function isCommentable(string $user_id = null)
+ public function isCommentable(?string $user_id = null)
{
return $this->isReadable($user_id) && $this['commentable'];
}
@@ -956,7 +956,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- public function markAsRead(string $user_id = null)
+ public function markAsRead(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
@@ -1023,7 +1023,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- protected static function getMyBlubberCourses(string $user_id = null)
+ protected static function getMyBlubberCourses(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
if ($GLOBALS['perm']->have_perm('admin', $user_id)) {
@@ -1069,7 +1069,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
- protected static function getMyBlubberInstitutes(string $user_id = null)
+ protected static function getMyBlubberInstitutes(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
if ($GLOBALS['perm']->have_perm('root', $user_id)) {
@@ -1100,7 +1100,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*
* @return bool
*/
- public function mayDisableNotifications(string $user_id = null): bool
+ public function mayDisableNotifications(?string $user_id = null): bool
{
// Notifications may always be disabled for global blubber stream
if ($this->id === 'global') {
@@ -1125,7 +1125,7 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
* @param string $user_id optional; use this ID instead of $GLOBALS['user']->id
*
*/
- public function countUnseenComments(string $user_id = null): int
+ public function countUnseenComments(?string $user_id = null): int
{
$user_id = $user_id ?? User::findCurrent();
return \BlubberComment::countBySQL(
diff --git a/lib/models/ConsultationBlock.php b/lib/models/ConsultationBlock.php
index 299820d..8971dce 100644
--- a/lib/models/ConsultationBlock.php
+++ b/lib/models/ConsultationBlock.php
@@ -263,7 +263,7 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject
* @param int|null $pause_duration Duration of the pause
* @return ConsultationSlot[]
*/
- public function createSlots($duration, int $pause_time = null, int $pause_duration = null): array
+ public function createSlots($duration, ?int $pause_time = null, ?int $pause_duration = null): array
{
$slots = [];
$accumulated_durations = 0;
diff --git a/lib/models/ConsultationSlot.php b/lib/models/ConsultationSlot.php
index fe8c21b..225e5fb 100644
--- a/lib/models/ConsultationSlot.php
+++ b/lib/models/ConsultationSlot.php
@@ -353,7 +353,7 @@ class ConsultationSlot extends SimpleORMap
/**
* Returns whether the given user may create a booking for this slot.
*/
- public function userMayCreateBookingForSlot(\User $user = null): bool
+ public function userMayCreateBookingForSlot(?\User $user = null): bool
{
$user = $user ?? User::findCurrent();
diff --git a/lib/models/Course.php b/lib/models/Course.php
index 6d53399..831fe07 100644
--- a/lib/models/Course.php
+++ b/lib/models/Course.php
@@ -2412,7 +2412,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
return $this->Seminar_id;
}
- public function isRangeAccessible(string $user_id = null): bool
+ public function isRangeAccessible(?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
return $GLOBALS['perm']->have_studip_perm('autor', $this->Seminar_id, $user_id);
@@ -2572,7 +2572,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
/**
* @inheritDoc
*/
- public function isCalendarWritable(string $user_id = null): bool
+ public function isCalendarWritable(?string $user_id = null): bool
{
if ($user_id === null) {
$user_id = User::findCurrent()->id;
diff --git a/lib/models/CourseMember.php b/lib/models/CourseMember.php
index c157702..f72709e 100644
--- a/lib/models/CourseMember.php
+++ b/lib/models/CourseMember.php
@@ -203,7 +203,7 @@ class CourseMember extends SimpleORMap implements PrivacyObject
* @param string $vorname
* @return array
*/
- public static function getMemberByIdentification(string $course_id, string $nachname, string $vorname = null): array
+ public static function getMemberByIdentification(string $course_id, string $nachname, ?string $vorname = null): array
{
return DBManager::get()->fetchAll("SELECT
auth_user_md5.user_id,
diff --git a/lib/models/Courseware/Instance.php b/lib/models/Courseware/Instance.php
index 3579427..14f75a5 100644
--- a/lib/models/Courseware/Instance.php
+++ b/lib/models/Courseware/Instance.php
@@ -554,7 +554,7 @@ class Instance
* @return array all the (optionally formatted) blocks grouped by the IDs of the structural element containing
* that block.
*/
- public function findAllBlocksGroupedByStructuralElementId(callable $formatter = null): array
+ public function findAllBlocksGroupedByStructuralElementId(?callable $formatter = null): array
{
if (!$formatter) {
$formatter = function ($row) {
diff --git a/lib/models/Courseware/PeerReviewProcess.php b/lib/models/Courseware/PeerReviewProcess.php
index 840cd68..10d7c55 100644
--- a/lib/models/Courseware/PeerReviewProcess.php
+++ b/lib/models/Courseware/PeerReviewProcess.php
@@ -129,7 +129,7 @@ class PeerReviewProcess extends \SimpleORMap
return (bool) $this->configuration['automaticPairing'];
}
- public function getCurrentState(int $date = null): string
+ public function getCurrentState(?int $date = null): string
{
if (is_null($date)) {
$date = time();
diff --git a/lib/models/Courseware/StructuralElement.php b/lib/models/Courseware/StructuralElement.php
index 50ba714..4bbaad8 100644
--- a/lib/models/Courseware/StructuralElement.php
+++ b/lib/models/Courseware/StructuralElement.php
@@ -227,7 +227,7 @@ class StructuralElement extends \SimpleORMap implements \PrivacyObject, \Feedbac
return self::getCourseware('', '', $root_id);
}
- private static function getCourseware(string $rangeId, string $rangeType, string $root_id = null): ?StructuralElement
+ private static function getCourseware(string $rangeId, string $rangeType, ?string $root_id = null): ?StructuralElement
{
if ($root_id) {
$result = self::find($root_id);
@@ -448,7 +448,7 @@ class StructuralElement extends \SimpleORMap implements \PrivacyObject, \Feedbac
/**
* @param \User|\Seminar_User $user
*/
- public function hasEditingPermission(User $user, Unit $unit = null): bool
+ public function hasEditingPermission(User $user, ?Unit $unit = null): bool
{
if (!isset($unit)) {
$unit = $this->findUnit();
@@ -742,7 +742,7 @@ class StructuralElement extends \SimpleORMap implements \PrivacyObject, \Feedbac
*
* @return StructuralElement[] a list of all descendants
*/
- public function findDescendants(User $user = null)
+ public function findDescendants(?User $user = null)
{
$descendants = [];
foreach ($this->children as $child) {
@@ -1295,7 +1295,7 @@ SQL;
return 'course/courseware/courseware/' . $unit->id . '?cid=' . $this->range_id . '#/structural_element/' . $this->id;
}
- public function isRangeAccessible(string $user_id = null): bool
+ public function isRangeAccessible(?string $user_id = null): bool
{
$user = \User::find($user_id);
if ($user) {
diff --git a/lib/models/Courseware/Unit.php b/lib/models/Courseware/Unit.php
index af7318d..28447d0 100644
--- a/lib/models/Courseware/Unit.php
+++ b/lib/models/Courseware/Unit.php
@@ -206,7 +206,7 @@ class Unit extends \SimpleORMap implements \PrivacyObject, \FeedbackRange
User $user,
string $rangeId,
string $rangeType,
- array $modified = null,
+ ?array $modified = null,
bool $duplicate = false
): Unit {
$sourceUnitElement = $this->structural_element;
@@ -364,7 +364,7 @@ class Unit extends \SimpleORMap implements \PrivacyObject, \FeedbackRange
return 'course/courseware/' . '?cid=' . $this->range_id;
}
- public function isRangeAccessible(string $user_id = null): bool
+ public function isRangeAccessible(?string $user_id = null): bool
{
$user = \User::find($user_id);
if ($user) {
diff --git a/lib/models/Deputy.php b/lib/models/Deputy.php
index c74c741..39fc33c 100644
--- a/lib/models/Deputy.php
+++ b/lib/models/Deputy.php
@@ -199,7 +199,7 @@ class Deputy extends SimpleORMap
* @param string|null $range_id ID of a course or person
* @return SimpleCollection An array containing all deputies.
*/
- public static function findDeputies(string $range_id = null)
+ public static function findDeputies(?string $range_id = null)
{
if(is_null($range_id)) {
$range_id = $GLOBALS['user']->id;
@@ -215,7 +215,7 @@ class Deputy extends SimpleORMap
* @param string|null $user_id the user to check
* @return SimpleCollection An array of the given person's bosses.
*/
- public static function findDeputyBosses(string $user_id = null)
+ public static function findDeputyBosses(?string $user_id = null)
{
if(is_null($user_id)) {
$user_id = $GLOBALS['user']->id;
@@ -234,7 +234,7 @@ class Deputy extends SimpleORMap
* @param string|null $user_id
* @return SimpleCollection
*/
- public static function findDeputyCourses(string $user_id = null)
+ public static function findDeputyCourses(?string $user_id = null)
{
if(is_null($user_id)) {
$user_id = $GLOBALS['user']->id;
diff --git a/lib/models/FeedbackElement.php b/lib/models/FeedbackElement.php
index 88f3ba7..27817ce 100644
--- a/lib/models/FeedbackElement.php
+++ b/lib/models/FeedbackElement.php
@@ -60,7 +60,7 @@ class FeedbackElement extends SimpleORMap
*
* @return bool
*/
- public function isFeedbackable(string $user_id = null): bool
+ public function isFeedbackable(?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
$feedbackable = false;
@@ -80,7 +80,7 @@ class FeedbackElement extends SimpleORMap
*
* @return bool
*/
- public function isOwner(string $user_id = null): bool
+ public function isOwner(?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
$ownership = false;
@@ -96,7 +96,7 @@ class FeedbackElement extends SimpleORMap
*
* @return FeedbackEntry|null
*/
- public function getOwnEntry(string $user_id = null)
+ public function getOwnEntry(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php
index 070ca0a..043aec1 100644
--- a/lib/models/FileRef.php
+++ b/lib/models/FileRef.php
@@ -378,7 +378,7 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange
return $this->foldertype->range_id;
}
- public function isRangeAccessible(string $user_id = null): bool
+ public function isRangeAccessible(?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
diff --git a/lib/models/Folder.php b/lib/models/Folder.php
index 7c83d71..b3a08f5 100644
--- a/lib/models/Folder.php
+++ b/lib/models/Folder.php
@@ -560,7 +560,7 @@ class Folder extends SimpleORMap implements FeedbackRange
return $this->range_id;
}
- public function isRangeAccessible(string $user_id = null): bool
+ public function isRangeAccessible(?string $user_id = null): bool
{
$user_id = $user_id ?? $GLOBALS['user']->id;
diff --git a/lib/models/LtiTool.php b/lib/models/LtiTool.php
index bde6203..09ad19a 100644
--- a/lib/models/LtiTool.php
+++ b/lib/models/LtiTool.php
@@ -116,7 +116,7 @@ class LtiTool extends SimpleORMap
*
* @return bool True, if the user may edit the tool, false otherwise.
*/
- public function isEditableByUser(string $user_id = null) : bool
+ public function isEditableByUser(?string $user_id = null) : bool
{
$user_id ??= User::findCurrent()->id;
return $this->range_id === 'global' && $GLOBALS['perm']->have_perm('root')
diff --git a/lib/models/OERReview.php b/lib/models/OERReview.php
index 09dc73f..69a672f 100644
--- a/lib/models/OERReview.php
+++ b/lib/models/OERReview.php
@@ -186,12 +186,12 @@ class OERReview extends BlubberThread
return URLHelper::getURL('dispatch.php/oer/market/discussion/' . $this->getId());
}
- public function isReadable(string $user_id = null)
+ public function isReadable(?string $user_id = null)
{
return true;
}
- public function isCommentable(string $user_id = null)
+ public function isCommentable(?string $user_id = null)
{
$user_id = $user_id ?? $GLOBALS['user']->id;
return $GLOBALS['perm']->have_perm('autor', $user_id);
diff --git a/lib/models/User.php b/lib/models/User.php
index df87c3c..ab43a4c 100644
--- a/lib/models/User.php
+++ b/lib/models/User.php
@@ -1671,7 +1671,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject, Studip\Calendar\
/**
* @inheritDoc
*/
- public function isCalendarWritable(string $user_id = null): bool
+ public function isCalendarWritable(?string $user_id = null): bool
{
if ($user_id === null) {
$user_id = self::findCurrent()->id;
diff --git a/lib/models/resources/Resource.php b/lib/models/resources/Resource.php
index 5906b9f..8a7fd06 100644
--- a/lib/models/resources/Resource.php
+++ b/lib/models/resources/Resource.php
@@ -704,7 +704,7 @@ class Resource extends SimpleORMap implements StudipItem
*/
public function createBooking(
User $user,
- string $range_id = null,
+ ?string $range_id = null,
array $time_ranges = [],
?DateInterval $repetition_interval = null,
int $repetition_amount = 0,
@@ -1763,7 +1763,7 @@ class Resource extends SimpleORMap implements StudipItem
* (property-ID) => (error message or empty string)
* ]
*/
- public function setPropertiesById(array $properties, User $user = null)
+ public function setPropertiesById(array $properties, ?User $user = null)
{
$failed_properties = [];
diff --git a/lib/resources/ResourceManager.php b/lib/resources/ResourceManager.php
index b6115e7..2aef1f6 100644
--- a/lib/resources/ResourceManager.php
+++ b/lib/resources/ResourceManager.php
@@ -845,7 +845,7 @@ class ResourceManager
* This method does the mapping from the old resource management permissions
* to the new resource management permissions.
*/
- public static function getGlobalResourcePermission(User $user = null)
+ public static function getGlobalResourcePermission(?User $user = null)
{
if (!$user) {
return '';
@@ -890,7 +890,7 @@ class ResourceManager
* If this is not set the current timestamp will be used.
*/
public static function userHasResourcePermissions(
- User $user = null,
+ ?User $user = null,
$level = 'admin',
$time = null
)
@@ -1077,7 +1077,7 @@ class ResourceManager
* false otherwise.
*/
public static function userHasGlobalPermission(
- User $user = null,
+ ?User $user = null,
$requested_permission = 'user'
)
{
diff --git a/lib/trails/Exception.php b/lib/trails/Exception.php
index fd92b35..aaf69cf 100644
--- a/lib/trails/Exception.php
+++ b/lib/trails/Exception.php
@@ -16,7 +16,7 @@ class Exception extends \Exception
* @param string|null $reason a human readable presentation of the status code
* @param array $headers a hash of additional headers to be set in the response
*/
- public function __construct(int $status = 500, string $reason = null, array $headers = [])
+ public function __construct(int $status = 500, ?string $reason = null, array $headers = [])
{
parent::__construct(
$reason ?? Response::get_reason($status),