From ee9d139a3a9b9394b62c7810eb5cf5fb0ed8e8a2 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Wed, 16 Aug 2023 11:30:23 +0200 Subject: [PATCH] PhpDoc: Fix incorrect `@param` and `@return` type hints --- application/forms/Config/ResourceConfigForm.php | 2 +- application/forms/RepositoryForm.php | 2 +- library/Icinga/Application/Benchmark.php | 1 - library/Icinga/Application/Platform.php | 2 +- library/Icinga/Chart/Graph/BarGraph.php | 2 +- library/Icinga/Date/DateFormatter.php | 6 +++--- library/Icinga/Protocol/Ldap/Discovery.php | 2 +- library/Icinga/Repository/IniRepository.php | 4 +--- library/Icinga/Repository/LdapRepository.php | 2 +- library/Icinga/Repository/Repository.php | 4 ++-- library/Icinga/Web/Controller.php | 2 +- library/Icinga/Web/Form/Decorator/FormDescriptions.php | 2 +- library/Icinga/Web/Form/Decorator/FormHints.php | 2 +- library/Icinga/Web/Form/Decorator/FormNotifications.php | 2 +- library/Icinga/Web/Form/Decorator/Help.php | 2 +- library/Icinga/Web/Form/Decorator/Spinner.php | 2 +- library/Icinga/Web/Navigation/Navigation.php | 2 +- library/Icinga/Web/Url.php | 2 +- modules/doc/application/controllers/IcingawebController.php | 2 +- modules/doc/application/controllers/SearchController.php | 2 +- .../monitoring/application/controllers/EventController.php | 6 +++--- .../Command/Renderer/IcingaApiCommandRenderer.php | 2 -- .../monitoring/library/Monitoring/Timeline/TimeRange.php | 2 +- modules/setup/library/Setup/Step.php | 2 +- modules/setup/library/Setup/Utils/DbTool.php | 6 +++--- 25 files changed, 30 insertions(+), 35 deletions(-) diff --git a/application/forms/Config/ResourceConfigForm.php b/application/forms/Config/ResourceConfigForm.php index 3b7ca24eb..c2d0d18f3 100644 --- a/application/forms/Config/ResourceConfigForm.php +++ b/application/forms/Config/ResourceConfigForm.php @@ -295,7 +295,7 @@ class ResourceConfigForm extends ConfigForm * * @param Form $form * - * @return Inspection + * @return ?Inspection */ public static function inspectResource(Form $form) { diff --git a/application/forms/RepositoryForm.php b/application/forms/RepositoryForm.php index 22718eead..8e4665d80 100644 --- a/application/forms/RepositoryForm.php +++ b/application/forms/RepositoryForm.php @@ -321,7 +321,7 @@ abstract class RepositoryForm extends Form /** * Apply the requested mode on the repository * - * @return bool + * @return ?bool */ public function onSuccess() { diff --git a/library/Icinga/Application/Benchmark.php b/library/Icinga/Application/Benchmark.php index 9ff48f794..32a05ec98 100644 --- a/library/Icinga/Application/Benchmark.php +++ b/library/Icinga/Application/Benchmark.php @@ -78,7 +78,6 @@ class Benchmark * you prefer to show either time or memory or both in your output * * @param ?int $what Whether to get time and/or memory summary - * @return string */ public static function dump($what = null) { diff --git a/library/Icinga/Application/Platform.php b/library/Icinga/Application/Platform.php index b1b8d906d..025bf7729 100644 --- a/library/Icinga/Application/Platform.php +++ b/library/Icinga/Application/Platform.php @@ -260,7 +260,7 @@ class Platform /** * Return the username PHP is running as * - * @return string + * @return ?string */ public static function getPhpUser() { diff --git a/library/Icinga/Chart/Graph/BarGraph.php b/library/Icinga/Chart/Graph/BarGraph.php index 33429f5a9..c7b4aaa36 100644 --- a/library/Icinga/Chart/Graph/BarGraph.php +++ b/library/Icinga/Chart/Graph/BarGraph.php @@ -98,7 +98,7 @@ class BarGraph extends Styleable implements Drawable * @param array $point The * @param string $fill The fill color to use * @param $strokeWidth - * @param null $index + * @param ?int $index * * @return Rect */ diff --git a/library/Icinga/Date/DateFormatter.php b/library/Icinga/Date/DateFormatter.php index 0b964bcab..867462a6c 100644 --- a/library/Icinga/Date/DateFormatter.php +++ b/library/Icinga/Date/DateFormatter.php @@ -151,7 +151,7 @@ class DateFormatter * @param bool $timeOnly * @param bool $requireTime * - * @return string + * @return ?string */ public static function timeAgo($time, $timeOnly = false, $requireTime = false) { @@ -190,7 +190,7 @@ class DateFormatter * @param bool $timeOnly * @param bool $requireTime * - * @return string + * @return ?string */ public static function timeSince($time, $timeOnly = false, $requireTime = false) { @@ -228,7 +228,7 @@ class DateFormatter * @param bool $timeOnly * @param bool $requireTime * - * @return string + * @return ?string */ public static function timeUntil($time, $timeOnly = false, $requireTime = false) { diff --git a/library/Icinga/Protocol/Ldap/Discovery.php b/library/Icinga/Protocol/Ldap/Discovery.php index bd646049e..9c7990a0f 100644 --- a/library/Icinga/Protocol/Ldap/Discovery.php +++ b/library/Icinga/Protocol/Ldap/Discovery.php @@ -94,7 +94,7 @@ class Discovery /** * Discover LDAP servers on the given domain * - * @param string $domain The object containing the form elements + * @param ?string $domain The object containing the form elements * * @return Discovery True when the discovery was successful, false when the configuration was guessed */ diff --git a/library/Icinga/Repository/IniRepository.php b/library/Icinga/Repository/IniRepository.php index 7385b3e64..2519d03c6 100644 --- a/library/Icinga/Repository/IniRepository.php +++ b/library/Icinga/Repository/IniRepository.php @@ -200,8 +200,6 @@ abstract class IniRepository extends Repository implements Extensible, Updatable * * @param string $table * @param ConfigObject $old - * - * @return ConfigObject */ public function onDelete($table, ConfigObject $old) { @@ -217,7 +215,7 @@ abstract class IniRepository extends Repository implements Extensible, Updatable * @param string $table The table name for which to return a trigger method * @param string $event The name of the event type * - * @return string + * @return ?string */ protected function getTrigger($table, $event) { diff --git a/library/Icinga/Repository/LdapRepository.php b/library/Icinga/Repository/LdapRepository.php index e7a380b76..af3cf00e6 100644 --- a/library/Icinga/Repository/LdapRepository.php +++ b/library/Icinga/Repository/LdapRepository.php @@ -55,7 +55,7 @@ abstract class LdapRepository extends Repository /** * Return the given attribute name normed to known LDAP enviroments, if possible * - * @param string $name + * @param ?string $name * * @return string */ diff --git a/library/Icinga/Repository/Repository.php b/library/Icinga/Repository/Repository.php index bfb0691b3..404f1f65a 100644 --- a/library/Icinga/Repository/Repository.php +++ b/library/Icinga/Repository/Repository.php @@ -783,7 +783,7 @@ abstract class Repository implements Selectable * @param RepositoryQuery $query An optional query to pass as context * (unused by the base implementation) * - * @return string + * @return ?string * * @throws ProgrammingError In case a conversion rule is found but not any conversion method */ @@ -930,7 +930,7 @@ abstract class Repository implements Selectable * * @param string|null $value * - * @return int + * @return ?int * * @see https://tools.ietf.org/html/rfc4517#section-3.3.13 */ diff --git a/library/Icinga/Web/Controller.php b/library/Icinga/Web/Controller.php index a2730d5fc..008fbf6be 100644 --- a/library/Icinga/Web/Controller.php +++ b/library/Icinga/Web/Controller.php @@ -156,7 +156,7 @@ class Controller extends ModuleActionController /** * Get the page size configured via user preferences or return the default value * - * @param int $default + * @param ?int $default * * @return int */ diff --git a/library/Icinga/Web/Form/Decorator/FormDescriptions.php b/library/Icinga/Web/Form/Decorator/FormDescriptions.php index 88ea5d908..5bd5f6aea 100644 --- a/library/Icinga/Web/Form/Decorator/FormDescriptions.php +++ b/library/Icinga/Web/Form/Decorator/FormDescriptions.php @@ -17,7 +17,7 @@ class FormDescriptions extends Zend_Form_Decorator_Abstract * * @param string $content The html rendered so far * - * @return string The updated html + * @return ?string The updated html */ public function render($content = '') { diff --git a/library/Icinga/Web/Form/Decorator/FormHints.php b/library/Icinga/Web/Form/Decorator/FormHints.php index 797be26c2..2a0f1932d 100644 --- a/library/Icinga/Web/Form/Decorator/FormHints.php +++ b/library/Icinga/Web/Form/Decorator/FormHints.php @@ -41,7 +41,7 @@ class FormHints extends Zend_Form_Decorator_Abstract * * @param string $content The html rendered so far * - * @return string The updated html + * @return ?string The updated html */ public function render($content = '') { diff --git a/library/Icinga/Web/Form/Decorator/FormNotifications.php b/library/Icinga/Web/Form/Decorator/FormNotifications.php index 46734dfc6..87d12aa8c 100644 --- a/library/Icinga/Web/Form/Decorator/FormNotifications.php +++ b/library/Icinga/Web/Form/Decorator/FormNotifications.php @@ -18,7 +18,7 @@ class FormNotifications extends Zend_Form_Decorator_Abstract * * @param string $content The html rendered so far * - * @return string The updated html + * @return ?string The updated html */ public function render($content = '') { diff --git a/library/Icinga/Web/Form/Decorator/Help.php b/library/Icinga/Web/Form/Decorator/Help.php index c521abe1c..9e30e863c 100644 --- a/library/Icinga/Web/Form/Decorator/Help.php +++ b/library/Icinga/Web/Form/Decorator/Help.php @@ -72,7 +72,7 @@ class Help extends Zend_Form_Decorator_Abstract * * @param string $content The html rendered so far * - * @return string The updated html + * @return ?string The updated html */ public function render($content = '') { diff --git a/library/Icinga/Web/Form/Decorator/Spinner.php b/library/Icinga/Web/Form/Decorator/Spinner.php index 9cfa56808..09a3ae997 100644 --- a/library/Icinga/Web/Form/Decorator/Spinner.php +++ b/library/Icinga/Web/Form/Decorator/Spinner.php @@ -27,7 +27,7 @@ class Spinner extends Zend_Form_Decorator_Abstract * * @param string $content The html rendered so far * - * @return string The updated html + * @return ?string The updated html */ public function render($content = '') { diff --git a/library/Icinga/Web/Navigation/Navigation.php b/library/Icinga/Web/Navigation/Navigation.php index 813e103de..4343c3ca3 100644 --- a/library/Icinga/Web/Navigation/Navigation.php +++ b/library/Icinga/Web/Navigation/Navigation.php @@ -346,7 +346,7 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate * * @param string $name * - * @return NavigationItem + * @return ?NavigationItem */ public function findItem($name) { diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php index 2d0443b41..ac8824373 100644 --- a/library/Icinga/Web/Url.php +++ b/library/Icinga/Web/Url.php @@ -243,7 +243,7 @@ class Url * * @param string $url The url to apply the new filter to * @param Filter $filter The base filter - * @param Filter $optional The optional filter + * @param ?Filter $optional The optional filter * * @return static The altered URL containing the new filter * @throws ProgrammingError diff --git a/modules/doc/application/controllers/IcingawebController.php b/modules/doc/application/controllers/IcingawebController.php index e841c4103..f6ff7385d 100644 --- a/modules/doc/application/controllers/IcingawebController.php +++ b/modules/doc/application/controllers/IcingawebController.php @@ -11,7 +11,7 @@ class IcingawebController extends DocController /** * Get the path to Icinga Web 2's documentation * - * @return string + * @return ?string * * @throws \Icinga\Exception\Http\HttpNotFoundException If Icinga Web 2's documentation is not available */ diff --git a/modules/doc/application/controllers/SearchController.php b/modules/doc/application/controllers/SearchController.php index 6ae2b1446..6d26f5220 100644 --- a/modules/doc/application/controllers/SearchController.php +++ b/modules/doc/application/controllers/SearchController.php @@ -79,7 +79,7 @@ class SearchController extends DocController /** * Get the path to Icinga Web 2's documentation * - * @return string + * @return ?string */ protected function getWebPath() { diff --git a/modules/monitoring/application/controllers/EventController.php b/modules/monitoring/application/controllers/EventController.php index 08ab1bc83..13bf537ff 100644 --- a/modules/monitoring/application/controllers/EventController.php +++ b/modules/monitoring/application/controllers/EventController.php @@ -223,7 +223,7 @@ class EventController extends Controller * * @param string $eventType * - * @return string[] + * @return ?string[] */ protected function getIconAndLabel($eventType) { @@ -263,7 +263,7 @@ class EventController extends Controller * @param string $type * @param int $id * - * @return Queryable + * @return ?Queryable */ protected function query($type, $id) { @@ -358,7 +358,7 @@ class EventController extends Controller * @param string $type * @param \stdClass $event * - * @return string[][] + * @return ?string[][] */ protected function getDetails($type, $event) { diff --git a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php index 8370314dc..3fcda6db1 100644 --- a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php +++ b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php @@ -64,8 +64,6 @@ class IcingaApiCommandRenderer implements IcingaCommandRendererInterface * * @param array $data * @param MonitoredObject $object - * - * @return array */ protected function applyFilter(array &$data, MonitoredObject $object) { diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeRange.php b/modules/monitoring/library/Monitoring/Timeline/TimeRange.php index d5ad4d0fc..aa63d3c95 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeRange.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeRange.php @@ -101,7 +101,7 @@ class TimeRange implements Iterator * * @param DateTime $dateTime The date and time for which to search the timeframe * @param bool $asTimestamp Whether the start of the timeframe should be returned as timestamp - * @return stdClass|int An object with a ´start´ and ´end´ property or a timestamp + * @return stdClass|int|null An object with a ´start´ and ´end´ property or a timestamp */ public function findTimeframe(DateTime $dateTime, $asTimestamp = false) { diff --git a/modules/setup/library/Setup/Step.php b/modules/setup/library/Setup/Step.php index 1d0797d45..4b9afcc57 100644 --- a/modules/setup/library/Setup/Step.php +++ b/modules/setup/library/Setup/Step.php @@ -25,7 +25,7 @@ abstract class Step /** * Return a textual summary of all configuration changes made * - * @return array + * @return ?array */ abstract public function getReport(); } diff --git a/modules/setup/library/Setup/Utils/DbTool.php b/modules/setup/library/Setup/Utils/DbTool.php index 49e33b668..5216485b4 100644 --- a/modules/setup/library/Setup/Utils/DbTool.php +++ b/modules/setup/library/Setup/Utils/DbTool.php @@ -558,7 +558,7 @@ class DbTool * @param string $username The login name for which to check the privileges, * if NULL the current login is used * - * @return bool + * @return ?bool */ public function checkPrivileges(array $privileges, array $context = null, $username = null) { @@ -574,7 +574,7 @@ class DbTool * * @param array $privileges The privileges that should be grantable * - * @return bool + * @return ?bool */ public function isGrantable($privileges) { @@ -680,7 +680,7 @@ class DbTool * * @param string $username The username to search * - * @return bool + * @return ?bool */ public function hasLogin($username) {