From 598445d681db8c839c97eeacbccedc70a1b10c1e Mon Sep 17 00:00:00 2001 From: flack Date: Mon, 13 May 2024 15:25:31 +0200 Subject: [PATCH] Improve php84 compat --- lib/fi/protie/navigation/main.php | 2 +- lib/midcom.php | 2 +- lib/midcom/admin/folder/handler/move.php | 2 +- lib/midcom/admin/help/help.php | 2 +- lib/midcom/baseclasses/components/base.php | 2 +- lib/midcom/baseclasses/components/handler/rest.php | 2 +- lib/midcom/core/context.php | 6 +++--- lib/midcom/core/dbaobject.php | 6 +++--- lib/midcom/core/privilege.php | 2 +- lib/midcom/db/attachment.php | 2 +- lib/midcom/error/forbidden.php | 2 +- lib/midcom/helper/configuration.php | 2 +- lib/midcom/helper/head.php | 4 ++-- lib/midcom/helper/imagepopup/handler/list.php | 2 +- lib/midcom/helper/imagepopup/handler/upload.php | 2 +- lib/midcom/helper/nav/main.php | 2 +- lib/midcom/helper/reflector/nameresolver.php | 6 +++--- lib/midcom/helper/toolbar.php | 2 +- lib/midcom/helper/toolbar/view.php | 2 +- lib/midcom/services/auth/backend.php | 2 +- lib/midcom/services/auth/main.php | 14 +++++++------- lib/midcom/services/cache/module.php | 2 +- lib/midcom/services/cache/module/memcache.php | 4 ++-- lib/midcom/services/cache/module/nap.php | 2 +- lib/midcom/services/i18n/formatter.php | 2 +- lib/midcom/services/indexer/backend/solr.php | 4 ++-- lib/midcom/services/metadata.php | 6 +++--- lib/midcom/services/session.php | 2 +- .../asgard/handler/component/configuration.php | 2 +- lib/midgard/admin/asgard/handler/handler.php | 2 +- lib/midgard/admin/asgard/handler/object/manage.php | 2 +- lib/net/nehmer/comments/handler.php | 2 +- lib/net/nehmer/comments/handler/view.php | 2 +- lib/net/nehmer/static/viewer.php | 2 +- lib/net/nemein/rss/handler/admin.php | 2 +- lib/net/nemein/rss/handler/fetch.php | 2 +- lib/net/nemein/wiki/handler/create.php | 2 +- lib/net/nemein/wiki/handler/latest.php | 2 +- lib/net/nemein/wiki/parser.php | 2 +- lib/org/openpsa/calendar/handler/event/create.php | 2 +- lib/org/openpsa/contacts/duplicates/check.php | 2 +- lib/org/openpsa/contacts/handler/group/view.php | 2 +- lib/org/openpsa/contacts/handler/person/create.php | 2 +- .../openpsa/directmarketing/campaign/member.php | 2 +- .../directmarketing/handler/campaign/campaign.php | 2 +- .../directmarketing/handler/campaign/rules.php | 2 +- lib/org/openpsa/directmarketing/handler/list.php | 2 +- lib/org/openpsa/directmarketing/handler/logger.php | 2 +- .../directmarketing/handler/message/compose.php | 2 +- lib/org/openpsa/directmarketing/sender.php | 2 +- .../openpsa/documents/handler/document/view.php | 2 +- lib/org/openpsa/expenses/handler/hours/admin.php | 4 ++-- lib/org/openpsa/httplib/main.php | 2 +- lib/org/openpsa/invoices/calculator.php | 2 +- lib/org/openpsa/invoices/handler/invoice/crud.php | 2 +- lib/org/openpsa/invoices/handler/scheduled.php | 2 +- lib/org/openpsa/products/handler/list.php | 2 +- lib/org/openpsa/projects/handler/task/crud.php | 2 +- lib/org/openpsa/projects/handler/task/list.php | 2 +- lib/org/openpsa/relatedto/plugin.php | 2 +- lib/org/openpsa/reports/handler/sales/report.php | 2 +- lib/org/openpsa/sales/calculator/default.php | 2 +- lib/org/openpsa/sales/handler/deliverable/list.php | 2 +- lib/org/openpsa/sales/handler/edit.php | 2 +- lib/org/openpsa/user/accounthelper.php | 4 ++-- lib/org/openpsa/user/handler/list.php | 6 +++--- lib/org/openpsa/user/handler/person/create.php | 2 +- lib/org/openpsa/user/validator.php | 2 +- lib/org/openpsa/widgets/calendar/event.php | 2 +- src/midcom/datamanager/datamanager.php | 8 ++++---- src/midcom/dba/parameters.php | 2 +- src/midcom/grid/grid.php | 2 +- src/midcom/grid/provider/client.php | 2 +- test/midcom/helper/__files/xml_constraint.php | 2 +- test/midcom/helper/exporter/xmlTest.php | 2 +- test/utilities/testcase.php | 2 +- 76 files changed, 100 insertions(+), 100 deletions(-) diff --git a/lib/fi/protie/navigation/main.php b/lib/fi/protie/navigation/main.php index c9ce7e0d4..b63ab9429 100644 --- a/lib/fi/protie/navigation/main.php +++ b/lib/fi/protie/navigation/main.php @@ -138,7 +138,7 @@ class fi_protie_navigation /** * Here we initialize the classes and variables needed through the class. */ - public function __construct(int $id = null) + public function __construct(?int $id = null) { $this->_nap = new midcom_helper_nav(); $this->get_node_path(); diff --git a/lib/midcom.php b/lib/midcom.php index 038568279..26c487523 100644 --- a/lib/midcom.php +++ b/lib/midcom.php @@ -53,7 +53,7 @@ public static function init(string $environment = 'prod', bool $debug = false) : * @param string $name The service name as listed in the _service_classes array or null to get midcom_application * @return midcom_application The midcom application instance */ - public static function get(string $name = null) + public static function get(?string $name = null) { if (!self::$_application) { self::init(); diff --git a/lib/midcom/admin/folder/handler/move.php b/lib/midcom/admin/folder/handler/move.php index c1f8bf7ee..876e1979f 100644 --- a/lib/midcom/admin/folder/handler/move.php +++ b/lib/midcom/admin/folder/handler/move.php @@ -62,7 +62,7 @@ public function _handler_move(Request $request, string $guid, array &$data) return $this->get_workflow('viewer')->run($request); } - public function show_tree(midcom_db_topic $folder = null, bool $tree_disabled = false) + public function show_tree(?midcom_db_topic $folder = null, bool $tree_disabled = false) { $folder ??= midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ROOTTOPIC); diff --git a/lib/midcom/admin/help/help.php b/lib/midcom/admin/help/help.php index 1fce59b72..f59b331a1 100644 --- a/lib/midcom/admin/help/help.php +++ b/lib/midcom/admin/help/help.php @@ -45,7 +45,7 @@ private static function get_documentation_dir(string $component) : string return midcom::get()->componentloader->path_to_snippetpath($component) . '/documentation/'; } - public static function generate_file_path(string $help_id, string $component, string $language = null) : ?string + public static function generate_file_path(string $help_id, string $component, ?string $language = null) : ?string { $language ??= midcom::get()->i18n->get_current_language(); diff --git a/lib/midcom/baseclasses/components/base.php b/lib/midcom/baseclasses/components/base.php index d89f22fee..59c5bfdb2 100644 --- a/lib/midcom/baseclasses/components/base.php +++ b/lib/midcom/baseclasses/components/base.php @@ -67,7 +67,7 @@ public function set_active_leaf($leaf_id) /** * Convenience shortcut for adding CSS files */ - public function add_stylesheet(string $url, string $media = null) + public function add_stylesheet(string $url, ?string $media = null) { midcom::get()->head->add_stylesheet($url, $media); } diff --git a/lib/midcom/baseclasses/components/handler/rest.php b/lib/midcom/baseclasses/components/handler/rest.php index acfc04f48..0133fd412 100644 --- a/lib/midcom/baseclasses/components/handler/rest.php +++ b/lib/midcom/baseclasses/components/handler/rest.php @@ -193,7 +193,7 @@ protected function _process_request() : JsonResponse * sends the response as json * containing the current response data */ - private function _send_response(string $message = null) : JsonResponse + private function _send_response(?string $message = null) : JsonResponse { // always add status code and message $this->_response['code'] = $this->_responseStatus; diff --git a/lib/midcom/core/context.php b/lib/midcom/core/context.php index b6d62f9a6..2f0235024 100644 --- a/lib/midcom/core/context.php +++ b/lib/midcom/core/context.php @@ -51,16 +51,16 @@ class midcom_core_context /** * Create and prepare a new component context. * - * @param midcom_db_topic $node Root node of the context + * @param ?midcom_db_topic $node Root node of the context */ - public function __construct(midcom_db_topic $node = null) + public function __construct(?midcom_db_topic $node = null) { $this->_data[MIDCOM_CONTEXT_URI] = $_SERVER['REQUEST_URI'] ?? ''; $this->_data[MIDCOM_CONTEXT_ROOTTOPIC] = $node; $this->id = self::$counter++; } - public static function enter(string $url = null, midcom_db_topic $topic = null) : self + public static function enter(?string $url = null, ?midcom_db_topic $topic = null) : self { $context = new static($topic); array_push(self::$stack, $context); diff --git a/lib/midcom/core/dbaobject.php b/lib/midcom/core/dbaobject.php index a267fe377..6327a5821 100644 --- a/lib/midcom/core/dbaobject.php +++ b/lib/midcom/core/dbaobject.php @@ -157,7 +157,7 @@ public static function new_query_builder() : midcom_core_querybuilder * @param string $domain The domain property of the collector instance * @param mixed $value Value match for the collector instance */ - public static function new_collector(string $domain = null, $value = null) : midcom_core_collector + public static function new_collector(?string $domain = null, $value = null) : midcom_core_collector { return midcom::get()->dbfactory->new_collector(get_called_class(), $domain, $value); } @@ -347,11 +347,11 @@ public function can_user_do(string $privilege, $user = null) : bool { return midcom::get()->auth->can_user_do($privilege, $user, $this->__midcom_class_name__); } - public function require_do(string $privilege, string $message = null) + public function require_do(string $privilege, ?string $message = null) { midcom::get()->auth->require_do($privilege, $this, $message); } - public function require_user_do(string $privilege, string $message = null) + public function require_user_do(string $privilege, ?string $message = null) { midcom::get()->auth->require_user_do($privilege, $message, $this->__midcom_class_name__); } diff --git a/lib/midcom/core/privilege.php b/lib/midcom/core/privilege.php index 11f8f25ac..7a8031901 100644 --- a/lib/midcom/core/privilege.php +++ b/lib/midcom/core/privilege.php @@ -193,7 +193,7 @@ public function get_assignee() : ?object /** * Checks whether the current assignee is a magic assignee or an object identifier. */ - public function is_magic_assignee(string $assignee = null) : bool + public function is_magic_assignee(?string $assignee = null) : bool { $assignee ??= $this->assignee; return in_array($assignee, ['SELF', 'EVERYONE', 'USERS', 'ANONYMOUS', 'OWNER']); diff --git a/lib/midcom/db/attachment.php b/lib/midcom/db/attachment.php index 7f5e7c679..40b7a4e08 100644 --- a/lib/midcom/db/attachment.php +++ b/lib/midcom/db/attachment.php @@ -155,7 +155,7 @@ private function get_cache_path() : string return "{$cacheroot}/{$subdir}/{$this->guid}/{$this->name}"; } - public static function get_url(midgard_attachment|midcom_db_attachment|string $attachment, string $name = null) : string + public static function get_url(midgard_attachment|midcom_db_attachment|string $attachment, ?string $name = null) : string { if (is_string($attachment)) { $guid = $attachment; diff --git a/lib/midcom/error/forbidden.php b/lib/midcom/error/forbidden.php index c6fbf78e7..9e9c8aab9 100644 --- a/lib/midcom/error/forbidden.php +++ b/lib/midcom/error/forbidden.php @@ -17,7 +17,7 @@ class midcom_error_forbidden extends midcom_error { private string $method; - public function __construct(string $message = null, int $code = Response::HTTP_FORBIDDEN, string $method = 'form') + public function __construct(?string $message = null, int $code = Response::HTTP_FORBIDDEN, string $method = 'form') { $message ??= midcom::get()->i18n->get_string('access denied', 'midcom'); $this->method = $method; diff --git a/lib/midcom/helper/configuration.php b/lib/midcom/helper/configuration.php index eed7123d5..c52a73744 100644 --- a/lib/midcom/helper/configuration.php +++ b/lib/midcom/helper/configuration.php @@ -80,7 +80,7 @@ class midcom_helper_configuration * @param mixed $source Either an associative array or a Midgard object. * @param string $path Either null or the name of a Parameter domain. */ - public function __construct($source, string $path = null) + public function __construct($source, ?string $path = null) { if ($path !== null) { $this->_object = $source; diff --git a/lib/midcom/helper/head.php b/lib/midcom/helper/head.php index e603adb95..cd6d8677d 100644 --- a/lib/midcom/helper/head.php +++ b/lib/midcom/helper/head.php @@ -247,7 +247,7 @@ public function add_link_head(array $attributes, bool $prepend = false) * * @param string $media The media type(s) for the stylesheet, if any */ - public function add_stylesheet(string $url, string $media = null) + public function add_stylesheet(string $url, ?string $media = null) { $this->add_link_head($this->prepare_stylesheet_attributes($url, $media)); } @@ -257,7 +257,7 @@ public function add_stylesheet(string $url, string $media = null) * * @param string $media The media type(s) for the stylesheet, if any */ - public function prepend_stylesheet(string $url, string $media = null) + public function prepend_stylesheet(string $url, ?string $media = null) { $this->add_link_head($this->prepare_stylesheet_attributes($url, $media), true); } diff --git a/lib/midcom/helper/imagepopup/handler/list.php b/lib/midcom/helper/imagepopup/handler/list.php index e7048ac8f..09e404280 100644 --- a/lib/midcom/helper/imagepopup/handler/list.php +++ b/lib/midcom/helper/imagepopup/handler/list.php @@ -22,7 +22,7 @@ class midcom_helper_imagepopup_handler_list extends midcom_baseclasses_component */ private array $_search_results = []; - public function _handler_list(Request $request, string $handler_id, string $filetype, array &$data, string $guid = null) + public function _handler_list(Request $request, string $handler_id, string $filetype, array &$data, ?string $guid = null) { midcom::get()->cache->content->no_cache(); midcom::get()->auth->require_valid_user(); diff --git a/lib/midcom/helper/imagepopup/handler/upload.php b/lib/midcom/helper/imagepopup/handler/upload.php index 5c126d412..8309e1eef 100644 --- a/lib/midcom/helper/imagepopup/handler/upload.php +++ b/lib/midcom/helper/imagepopup/handler/upload.php @@ -17,7 +17,7 @@ */ class midcom_helper_imagepopup_handler_upload extends midcom_baseclasses_components_handler { - public function _handler_upload(Request $request, string $guid = null) + public function _handler_upload(Request $request, ?string $guid = null) { // Get the file $temp = $request->files->get('file'); diff --git a/lib/midcom/helper/nav/main.php b/lib/midcom/helper/nav/main.php index b914f9772..7368719d5 100644 --- a/lib/midcom/helper/nav/main.php +++ b/lib/midcom/helper/nav/main.php @@ -331,7 +331,7 @@ public function find_closest_topic(midcom_core_dbaobject $object) : ?midcom_db_t * @param int $skip_levels The number of topic levels to skip before starting to work (use this to skip 'Home' links etc.). * @param string $current_class The class that should be assigned to the currently active element. */ - public function get_breadcrumb_line(string $separator = ' > ', string $class = null, int $skip_levels = 0, string $current_class = null, array $skip_guids = []) : string + public function get_breadcrumb_line(string $separator = ' > ', ?string $class = null, int $skip_levels = 0, ?string $current_class = null, array $skip_guids = []) : string { $breadcrumb_data = $this->get_breadcrumb_data(); $result = ''; diff --git a/lib/midcom/helper/reflector/nameresolver.php b/lib/midcom/helper/reflector/nameresolver.php index ad922bfc0..1a7ff0a5b 100644 --- a/lib/midcom/helper/reflector/nameresolver.php +++ b/lib/midcom/helper/reflector/nameresolver.php @@ -29,7 +29,7 @@ public function __construct(object $object) * @param string $name_property property to use as "name", if left to default (null), will be reflected * @return string value of name property or null on failure */ - public function get_object_name(string $name_property = null) : ?string + public function get_object_name(?string $name_property = null) : ?string { $name_property ??= midcom_helper_reflector::get_name_property($this->_object); if ( empty($name_property) @@ -46,7 +46,7 @@ public function get_object_name(string $name_property = null) : ?string * @see http://trac.midgard-project.org/ticket/809 * @param string $name_property property to use as "name", if left to default (null), will be reflected */ - public function name_is_clean(string $name_property = null) : bool + public function name_is_clean(?string $name_property = null) : bool { if ($name_copy = $this->get_object_name($name_property)) { return $name_copy === midcom_helper_misc::urlize($name_copy); @@ -61,7 +61,7 @@ public function name_is_clean(string $name_property = null) : bool * @see http://trac.midgard-project.org/ticket/809 * @param string $name_property property to use as "name", if left to default (null), will be reflected */ - public function name_is_safe(string $name_property = null) : bool + public function name_is_safe(?string $name_property = null) : bool { if ($name_copy = $this->get_object_name($name_property)) { return $name_copy === rawurlencode($name_copy); diff --git a/lib/midcom/helper/toolbar.php b/lib/midcom/helper/toolbar.php index 139861671..d3bf74086 100644 --- a/lib/midcom/helper/toolbar.php +++ b/lib/midcom/helper/toolbar.php @@ -182,7 +182,7 @@ class midcom_helper_toolbar * Note that the styles can be changed after construction by updating * the id_style and class_style members. */ - public function __construct(string $class_style = 'midcom_toolbar', string $id_style = null) + public function __construct(string $class_style = 'midcom_toolbar', ?string $id_style = null) { $this->id_style = $id_style; $this->class_style = $class_style; diff --git a/lib/midcom/helper/toolbar/view.php b/lib/midcom/helper/toolbar/view.php index 9f2f8f3ac..0fdd9be36 100644 --- a/lib/midcom/helper/toolbar/view.php +++ b/lib/midcom/helper/toolbar/view.php @@ -17,7 +17,7 @@ class midcom_helper_toolbar_view extends midcom_helper_toolbar * @param string $class_style The class style tag for the UL. * @param string $id_style The id style tag for the UL. */ - public function __construct(string $class_style = null, string $id_style = null) + public function __construct(?string $class_style = null, ?string $id_style = null) { $config = midcom::get()->config; $class_style = $class_style ?: $config->get('toolbars_view_style_class'); diff --git a/lib/midcom/services/auth/backend.php b/lib/midcom/services/auth/backend.php index 0e2d2fa62..852892c9e 100644 --- a/lib/midcom/services/auth/backend.php +++ b/lib/midcom/services/auth/backend.php @@ -162,7 +162,7 @@ public function authenticate(string $username, string $password, bool $trusted = * Creates a login session using the given credentials. It assumes that * no login has concluded earlier */ - public function login(string $username, string $password, string $clientip = null, bool $trusted = false) : ?midcom_core_user + public function login(string $username, string $password, ?string $clientip = null, bool $trusted = false) : ?midcom_core_user { $user = $this->authenticate($username, $password, $trusted); diff --git a/lib/midcom/services/auth/main.php b/lib/midcom/services/auth/main.php index 1478c99db..49e471cc7 100644 --- a/lib/midcom/services/auth/main.php +++ b/lib/midcom/services/auth/main.php @@ -224,7 +224,7 @@ public function can_user_do(string $privilege, $user = null, $class = null) : bo * * @param string $domain The domain to request sudo for. This is a component name. */ - public function request_sudo(string $domain = null) : bool + public function request_sudo(?string $domain = null) : bool { if (!midcom::get()->config->get('auth_allow_sudo')) { debug_add("SUDO is not allowed on this website.", MIDCOM_LOG_ERROR); @@ -274,7 +274,7 @@ public function is_component_sudo() : bool * * It always returns true for administrative users. */ - public function is_group_member(midcom_core_group|string $group, midcom_core_user $user = null) : bool + public function is_group_member(midcom_core_group|string $group, ?midcom_core_user $user = null) : bool { if ($this->is_admin($user)) { // Administrators always have access. @@ -313,7 +313,7 @@ public function is_valid_user() : bool * * @param MidgardObject $content_object A Midgard Content Object */ - public function require_do(string $privilege, object $content_object, string $message = null) + public function require_do(string $privilege, object $content_object, ?string $message = null) { if (!$this->can_do($privilege, $content_object)) { throw $this->access_denied($message, 'privilege %s not granted', $privilege); @@ -336,7 +336,7 @@ public function require_do(string $privilege, object $content_object, string $me * * @param string $class Optional parameter to set if the check should take type specific permissions into account. The class must be default constructible. */ - public function require_user_do(string $privilege, string $message = null, string $class = null) + public function require_user_do(string $privilege, ?string $message = null, ?string $class = null) { if (!$this->can_user_do($privilege, class: $class)) { throw $this->access_denied($message, 'privilege %s not granted', $privilege); @@ -372,14 +372,14 @@ function require_group_member($group, $message = null) * * If the check is successful, the function returns silently. */ - public function require_admin_user(string $message = null) + public function require_admin_user(?string $message = null) { if (!$this->admin && !$this->_component_sudo) { throw $this->access_denied($message, 'admin level privileges required'); } } - private function access_denied(?string $message, string $fallback, string $data = null) : midcom_error_forbidden + private function access_denied(?string $message, string $fallback, ?string $data = null) : midcom_error_forbidden { if ($message === null) { $message = midcom::get()->i18n->get_string('access denied: ' . $fallback, 'midcom'); @@ -544,7 +544,7 @@ public function get_group(string|int|midcom_db_group|midgard_group $id) : ?midco /** * This call tells the backend to log in. */ - public function login(string $username, string $password, string $clientip = null) : bool + public function login(string $username, string $password, ?string $clientip = null) : bool { if ($user = $this->backend->login($username, $password, $clientip)) { $this->set_user($user); diff --git a/lib/midcom/services/cache/module.php b/lib/midcom/services/cache/module.php index ad19ecf1b..824623a4b 100644 --- a/lib/midcom/services/cache/module.php +++ b/lib/midcom/services/cache/module.php @@ -45,5 +45,5 @@ public function invalidate_all() /** * Invalidate all cache objects related to the given GUID. */ - abstract public function invalidate(string $guid, midcom_core_dbaobject $object = null); + abstract public function invalidate(string $guid, ?midcom_core_dbaobject $object = null); } diff --git a/lib/midcom/services/cache/module/memcache.php b/lib/midcom/services/cache/module/memcache.php index cfc8e7ac8..2e0f2c35c 100644 --- a/lib/midcom/services/cache/module/memcache.php +++ b/lib/midcom/services/cache/module/memcache.php @@ -57,7 +57,7 @@ public function __construct(midcom_config $config, AdapterInterface $backend) /** * {@inheritDoc} */ - public function invalidate(string $guid, midcom_core_dbaobject $object = null) + public function invalidate(string $guid, ?midcom_core_dbaobject $object = null) { foreach ($this->_data_groups as $group) { if ($group == 'ACL') { @@ -89,7 +89,7 @@ public function get(string $data_group, string $key) * Sets a given key in the cache. If the data group is unknown, a Warning-Level error * is logged and putting is denied. */ - public function put(string $data_group, string $key, $data, int $timeout = null) + public function put(string $data_group, string $key, $data, ?int $timeout = null) { if (!in_array($data_group, $this->_data_groups)) { debug_add("Tried to add data to the unknown data group {$data_group}, cannot do that.", MIDCOM_LOG_WARN); diff --git a/lib/midcom/services/cache/module/nap.php b/lib/midcom/services/cache/module/nap.php index 8c8bc060e..8ac802457 100644 --- a/lib/midcom/services/cache/module/nap.php +++ b/lib/midcom/services/cache/module/nap.php @@ -34,7 +34,7 @@ class midcom_services_cache_module_nap extends midcom_services_cache_module /** * {@inheritDoc} */ - public function invalidate(string $guid, midcom_core_dbaobject $object = null) + public function invalidate(string $guid, ?midcom_core_dbaobject $object = null) { $napobject = $this->get_guid($guid); diff --git a/lib/midcom/services/i18n/formatter.php b/lib/midcom/services/i18n/formatter.php index 5b4b0d84a..1d7b26a4f 100644 --- a/lib/midcom/services/i18n/formatter.php +++ b/lib/midcom/services/i18n/formatter.php @@ -55,7 +55,7 @@ public function customdate($value, string $pattern) return $formatter->format($value); } - public function timeframe($start, $end, string $mode = 'both', string $range_separator = null, bool $fulldate = false) : string + public function timeframe($start, $end, string $mode = 'both', ?string $range_separator = null, bool $fulldate = false) : string { $ranger = new Ranger($this->get_locale()); if ($mode !== 'date') { diff --git a/lib/midcom/services/indexer/backend/solr.php b/lib/midcom/services/indexer/backend/solr.php index 4e6daecf7..41ce7f7fe 100644 --- a/lib/midcom/services/indexer/backend/solr.php +++ b/lib/midcom/services/indexer/backend/solr.php @@ -91,7 +91,7 @@ private function post(bool $optimize = false) /** * {@inheritDoc} */ - public function query(string $querystring, midcom_services_indexer_filter $filter = null, array $options = []) : array + public function query(string $querystring, ?midcom_services_indexer_filter $filter = null, array $options = []) : array { // FIXME: adapt the whole indexer system to fetching enable querying for counts and slices $query = array_merge($this->config->get_array('indexer_config_options'), $options); @@ -143,7 +143,7 @@ public function query(string $querystring, midcom_services_indexer_filter $filte return $result; } - private function prepare_request(string $action, string $body = null, string $method = 'GET') : Request + private function prepare_request(string $action, ?string $body = null, string $method = 'GET') : Request { $uri = "http://" . $this->config->get('indexer_xmltcp_host'); $uri .= ":" . $this->config->get('indexer_xmltcp_port'); diff --git a/lib/midcom/services/metadata.php b/lib/midcom/services/metadata.php index ec484f4be..2653c7d38 100644 --- a/lib/midcom/services/metadata.php +++ b/lib/midcom/services/metadata.php @@ -38,7 +38,7 @@ class midcom_services_metadata * @param int $context_id The context to retrieve the view metadata for, this * defaults to the current context. */ - public function get_view_metadata(int $context_id = null) : ?midcom_helper_metadata + public function get_view_metadata(?int $context_id = null) : ?midcom_helper_metadata { $context_id ??= midcom_core_context::get()->id; @@ -86,7 +86,7 @@ public function get_page_class() : string * - unapproved: approvals are enabled for the site but the object is not translated * - hidden: object is hidden via metadata settings or scheduling */ - public function get_object_classes(midcom_core_dbaobject $object, string $existing_classes = null) : string + public function get_object_classes(midcom_core_dbaobject $object, ?string $existing_classes = null) : string { $css_classes = []; if ($existing_classes !== null) { @@ -303,7 +303,7 @@ public function set_request_metadata(int $lastmodified, ?string $permalinkguid) * values set with the setter pendant. For ease of use, there is also a key 'permalink' * which contains a ready-made permalink. */ - public function get_request_metadata(midcom_core_context $context = null) : array + public function get_request_metadata(?midcom_core_context $context = null) : array { $context ??= midcom_core_context::get(); return [ diff --git a/lib/midcom/services/session.php b/lib/midcom/services/session.php index 117d445c0..11ef78591 100644 --- a/lib/midcom/services/session.php +++ b/lib/midcom/services/session.php @@ -59,7 +59,7 @@ class midcom_services_session * is useful for components that need sessioning while under dynamic_load * conditions or while used as a library. */ - public function __construct(string $domain = null) + public function __construct(?string $domain = null) { $this->_domain = $domain ?? midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT); diff --git a/lib/midgard/admin/asgard/handler/component/configuration.php b/lib/midgard/admin/asgard/handler/component/configuration.php index 19f79f8d7..7c8c2b755 100644 --- a/lib/midgard/admin/asgard/handler/component/configuration.php +++ b/lib/midgard/admin/asgard/handler/component/configuration.php @@ -135,7 +135,7 @@ private function render($value) return $result; } - public function _handler_edit(Request $request, string $handler_id, array &$data, string $component, string $folder = null) + public function _handler_edit(Request $request, string $handler_id, array &$data, string $component, ?string $folder = null) { $data['name'] = $component; if ($folder) { diff --git a/lib/midgard/admin/asgard/handler/handler.php b/lib/midgard/admin/asgard/handler/handler.php index 41775f931..b1e58e58b 100644 --- a/lib/midgard/admin/asgard/handler/handler.php +++ b/lib/midgard/admin/asgard/handler/handler.php @@ -13,7 +13,7 @@ */ trait midgard_admin_asgard_handler { - public function get_response(string $element = null) : midcom_response_styled + public function get_response(?string $element = null) : midcom_response_styled { if (isset($_GET['ajax'])) { midcom::get()->skip_page_style = true; diff --git a/lib/midgard/admin/asgard/handler/object/manage.php b/lib/midgard/admin/asgard/handler/object/manage.php index 6204645ff..9d0be4ed6 100644 --- a/lib/midgard/admin/asgard/handler/object/manage.php +++ b/lib/midgard/admin/asgard/handler/object/manage.php @@ -71,7 +71,7 @@ private function _prepare_request_data() /** * Loads the schemadb from the helper class */ - private function _load_schemadb(midcom_core_dbaobject $object = null, array $include_fields = null, bool $add_copy_fields = false) + private function _load_schemadb(?midcom_core_dbaobject $object = null, ?array $include_fields = null, bool $add_copy_fields = false) { $schema_helper = new midgard_admin_asgard_schemadb($object ?? $this->_object, $this->_config); $schema_helper->add_copy_fields = $add_copy_fields; diff --git a/lib/net/nehmer/comments/handler.php b/lib/net/nehmer/comments/handler.php index df2f9eb33..21b46504b 100644 --- a/lib/net/nehmer/comments/handler.php +++ b/lib/net/nehmer/comments/handler.php @@ -13,7 +13,7 @@ */ trait net_nehmer_comments_handler { - public function populate_post_toolbar(net_nehmer_comments_comment $comment, string $viewtype = null) : midcom_helper_toolbar + public function populate_post_toolbar(net_nehmer_comments_comment $comment, ?string $viewtype = null) : midcom_helper_toolbar { $toolbar = new midcom_helper_toolbar(); if (!midcom::get()->auth->is_valid_user() diff --git a/lib/net/nehmer/comments/handler/view.php b/lib/net/nehmer/comments/handler/view.php index 1c96bb458..6294322e2 100644 --- a/lib/net/nehmer/comments/handler/view.php +++ b/lib/net/nehmer/comments/handler/view.php @@ -125,7 +125,7 @@ private function _init_post_controller(Request $request) * Loads the comments, does any processing according to the state of the GET list. * On successful processing we relocate once to ourself. */ - public function _handler_comments(Request $request, string $handler_id, array &$data, string $guid, string $view = null) + public function _handler_comments(Request $request, string $handler_id, array &$data, string $guid, ?string $view = null) { $this->_objectguid = $guid; midcom::get()->cache->content->register($this->_objectguid); diff --git a/lib/net/nehmer/static/viewer.php b/lib/net/nehmer/static/viewer.php index 4033392ac..23775056e 100644 --- a/lib/net/nehmer/static/viewer.php +++ b/lib/net/nehmer/static/viewer.php @@ -94,7 +94,7 @@ public function _on_handle($handler, array $args) $this->_populate_node_toolbar(); } - public static function get_topic_qb(int $id, string $sort_property = null) : midcom_core_querybuilder + public static function get_topic_qb(int $id, ?string $sort_property = null) : midcom_core_querybuilder { $qb = midcom_db_article::new_query_builder(); $qb->add_constraint('topic', '=', $id); diff --git a/lib/net/nemein/rss/handler/admin.php b/lib/net/nemein/rss/handler/admin.php index a662d7a0b..61993fece 100644 --- a/lib/net/nemein/rss/handler/admin.php +++ b/lib/net/nemein/rss/handler/admin.php @@ -23,7 +23,7 @@ private function _load_controller(array &$data) ->get_controller(); } - private function _subscribe_feed(string $feed_url, string $feed_title = null) + private function _subscribe_feed(string $feed_url, ?string $feed_title = null) { // Try to fetch the new feed $rss = net_nemein_rss_fetch::raw_fetch($feed_url); diff --git a/lib/net/nemein/rss/handler/fetch.php b/lib/net/nemein/rss/handler/fetch.php index dc80a0061..47c0f2bee 100644 --- a/lib/net/nemein/rss/handler/fetch.php +++ b/lib/net/nemein/rss/handler/fetch.php @@ -13,7 +13,7 @@ */ class net_nemein_rss_handler_fetch extends midcom_baseclasses_components_handler { - public function _handler_fetch(array &$data, string $guid = null) + public function _handler_fetch(array &$data, ?string $guid = null) { $this->_topic->require_do('midgard:create'); midcom::get()->cache->content->no_cache(); diff --git a/lib/net/nemein/wiki/handler/create.php b/lib/net/nemein/wiki/handler/create.php index 4becc1f6e..7f52df5ad 100644 --- a/lib/net/nemein/wiki/handler/create.php +++ b/lib/net/nemein/wiki/handler/create.php @@ -90,7 +90,7 @@ private function check_unique_wikiword(string $wikiword, string $schema) } } - public function _handler_create(Request $request, array &$data, string $schema = null) + public function _handler_create(Request $request, array &$data, ?string $schema = null) { // Initialize sessioning first $session = new midcom_services_session(); diff --git a/lib/net/nemein/wiki/handler/latest.php b/lib/net/nemein/wiki/handler/latest.php index 60b5d1993..c37904181 100644 --- a/lib/net/nemein/wiki/handler/latest.php +++ b/lib/net/nemein/wiki/handler/latest.php @@ -20,7 +20,7 @@ class net_nemein_wiki_handler_latest extends midcom_baseclasses_components_handl /** * List all items updated with then given timeframe */ - private function _seek_updated(int $from, int $to = null) + private function _seek_updated(int $from, ?int $to = null) { $to ??= time(); diff --git a/lib/net/nemein/wiki/parser.php b/lib/net/nemein/wiki/parser.php index 7f3f9d081..1fe908949 100644 --- a/lib/net/nemein/wiki/parser.php +++ b/lib/net/nemein/wiki/parser.php @@ -231,7 +231,7 @@ private function replace_wikiwords(array $match) : string } } - public function render_link(string $wikilink, string $text = null) : string + public function render_link(string $wikilink, ?string $text = null) : string { $text ??= $wikilink; // Don't choke on links with anchors diff --git a/lib/org/openpsa/calendar/handler/event/create.php b/lib/org/openpsa/calendar/handler/event/create.php index e405bedd4..4f20c33fb 100644 --- a/lib/org/openpsa/calendar/handler/event/create.php +++ b/lib/org/openpsa/calendar/handler/event/create.php @@ -60,7 +60,7 @@ private function load_controller(ParameterBag $query, org_openpsa_calendar_valid /** * Handle the creation phase */ - public function _handler_create(Request $request, array &$data, string $resource = null) + public function _handler_create(Request $request, array &$data, ?string $resource = null) { $this->root_event = org_openpsa_calendar_interface::find_root_event(); $this->root_event->require_do('midgard:create'); diff --git a/lib/org/openpsa/contacts/duplicates/check.php b/lib/org/openpsa/contacts/duplicates/check.php index b6364950d..84fc679a7 100644 --- a/lib/org/openpsa/contacts/duplicates/check.php +++ b/lib/org/openpsa/contacts/duplicates/check.php @@ -79,7 +79,7 @@ public function find_duplicates(midcom_core_dbaobject $object, int $threshold = return $ret; } - private function get_candidates(midcom_core_dbaobject $object = null) : array + private function get_candidates(?midcom_core_dbaobject $object = null) : array { $classname = $this->get_class(); $fields = $this->get_fields(); diff --git a/lib/org/openpsa/contacts/handler/group/view.php b/lib/org/openpsa/contacts/handler/group/view.php index c9b898f20..ca9603afc 100644 --- a/lib/org/openpsa/contacts/handler/group/view.php +++ b/lib/org/openpsa/contacts/handler/group/view.php @@ -151,7 +151,7 @@ public function _handler_json(string $guid, array &$data) /** * Get querybuilder for JSON group member list */ - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = midcom_db_person::new_collector(); $qb->get_doctrine() diff --git a/lib/org/openpsa/contacts/handler/person/create.php b/lib/org/openpsa/contacts/handler/person/create.php index 8157669d0..fa10cc08f 100644 --- a/lib/org/openpsa/contacts/handler/person/create.php +++ b/lib/org/openpsa/contacts/handler/person/create.php @@ -19,7 +19,7 @@ class org_openpsa_contacts_handler_person_create extends midcom_baseclasses_comp { private org_openpsa_contacts_person_dba $_person; - public function _handler_create(Request $request, string $guid = null) + public function _handler_create(Request $request, ?string $guid = null) { midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class); diff --git a/lib/org/openpsa/directmarketing/campaign/member.php b/lib/org/openpsa/directmarketing/campaign/member.php index 4cc293bb4..17b369437 100644 --- a/lib/org/openpsa/directmarketing/campaign/member.php +++ b/lib/org/openpsa/directmarketing/campaign/member.php @@ -125,7 +125,7 @@ public function personalize_message(string $content, int $message_type, org_open return $content; } - public function get_unsubscribe_url(array $node = null) : string + public function get_unsubscribe_url(?array $node = null) : string { if (!$node) { $nap = new midcom_helper_nav(); diff --git a/lib/org/openpsa/directmarketing/handler/campaign/campaign.php b/lib/org/openpsa/directmarketing/handler/campaign/campaign.php index b6602b50d..911d5edc8 100644 --- a/lib/org/openpsa/directmarketing/handler/campaign/campaign.php +++ b/lib/org/openpsa/directmarketing/handler/campaign/campaign.php @@ -23,7 +23,7 @@ class org_openpsa_directmarketing_handler_campaign_campaign extends midcom_basec private array $memberships; - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $mc = org_openpsa_directmarketing_campaign_member_dba::new_collector('campaign', $this->_campaign->id); $mc->add_constraint('orgOpenpsaObtype', '<>', org_openpsa_directmarketing_campaign_member_dba::TESTER); diff --git a/lib/org/openpsa/directmarketing/handler/campaign/rules.php b/lib/org/openpsa/directmarketing/handler/campaign/rules.php index 8ed928cd1..6d2bff5c3 100644 --- a/lib/org/openpsa/directmarketing/handler/campaign/rules.php +++ b/lib/org/openpsa/directmarketing/handler/campaign/rules.php @@ -24,7 +24,7 @@ class org_openpsa_directmarketing_handler_campaign_rules extends midcom_baseclas private array $rules; - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $resolver = new org_openpsa_directmarketing_campaign_ruleresolver(); $resolver->resolve($this->rules); diff --git a/lib/org/openpsa/directmarketing/handler/list.php b/lib/org/openpsa/directmarketing/handler/list.php index f96f7741a..2ac873ef6 100644 --- a/lib/org/openpsa/directmarketing/handler/list.php +++ b/lib/org/openpsa/directmarketing/handler/list.php @@ -23,7 +23,7 @@ public function _on_initialize() midcom::get()->auth->require_valid_user(); } - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = org_openpsa_directmarketing_campaign_dba::new_query_builder(); $qb->add_constraint('node', '=', $this->_topic->id); diff --git a/lib/org/openpsa/directmarketing/handler/logger.php b/lib/org/openpsa/directmarketing/handler/logger.php index a892b7eda..0504ab5ba 100644 --- a/lib/org/openpsa/directmarketing/handler/logger.php +++ b/lib/org/openpsa/directmarketing/handler/logger.php @@ -127,7 +127,7 @@ private function _create_link_receipt(org_openpsa_directmarketing_campaign_messa * Duplicates link_detector.php functionality in part (to avoid extra apache configurations) * and handles the logging mentioned above as well. */ - public function _handler_redirect(Request $request, string $token, string $url = null) + public function _handler_redirect(Request $request, string $token, ?string $url = null) { if (!empty($url)) { //Due to the way browsers handle the URLs this form only works for root pages diff --git a/lib/org/openpsa/directmarketing/handler/message/compose.php b/lib/org/openpsa/directmarketing/handler/message/compose.php index b749ba752..b3184b4f3 100644 --- a/lib/org/openpsa/directmarketing/handler/message/compose.php +++ b/lib/org/openpsa/directmarketing/handler/message/compose.php @@ -38,7 +38,7 @@ private function _load_datamanager() * @param string $guid The object's GUID * @param string $person The person's GUID */ - public function _handler_compose(array &$data, string $guid, string $person = null) + public function _handler_compose(array &$data, string $guid, ?string $person = null) { midcom::get()->auth->request_sudo($this->_component); //Load message diff --git a/lib/org/openpsa/directmarketing/sender.php b/lib/org/openpsa/directmarketing/sender.php index 379042119..35449aa29 100644 --- a/lib/org/openpsa/directmarketing/sender.php +++ b/lib/org/openpsa/directmarketing/sender.php @@ -123,7 +123,7 @@ private function process_results(array $results, string $content) : bool return true; } - public function register_send_job(int $batch, string $url_base, int $time = null) : bool + public function register_send_job(int $batch, string $url_base, ?int $time = null) : bool { $time = $time ?: time() + 30; $args = [ diff --git a/lib/org/openpsa/documents/handler/document/view.php b/lib/org/openpsa/documents/handler/document/view.php index a89c07245..06bb4d5f4 100644 --- a/lib/org/openpsa/documents/handler/document/view.php +++ b/lib/org/openpsa/documents/handler/document/view.php @@ -33,7 +33,7 @@ public function _on_initialize() $this->_datamanager = datamanager::from_schemadb($this->_config->get('schemadb_document')); } - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = org_openpsa_documents_document_dba::new_query_builder(); diff --git a/lib/org/openpsa/expenses/handler/hours/admin.php b/lib/org/openpsa/expenses/handler/hours/admin.php index 17b2960c9..3f35976dd 100644 --- a/lib/org/openpsa/expenses/handler/hours/admin.php +++ b/lib/org/openpsa/expenses/handler/hours/admin.php @@ -17,7 +17,7 @@ */ class org_openpsa_expenses_handler_hours_admin extends midcom_baseclasses_components_handler { - private function load_datamanager(org_openpsa_expenses_hour_report_dba $report, array $defaults = [], string $schema = null) : datamanager + private function load_datamanager(org_openpsa_expenses_hour_report_dba $report, array $defaults = [], ?string $schema = null) : datamanager { return datamanager::from_schemadb($this->_config->get('schemadb_hours')) ->set_defaults($defaults) @@ -27,7 +27,7 @@ private function load_datamanager(org_openpsa_expenses_hour_report_dba $report, /** * Displays the report creation view. */ - public function _handler_create(Request $request, string $handler_id, array &$data, string $schema, string $guid = null) + public function _handler_create(Request $request, string $handler_id, array &$data, string $schema, ?string $guid = null) { $report = new org_openpsa_expenses_hour_report_dba(); diff --git a/lib/org/openpsa/httplib/main.php b/lib/org/openpsa/httplib/main.php index 48a6a1e71..bf3b1472b 100644 --- a/lib/org/openpsa/httplib/main.php +++ b/lib/org/openpsa/httplib/main.php @@ -67,7 +67,7 @@ private function get_client() : Client * @param string $url Fully qualified URL * @return string Contents */ - public function get(string $url, array $headers = [], string $username = null, string $password = null) + public function get(string $url, array $headers = [], ?string $username = null, ?string $password = null) { $request = new Request('GET', $url, $headers); diff --git a/lib/org/openpsa/invoices/calculator.php b/lib/org/openpsa/invoices/calculator.php index 6a8a5975b..7e49e43d9 100644 --- a/lib/org/openpsa/invoices/calculator.php +++ b/lib/org/openpsa/invoices/calculator.php @@ -17,7 +17,7 @@ class org_openpsa_invoices_calculator private org_openpsa_invoices_invoice_dba $_invoice; - public function process_deliverable(org_openpsa_sales_salesproject_deliverable_dba $deliverable, int $cycle_number = null) + public function process_deliverable(org_openpsa_sales_salesproject_deliverable_dba $deliverable, ?int $cycle_number = null) { $this->_deliverable = $deliverable; // Recalculate price to catch possible unit changes diff --git a/lib/org/openpsa/invoices/handler/invoice/crud.php b/lib/org/openpsa/invoices/handler/invoice/crud.php index 6bb849bb0..43d13937f 100644 --- a/lib/org/openpsa/invoices/handler/invoice/crud.php +++ b/lib/org/openpsa/invoices/handler/invoice/crud.php @@ -33,7 +33,7 @@ class org_openpsa_invoices_handler_invoice_crud extends midcom_baseclasses_compo /** * Generates an object creation view. */ - public function _handler_create(Request $request, string $company = null) + public function _handler_create(Request $request, ?string $company = null) { $this->mode = 'create'; midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class); diff --git a/lib/org/openpsa/invoices/handler/scheduled.php b/lib/org/openpsa/invoices/handler/scheduled.php index 17070d8ae..0d2cb5de0 100644 --- a/lib/org/openpsa/invoices/handler/scheduled.php +++ b/lib/org/openpsa/invoices/handler/scheduled.php @@ -36,7 +36,7 @@ public function _handler_list(array &$data) return $this->show('show-scheduled'); } - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = midcom_services_at_entry_dba::new_query_builder(); $qb->add_constraint('method', '=', 'new_subscription_cycle'); diff --git a/lib/org/openpsa/products/handler/list.php b/lib/org/openpsa/products/handler/list.php index 870b3596d..e674f3bc1 100644 --- a/lib/org/openpsa/products/handler/list.php +++ b/lib/org/openpsa/products/handler/list.php @@ -29,7 +29,7 @@ public function _on_initialize() $this->provider = new provider($this); } - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = org_openpsa_products_product_dba::new_query_builder(); diff --git a/lib/org/openpsa/projects/handler/task/crud.php b/lib/org/openpsa/projects/handler/task/crud.php index 1b95c75ac..a7ef218f0 100644 --- a/lib/org/openpsa/projects/handler/task/crud.php +++ b/lib/org/openpsa/projects/handler/task/crud.php @@ -27,7 +27,7 @@ class org_openpsa_projects_handler_task_crud extends midcom_baseclasses_componen /** * Generates an object creation view. */ - public function _handler_create(Request $request, string $type = null, string $guid = null) + public function _handler_create(Request $request, ?string $type = null, ?string $guid = null) { $this->mode = 'create'; $this->task = new org_openpsa_projects_task_dba; diff --git a/lib/org/openpsa/projects/handler/task/list.php b/lib/org/openpsa/projects/handler/task/list.php index ba40f6a68..7aa20c709 100644 --- a/lib/org/openpsa/projects/handler/task/list.php +++ b/lib/org/openpsa/projects/handler/task/list.php @@ -180,7 +180,7 @@ private function render_status($ids, string $message) : string return sprintf($this->_l10n->get($message), $person_string); } - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { if ($field !== null) { $this->qb->add_order($field, $direction); diff --git a/lib/org/openpsa/relatedto/plugin.php b/lib/org/openpsa/relatedto/plugin.php index 2ea33b72a..36f3a9ef1 100644 --- a/lib/org/openpsa/relatedto/plugin.php +++ b/lib/org/openpsa/relatedto/plugin.php @@ -23,7 +23,7 @@ class org_openpsa_relatedto_plugin extends midcom_baseclasses_components_plugin * * @param array $extra Array with the possible extra-properties */ - public static function create(object $from_obj, string $from_component, object $to_obj, string $to_component, int $status = null, array $extra = []) : ?org_openpsa_relatedto_dba + public static function create(object $from_obj, string $from_component, object $to_obj, string $to_component, ?int $status = null, array $extra = []) : ?org_openpsa_relatedto_dba { $status ??= org_openpsa_relatedto_dba::CONFIRMED; diff --git a/lib/org/openpsa/reports/handler/sales/report.php b/lib/org/openpsa/reports/handler/sales/report.php index 19c2f77ee..92c756f85 100644 --- a/lib/org/openpsa/reports/handler/sales/report.php +++ b/lib/org/openpsa/reports/handler/sales/report.php @@ -21,7 +21,7 @@ class org_openpsa_reports_handler_sales_report extends org_openpsa_reports_handl /** * {@inheritdoc} */ - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = org_openpsa_invoices_invoice_item_dba::new_query_builder(); diff --git a/lib/org/openpsa/sales/calculator/default.php b/lib/org/openpsa/sales/calculator/default.php index 078dfe81e..b4e061aa3 100644 --- a/lib/org/openpsa/sales/calculator/default.php +++ b/lib/org/openpsa/sales/calculator/default.php @@ -76,7 +76,7 @@ public function get_invoice_items(org_openpsa_invoices_invoice_dba $invoice) : a return [$this->generate_invoice_item($description, $this->deliverable->units, $invoice->id)]; } - protected function generate_invoice_item(string $description, float $units, int $invoice, org_openpsa_projects_task_dba $task = null) : org_openpsa_invoices_invoice_item_dba + protected function generate_invoice_item(string $description, float $units, int $invoice, ?org_openpsa_projects_task_dba $task = null) : org_openpsa_invoices_invoice_item_dba { $item = new org_openpsa_invoices_invoice_item_dba(); $item->description = $description; diff --git a/lib/org/openpsa/sales/handler/deliverable/list.php b/lib/org/openpsa/sales/handler/deliverable/list.php index f425cef33..84d843064 100644 --- a/lib/org/openpsa/sales/handler/deliverable/list.php +++ b/lib/org/openpsa/sales/handler/deliverable/list.php @@ -19,7 +19,7 @@ class org_openpsa_sales_handler_deliverable_list extends midcom_baseclasses_comp { private org_openpsa_products_product_dba $_product; - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $mc = org_openpsa_sales_salesproject_deliverable_dba::new_collector('product', $this->_product->id); if ($field !== null) { diff --git a/lib/org/openpsa/sales/handler/edit.php b/lib/org/openpsa/sales/handler/edit.php index 2ccf98f0b..05b95b298 100644 --- a/lib/org/openpsa/sales/handler/edit.php +++ b/lib/org/openpsa/sales/handler/edit.php @@ -35,7 +35,7 @@ public function _handler_edit(Request $request, string $guid) return $workflow->run($request); } - public function _handler_new(Request $request, string $guid = null) + public function _handler_new(Request $request, ?string $guid = null) { midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_sales_salesproject_dba::class); diff --git a/lib/org/openpsa/user/accounthelper.php b/lib/org/openpsa/user/accounthelper.php index a46acb7ad..e643e5638 100644 --- a/lib/org/openpsa/user/accounthelper.php +++ b/lib/org/openpsa/user/accounthelper.php @@ -21,7 +21,7 @@ class org_openpsa_user_accounthelper public string $errstr; - public function __construct(midcom_db_person $person = null) + public function __construct(?midcom_db_person $person = null) { $this->_component = 'org.openpsa.user'; if (null !== $person) { @@ -454,7 +454,7 @@ public static function get_person_by_formdata(array $data) : ?midcom_db_person * * @param string $component the component we take the config values from */ - public function check_login_attempts(string $component = null) : bool + public function check_login_attempts(?string $component = null) : bool { $stat = true; $component = $component ?: "org.openpsa.user"; diff --git a/lib/org/openpsa/user/handler/list.php b/lib/org/openpsa/user/handler/list.php index d0276ab48..496b037a3 100644 --- a/lib/org/openpsa/user/handler/list.php +++ b/lib/org/openpsa/user/handler/list.php @@ -30,7 +30,7 @@ public function _on_initialize() /** * Handler for listing users */ - public function _handler_list(array &$data, string $guid = null) + public function _handler_list(array &$data, ?string $guid = null) { $auth = midcom::get()->auth; if (!$auth->can_user_do('org.openpsa.user:access', class: org_openpsa_user_interface::class)) { @@ -69,7 +69,7 @@ public function _handler_list(array &$data, string $guid = null) /** * Lists users in JSON format */ - public function _handler_json(array &$data, string $guid = null) + public function _handler_json(array &$data, ?string $guid = null) { midcom::get()->skip_page_style = true; $data['provider'] = $this->_provider; @@ -83,7 +83,7 @@ public function _handler_json(array &$data, string $guid = null) /** * Get querybuilder for JSON user list */ - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : midcom_core_query { $qb = midcom_db_person::new_collector(); diff --git a/lib/org/openpsa/user/handler/person/create.php b/lib/org/openpsa/user/handler/person/create.php index 322d260cb..6a10c1fe9 100644 --- a/lib/org/openpsa/user/handler/person/create.php +++ b/lib/org/openpsa/user/handler/person/create.php @@ -57,7 +57,7 @@ private function load_controller() : controller ->get_controller(); } - public function _handler_create(Request $request, array &$data, string $guid = null) + public function _handler_create(Request $request, array &$data, ?string $guid = null) { midcom::get()->auth->require_user_do('org.openpsa.user:manage', class: org_openpsa_user_interface::class); diff --git a/lib/org/openpsa/user/validator.php b/lib/org/openpsa/user/validator.php index 07260a533..774d4837a 100644 --- a/lib/org/openpsa/user/validator.php +++ b/lib/org/openpsa/user/validator.php @@ -20,7 +20,7 @@ public function __construct() $this->l10n = midcom::get()->i18n->get_l10n('org.openpsa.user'); } - protected function get_accounthelper(midcom_db_person $person = null) : org_openpsa_user_accounthelper + protected function get_accounthelper(?midcom_db_person $person = null) : org_openpsa_user_accounthelper { return new org_openpsa_user_accounthelper($person); } diff --git a/lib/org/openpsa/widgets/calendar/event.php b/lib/org/openpsa/widgets/calendar/event.php index 4acb2fbcc..2ceb3c3b0 100644 --- a/lib/org/openpsa/widgets/calendar/event.php +++ b/lib/org/openpsa/widgets/calendar/event.php @@ -65,7 +65,7 @@ class org_openpsa_widgets_calendar_event */ var $event; - public function __construct(org_openpsa_calendar_event_dba $event = null) + public function __construct(?org_openpsa_calendar_event_dba $event = null) { if ($event) { $this->event = $event; diff --git a/src/midcom/datamanager/datamanager.php b/src/midcom/datamanager/datamanager.php index a0ed7cbf7..960087e99 100644 --- a/src/midcom/datamanager/datamanager.php +++ b/src/midcom/datamanager/datamanager.php @@ -55,7 +55,7 @@ public function set_defaults(array $defaults) : self return $this; } - public function set_storage(midcom_core_dbaobject $storage = null, string $schemaname = null) : self + public function set_storage(?midcom_core_dbaobject $storage = null, ?string $schemaname = null) : self { if ( $schemaname === null && !empty($storage->id)) { @@ -96,7 +96,7 @@ private function set_schema(?string $name) $this->schema = $schema; } - public function get_schema(string $name = null) : schema + public function get_schema(?string $name = null) : schema { if ($name) { return $this->schemadb->get($name); @@ -135,7 +135,7 @@ public function get_renderer($template = null, bool $skip_empty = false) : rende return $this->renderer; } - public function get_controller(string $name = null) : controller + public function get_controller(?string $name = null) : controller { return new controller($this, $name); } @@ -158,7 +158,7 @@ public function get_form(?string $name = null, bool $reset = false) : Form * The builder instance needs to be passed back to build_form() for the modifications * to have a consistent effect. */ - public function get_builder(string $name = null) : FormBuilderInterface + public function get_builder(?string $name = null) : FormBuilderInterface { $config = [ 'schema' => $this->get_schema() diff --git a/src/midcom/dba/parameters.php b/src/midcom/dba/parameters.php index 704fca58d..c5af79487 100644 --- a/src/midcom/dba/parameters.php +++ b/src/midcom/dba/parameters.php @@ -93,7 +93,7 @@ public function get_parameter(string $domain, string $name) * * @param string $domain The parameter domain to query, this may be null to indicate a full listing. */ - public function list_parameters(string $domain = null) : array + public function list_parameters(?string $domain = null) : array { if (!$this->guid) { debug_add('Cannot retrieve information on a non-persistent object.', MIDCOM_LOG_INFO); diff --git a/src/midcom/grid/grid.php b/src/midcom/grid/grid.php index 011e70276..a608b338c 100644 --- a/src/midcom/grid/grid.php +++ b/src/midcom/grid/grid.php @@ -251,7 +251,7 @@ public function prepend_js(string $string) /** * Renders the grid as HTML */ - public function render(array $entries = null) + public function render(?array $entries = null) { if (is_array($entries)) { if (null !== $this->_provider) { diff --git a/src/midcom/grid/provider/client.php b/src/midcom/grid/provider/client.php index a27160dc7..f5ac62803 100644 --- a/src/midcom/grid/provider/client.php +++ b/src/midcom/grid/provider/client.php @@ -23,7 +23,7 @@ interface client * @param array $search Optional search filters * @return \midcom_core_query QB or MC instance */ - public function get_qb(string $field = null, string $direction = 'ASC', array $search = []) : \midcom_core_query; + public function get_qb(?string $field = null, string $direction = 'ASC', array $search = []) : \midcom_core_query; /** * Transfers a result object into a grid row diff --git a/test/midcom/helper/__files/xml_constraint.php b/test/midcom/helper/__files/xml_constraint.php index 4a7365ed5..be6d8ed0a 100644 --- a/test/midcom/helper/__files/xml_constraint.php +++ b/test/midcom/helper/__files/xml_constraint.php @@ -51,7 +51,7 @@ private function _normalize_string($string, int $argument = 1) return $new_doc->saveXML(); } - private function copy($nodes, DOMDocument $new_doc, DOMNode $parent = null) + private function copy($nodes, DOMDocument $new_doc, ?DOMNode $parent = null) { $map = []; foreach ($nodes as $node) { diff --git a/test/midcom/helper/exporter/xmlTest.php b/test/midcom/helper/exporter/xmlTest.php index ba1173b86..62fbc521e 100644 --- a/test/midcom/helper/exporter/xmlTest.php +++ b/test/midcom/helper/exporter/xmlTest.php @@ -99,7 +99,7 @@ private function assert_xml_data($expected, $actual) self::assertThat($actual, $constraint); } - private function _get_data_array(org_openpsa_projects_project $project = null) + private function _get_data_array(?org_openpsa_projects_project $project = null) { return [ 'midcom_helper_metadata' => [ diff --git a/test/utilities/testcase.php b/test/utilities/testcase.php index 49e98ce6b..116a94fa4 100644 --- a/test/utilities/testcase.php +++ b/test/utilities/testcase.php @@ -107,7 +107,7 @@ public function set_config(string $component, string $key, $value) midcom_baseclasses_components_configuration::set($component, 'config', new midcom_helper_configuration($config->get_all())); } - public function run_handler($topic, array $args = [], Request $request = null) : array + public function run_handler($topic, array $args = [], ?Request $request = null) : array { if (is_object($topic)) { $component = $topic->component;