From f308d81342113be3a38ee1619e424c116507c428 Mon Sep 17 00:00:00 2001 From: solewniczak Date: Sun, 25 Feb 2024 08:27:21 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Automatic=20code=20style=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/aggregationeditor.php | 6 +++--- action/ajax.php | 4 ++-- action/bureaucracy.php | 8 ++++---- action/cache.php | 8 ++++---- action/config.php | 6 +++--- action/diff.php | 4 ++-- action/edit.php | 4 ++-- action/entry.php | 8 ++++---- action/inline.php | 4 ++-- action/migration.php | 10 +++------- action/move.php | 4 ++-- action/output.php | 8 ++++---- action/revert.php | 6 +++--- action/search.php | 6 +++--- action/title.php | 4 ++-- helper/field.php | 4 +--- helper/imexport.php | 4 +--- meta/AccessTable.php | 4 +--- meta/AccessTableGlobal.php | 4 +--- meta/AggregationFilter.php | 2 +- meta/CSVPageImporter.php | 8 ++------ meta/DateFormatConverter.php | 16 ++++------------ meta/InlineConfigParser.php | 5 +---- meta/NestedValue.php | 4 +--- meta/Schema.php | 4 +--- meta/Search.php | 12 +++--------- meta/ValueValidator.php | 2 +- remote.php | 19 +++++++++---------- types/Decimal.php | 2 +- 29 files changed, 71 insertions(+), 109 deletions(-) diff --git a/action/aggregationeditor.php b/action/aggregationeditor.php index 2a1426c6..04705315 100644 --- a/action/aggregationeditor.php +++ b/action/aggregationeditor.php @@ -38,7 +38,7 @@ class action_plugin_struct_aggregationeditor extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -50,7 +50,7 @@ public function register(EventHandler $controller) /** * Add user's permissions to JSINFO * - * @param Doku_Event $event + * @param Event $event */ public function addJsinfo(Event $event) { @@ -61,7 +61,7 @@ public function addJsinfo(Event $event) /** - * @param Doku_Event $event + * @param Event $event */ public function handleAjax(Event $event) { diff --git a/action/ajax.php b/action/ajax.php index 5778f35a..e6eef7e1 100644 --- a/action/ajax.php +++ b/action/ajax.php @@ -18,7 +18,7 @@ class action_plugin_struct_ajax extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -29,7 +29,7 @@ public function register(EventHandler $controller) /** * Pass Ajax call to a type * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference */ public function handleAjax(Event $event) { diff --git a/action/bureaucracy.php b/action/bureaucracy.php index 381bea41..17132691 100644 --- a/action/bureaucracy.php +++ b/action/bureaucracy.php @@ -31,7 +31,7 @@ class action_plugin_struct_bureaucracy extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -45,7 +45,7 @@ public function register(EventHandler $controller) /** * Load a whole schema as fields * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -82,7 +82,7 @@ public function handleSchema(Event $event, $param) /** * Replace lookup fields placeholder's values * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -137,7 +137,7 @@ public function handleLookupFields(Event $event, $param) /** * Save the struct data * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/cache.php b/action/cache.php index 6d0135d6..ba041adb 100644 --- a/action/cache.php +++ b/action/cache.php @@ -16,7 +16,7 @@ class action_plugin_struct_cache extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -39,7 +39,7 @@ public static function getSchemaRefreshFile() * For pages potentially containing schema data, refresh the cache when schema data has been * updated * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -62,7 +62,7 @@ public function handleCacheSchemachange(Event $event, $param) * For pages containing an aggregation, add the last modified date of the database itself * to the cache dependencies * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -119,7 +119,7 @@ public function handleCacheAggregation(Event $event, $param) /** * Disable cache when dymanic parameters are present * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/config.php b/action/config.php index 9bdc8ff4..aa7d55e7 100644 --- a/action/config.php +++ b/action/config.php @@ -18,7 +18,7 @@ class action_plugin_struct_config extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -30,7 +30,7 @@ public function register(EventHandler $controller) /** * Reconfigure config for a given type * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] */ @@ -54,7 +54,7 @@ public function handleAjax(Event $event, $param) /** * Add config options to JSINFO * - * @param Doku_Event $event + * @param Event $event */ public function addJsinfo(Event $event) { diff --git a/action/diff.php b/action/diff.php index cda04310..19ea4399 100644 --- a/action/diff.php +++ b/action/diff.php @@ -19,7 +19,7 @@ class action_plugin_struct_diff extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -32,7 +32,7 @@ public function register(EventHandler $controller) * * This is done by adding pseudo syntax to the page source when it is loaded in diff context * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/edit.php b/action/edit.php index 4c45b163..285feff7 100644 --- a/action/edit.php +++ b/action/edit.php @@ -30,7 +30,7 @@ class action_plugin_struct_edit extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -64,7 +64,7 @@ public function addFromData(Event $event, $_param) * * TODO: Remove this after HTML_EDITFORM_OUTPUT is no longer released in DokuWiki stable * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/entry.php b/action/entry.php index df10019b..be9b6627 100644 --- a/action/entry.php +++ b/action/entry.php @@ -38,7 +38,7 @@ class action_plugin_struct_entry extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -54,7 +54,7 @@ public function register(EventHandler $controller) /** * Clean up and validate the input data * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -92,7 +92,7 @@ public function handleValidation(Event $event, $param) /** * Check if the page has to be changed * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -125,7 +125,7 @@ public function handlePagesaveBefore(Event $event, $param) * * When this is called, INPUT data has been validated already. * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/inline.php b/action/inline.php index c7b10727..9142606f 100644 --- a/action/inline.php +++ b/action/inline.php @@ -39,7 +39,7 @@ class action_plugin_struct_inline extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -48,7 +48,7 @@ public function register(EventHandler $controller) } /** - * @param Doku_Event $event + * @param Event $event * @param $param */ public function handleAjax(Event $event, $param) diff --git a/action/migration.php b/action/migration.php index 5759e8ed..0679f223 100644 --- a/action/migration.php +++ b/action/migration.php @@ -29,7 +29,7 @@ public function register(EventHandler $controller) /** * Call our custom migrations when defined * - * @param Doku_Event $event + * @param Event $event * @param $param */ public function handleMigrations(Event $event, $param) @@ -251,9 +251,7 @@ protected function migration17($sqlite) $cols = $sqlite->queryAll($s); if ($cols) { - $colnames = array_map(function ($c) { - return 'col' . $c['COL']; - }, $cols); + $colnames = array_map(static fn($c) => 'col' . $c['COL'], $cols); // data_ tables $s = 'SELECT pid, rid, rev, ' . implode(', ', $colnames) . " FROM data_$name"; @@ -389,9 +387,7 @@ protected function getFixedValues($row) } if (!empty($fixes)) { - $fixes = array_map(function ($set, $key) { - return "$key = '$set'"; - }, $fixes, array_keys($fixes)); + $fixes = array_map(static fn($set, $key) => "$key = '$set'", $fixes, array_keys($fixes)); } return [$pid, $rid, $rev, $colref, $rowno, $fixes]; diff --git a/action/move.php b/action/move.php index bea6d828..ffdb63a4 100644 --- a/action/move.php +++ b/action/move.php @@ -26,7 +26,7 @@ class action_plugin_struct_move extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -38,7 +38,7 @@ public function register(EventHandler $controller) /** * Renames all occurrences of a page ID in the database * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param bool $ispage is this a page move operation? * @return bool */ diff --git a/action/output.php b/action/output.php index 332f7982..0741ebca 100644 --- a/action/output.php +++ b/action/output.php @@ -28,7 +28,7 @@ class action_plugin_struct_output extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -42,7 +42,7 @@ public function register(EventHandler $controller) * Appends the instruction to render our syntax output component to each page * after the first found headline or the very begining if no headline was found * - * @param Doku_Event $event + * @param Event $event * @param $param */ public function handleOutput(Event $event, $param) @@ -94,7 +94,7 @@ public function handleOutput(Event $event, $param) * If the page has a schema assigned, add its struct data * to dw2pdf's template replacements * - * @param Doku_Event $event + * @param Event $event * @param $param */ public function replaceDw2pdf(Event $event, $param) @@ -130,7 +130,7 @@ public function replaceDw2pdf(Event $event, $param) * Remove struct placeholders still present after replacement. * Requested data was not found. * - * @param Doku_Event $event + * @param Event $event * @param $param */ public function cleanupDw2pdf(Event $event, $param) diff --git a/action/revert.php b/action/revert.php index 249f2193..765acd73 100644 --- a/action/revert.php +++ b/action/revert.php @@ -23,7 +23,7 @@ class action_plugin_struct_revert extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -37,7 +37,7 @@ public function register(EventHandler $controller) /** * Check if the page has to be changed * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -62,7 +62,7 @@ public function handlePagesaveBefore(Event $event, $param) /** * Save the data, by loading it from the old revision and storing it as a new revision * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/search.php b/action/search.php index c2607748..e8ee9a46 100644 --- a/action/search.php +++ b/action/search.php @@ -21,7 +21,7 @@ class action_plugin_struct_search extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -33,7 +33,7 @@ public function register(EventHandler $controller) /** * Adds the structured data to the page body to be indexed * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool @@ -54,7 +54,7 @@ public function handleIndexing(Event $event, $param) /** * Adds the structured data to the page body to be snippeted * - * @param Doku_Event $event event object by reference + * @param Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool diff --git a/action/title.php b/action/title.php index be7f433e..945d9259 100644 --- a/action/title.php +++ b/action/title.php @@ -23,7 +23,7 @@ class action_plugin_struct_title extends ActionPlugin /** * Registers a callback function for a given event * - * @param Doku_Event_Handler $controller DokuWiki's event controller object + * @param EventHandler $controller DokuWiki's event controller object * @return void */ public function register(EventHandler $controller) @@ -34,7 +34,7 @@ public function register(EventHandler $controller) /** * Store the page's title * - * @param Doku_Event $event + * @param Event $event * @param $param */ public function handleMeta(Event $event, $param) diff --git a/helper/field.php b/helper/field.php index 92195ee3..c8869b13 100644 --- a/helper/field.php +++ b/helper/field.php @@ -141,9 +141,7 @@ public function replacementMultiValueCallback($matches) } if (!empty($value) && $this->column->getType() instanceof User) { - $value = array_map(function ($user) { - return userlink($user, true); - }, $value); + $value = array_map(static fn($user) => userlink($user, true), $value); } //check if matched string containts a pair of brackets diff --git a/helper/imexport.php b/helper/imexport.php index 5ca71518..ba4113c6 100644 --- a/helper/imexport.php +++ b/helper/imexport.php @@ -68,9 +68,7 @@ public function getSchemaAssignmentPatterns($schemaName) $sql = 'SELECT pattern FROM schema_assignments_patterns WHERE tbl = ?'; $patterns = $this->sqlite->queryAll($sql, $schemaName); - return array_map(function ($elem) { - return $elem['pattern']; - }, $patterns); + return array_map(static fn($elem) => $elem['pattern'], $patterns); } /** diff --git a/meta/AccessTable.php b/meta/AccessTable.php index 353147a4..b4b4d50d 100644 --- a/meta/AccessTable.php +++ b/meta/AccessTable.php @@ -634,9 +634,7 @@ protected function handleEmptyMulti($pid, $rid, $colref) */ protected function clearMulti() { - $colrefs = array_unique(array_map(function ($val) { - return $val[0]; - }, $this->multiValues)); + $colrefs = array_unique(array_map(static fn($val) => $val[0], $this->multiValues)); return $this->sqlite->query( "DELETE FROM $this->mtable WHERE pid = ? AND rid = $this->rid AND rev = 0 AND colref IN (" . implode(',', $colrefs) . ")", diff --git a/meta/AccessTableGlobal.php b/meta/AccessTableGlobal.php index 54f8254c..7affa270 100644 --- a/meta/AccessTableGlobal.php +++ b/meta/AccessTableGlobal.php @@ -75,9 +75,7 @@ protected function getMultiSql() protected function validateTypeData($data) { // we do not store completely empty rows - $isempty = array_reduce($data, function ($isempty, $cell) { - return $isempty && ($cell === '' || $cell === [] || $cell === null); - }, true); + $isempty = array_reduce($data, static fn($isempty, $cell) => $isempty && ($cell === '' || $cell === [] || $cell === null), true); return !$isempty; } diff --git a/meta/AggregationFilter.php b/meta/AggregationFilter.php index 325b6331..68d8a540 100644 --- a/meta/AggregationFilter.php +++ b/meta/AggregationFilter.php @@ -72,7 +72,7 @@ protected function getAllColumnValues($result) $colName = $value->getColumn()->getFullQualifiedLabel(); $colValues[$colName]['column'] = $value->getColumn(); $colValues[$colName]['label'] = $value->getColumn()->getTranslatedLabel(); - $colValues[$colName]['values'] = $colValues[$colName]['values'] ?? []; + $colValues[$colName]['values'] ??= []; if (empty($value->getDisplayValue())) continue; diff --git a/meta/CSVPageImporter.php b/meta/CSVPageImporter.php index b260cb48..48572917 100644 --- a/meta/CSVPageImporter.php +++ b/meta/CSVPageImporter.php @@ -70,12 +70,8 @@ function ($keys, Column $col) { $this->header ); - $keysAt = array_map(function ($key) { - return "@@$key@@"; - }, $keys); - $keysHash = array_map(function ($key) { - return "##$key##"; - }, $keys); + $keysAt = array_map(static fn($key) => "@@$key@@", $keys); + $keysHash = array_map(static fn($key) => "##$key##", $keys); $flatValues = array_map( function ($value) { if (is_array($value)) { diff --git a/meta/DateFormatConverter.php b/meta/DateFormatConverter.php index 1a19edcb..0a4c47bf 100644 --- a/meta/DateFormatConverter.php +++ b/meta/DateFormatConverter.php @@ -131,16 +131,12 @@ public static function toDate($strftime) $datekeys = array_keys(self::$date); // create negative lookbehind regex to match all known date chars that are not a strtime pattern now $from = array_map( - function ($in) { - return '/(? '/(? '\\' . $in, $datekeys ); // escape date chars @@ -172,9 +168,7 @@ public static function toStrftime($date) // create negative lookbehind regex to match all unescaped known chars $from = array_keys(self::$date); $from = array_map( - function ($in) { - return '/(? '/(? '/\\\\' . $in . '/', $datekeys ); $strftime = preg_replace($from, $datekeys, $strftime); diff --git a/meta/InlineConfigParser.php b/meta/InlineConfigParser.php index 9efed659..c0871d01 100644 --- a/meta/InlineConfigParser.php +++ b/meta/InlineConfigParser.php @@ -50,6 +50,7 @@ public function __construct($inline) switch ($p) { // Empty (due to extra spaces) case '': + default: // Move straight to next parameter continue 2; break; @@ -73,10 +74,6 @@ public function __construct($inline) $lines[] = 'filteror: ' . trim($parameters[$i + 1]); $i++; break; - default: - // Move straight to next parameter - continue 2; - break; } } } diff --git a/meta/NestedValue.php b/meta/NestedValue.php index 87fcc4c2..ec4495df 100644 --- a/meta/NestedValue.php +++ b/meta/NestedValue.php @@ -114,9 +114,7 @@ public function getChildren($sort = false) public function addResultRow($row) { // only add unique rows - $ident = md5(array_reduce($row, function ($carry, $value) { - return $carry . $value; - }, '')); + $ident = md5(array_reduce($row, static fn($carry, $value) => $carry . $value, '')); $this->resultRows[$ident] = $row; } diff --git a/meta/Schema.php b/meta/Schema.php index 680dccc5..8b22918a 100644 --- a/meta/Schema.php +++ b/meta/Schema.php @@ -325,9 +325,7 @@ public function getColumns($withDisabled = true) if (!$withDisabled) { return array_filter( $this->columns, - function (Column $col) { - return $col->isEnabled(); - } + static fn(Column $col) => $col->isEnabled() ); } diff --git a/meta/Search.php b/meta/Search.php index fe679061..b60ed7f1 100755 --- a/meta/Search.php +++ b/meta/Search.php @@ -293,9 +293,7 @@ protected function parseFilterValueList($value) */ protected function filterWrapAsterisks($value) { - $map = function ($input) { - return "*$input*"; - }; + $map = static fn($input) => "*$input*"; if (is_array($value)) { $value = array_map($map, $value); @@ -313,9 +311,7 @@ protected function filterWrapAsterisks($value) */ protected function filterChangeToLike($value) { - $map = function ($input) { - return str_replace('*', '%', $input); - }; + $map = static fn($input) => str_replace('*', '%', $input); if (is_array($value)) { $value = array_map($map, $value); @@ -464,9 +460,7 @@ public function execute() $this->result_pids = []; $result = []; $cursor = -1; - $pageidAndRevOnly = array_reduce($this->columns, function ($pageidAndRevOnly, Column $col) { - return $pageidAndRevOnly && ($col->getTid() == 0); - }, true); + $pageidAndRevOnly = array_reduce($this->columns, static fn($pageidAndRevOnly, Column $col) => $pageidAndRevOnly && ($col->getTid() == 0), true); while ($row = $res->fetch(\PDO::FETCH_ASSOC)) { $cursor++; if ($cursor < $this->range_begin) continue; diff --git a/meta/ValueValidator.php b/meta/ValueValidator.php index 6407ef17..e8a7c034 100644 --- a/meta/ValueValidator.php +++ b/meta/ValueValidator.php @@ -47,7 +47,7 @@ public function validateValue(Column $col, &$rawvalue) if (is_array($rawvalue)) { $rawvalue = array_filter($rawvalue, [$this, 'filter']); $rawvalue = array_values($rawvalue); // reset the array keys - if (empty($rawvalue)) { + if ($rawvalue === []) { $rawvalue = ['']; } } diff --git a/remote.php b/remote.php index 0e475832..fe9d727c 100644 --- a/remote.php +++ b/remote.php @@ -8,6 +8,7 @@ */ // must be run within Dokuwiki +use dokuwiki\Remote\RemoteException; use dokuwiki\Extension\RemotePlugin; use dokuwiki\Remote\AccessDeniedException; use dokuwiki\plugin\struct\meta\Value; @@ -37,7 +38,7 @@ public function __construct() * @param string $schema The schema to use empty for all * @param int $time A timestamp if you want historic data (0 for now) * @return array ('schema' => ( 'fieldlabel' => 'value', ...)) - * @throws RemoteAccessDeniedException + * @throws AccessDeniedException * @throws RemoteException */ public function getData($page, $schema, $time) @@ -53,7 +54,7 @@ public function getData($page, $schema, $time) try { return $this->hlp->getData($page, $schema, $time); } catch (StructException $e) { - throw new \dokuwiki\Remote\RemoteException($e->getMessage(), 0, $e); + throw new RemoteException($e->getMessage(), 0, $e); } } @@ -70,7 +71,7 @@ public function getData($page, $schema, $time) * @param string $summary * @param bool $minor * @return bool returns always true - * @throws RemoteAccessDeniedException + * @throws AccessDeniedException * @throws RemoteException */ public function saveData($page, $data, $summary, $minor = false) @@ -85,7 +86,7 @@ public function saveData($page, $data, $summary, $minor = false) $this->hlp->saveData($page, $data, $summary, $minor); return true; } catch (StructException $e) { - throw new \dokuwiki\Remote\RemoteException($e->getMessage(), 0, $e); + throw new RemoteException($e->getMessage(), 0, $e); } } @@ -96,7 +97,7 @@ public function saveData($page, $data, $summary, $minor = false) * * @param string $schema the schema to query, empty for all * @return array - * @throws RemoteAccessDeniedException + * @throws AccessDeniedException * @throws RemoteException */ public function getSchema($schema = null) @@ -121,7 +122,7 @@ public function getSchema($schema = null) } return $result; } catch (StructException $e) { - throw new \dokuwiki\Remote\RemoteException($e->getMessage(), 0, $e); + throw new RemoteException($e->getMessage(), 0, $e); } } @@ -140,9 +141,7 @@ public function getAggregationData(array $schemas, array $cols, array $filter = { $schemaLine = 'schema: ' . implode(', ', $schemas); $columnLine = 'cols: ' . implode(', ', $cols); - $filterLines = array_map(function ($filter) { - return 'filter' . $filter['logic'] . ': ' . $filter['condition']; - }, $filter); + $filterLines = array_map(static fn($filter) => 'filter' . $filter['logic'] . ': ' . $filter['condition'], $filter); $sortLine = 'sort: ' . $sort; // schemas, cols, REV?, filter, order @@ -162,7 +161,7 @@ public function getAggregationData(array $schemas, array $cols, array $filter = } return $data; } catch (StructException $e) { - throw new \dokuwiki\Remote\RemoteException($e->getMessage(), 0, $e); + throw new RemoteException($e->getMessage(), 0, $e); } } } diff --git a/types/Decimal.php b/types/Decimal.php index 6aa68f58..255b8c0f 100644 --- a/types/Decimal.php +++ b/types/Decimal.php @@ -81,7 +81,7 @@ public function renderValue($value, \Doku_Renderer $R, $mode) $this->config['thousands'] ); } - if ($this->config['trimzeros'] && (strpos($value, $this->config['decpoint']) !== false)) { + if ($this->config['trimzeros'] && (strpos($value, (string) $this->config['decpoint']) !== false)) { $value = rtrim($value, '0'); $value = rtrim($value, $this->config['decpoint']); }