From 6cfca60c58b7ba098f3545d84c7b2312147ebebe Mon Sep 17 00:00:00 2001 From: Klap-in Date: Wed, 31 Jan 2024 21:42:53 +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 --- classes/Spyc.php | 11 ++++------- syntax/query.php | 4 +--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/classes/Spyc.php b/classes/Spyc.php index 645e45f..2705b20 100644 --- a/classes/Spyc.php +++ b/classes/Spyc.php @@ -921,8 +921,7 @@ private function addArray($incoming_data, $incoming_indent) $this->result[$key] = $value; } else { $this->result[] = $value; - end($this->result); - $key = key($this->result); + $key = array_key_last($this->result); } $this->path[$incoming_indent] = $key; return; @@ -960,8 +959,7 @@ private function addArray($incoming_data, $incoming_indent) $key = 0; } else { $_arr[] = $value; - end($_arr); - $key = key($_arr); + $key = array_key_last($_arr); } $reverse_path = array_reverse($this->path); @@ -1070,8 +1068,7 @@ private function getParentPathByIndent($indent) } $linePath = $this->path; do { - end($linePath); - $lastIndentInParentPath = key($linePath); + $lastIndentInParentPath = array_key_last($linePath); if ($indent <= $lastIndentInParentPath) { array_pop($linePath); } @@ -1145,7 +1142,7 @@ private function returnMappedSequence($line) $array = []; $key = self::unquote(trim(substr($line, 1, -1))); $array[$key] = []; - $this->delayedPath = [strpos($line, $key) + $this->indent => $key]; + $this->delayedPath = [strpos($line, (string) $key) + $this->indent => $key]; return [$array]; } diff --git a/syntax/query.php b/syntax/query.php index 119d914..a0a602c 100644 --- a/syntax/query.php +++ b/syntax/query.php @@ -175,9 +175,7 @@ public function render($format, Doku_Renderer $renderer, $data) $values = explode(",", $data['values']); $values = array_map('trim', $values); $values = array_filter($values); - $values = array_map(function ($value) use ($datePlaceholders, $recentDates) { - return str_replace($datePlaceholders, $recentDates, $value); - }, $values); + $values = array_map(static fn($value) => str_replace($datePlaceholders, $recentDates, $value), $values); if (!$values && array_key_exists('values', $data)) { $values = ['']; }