From 60251cd62367aa8b50e7f717479eea5170b03e98 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 19:06:23 +0100 Subject: [PATCH 1/3] [ticket/14557] Simplify updating overloaded events for extensions PHPBB3-14557 --- phpBB/phpbb/event/data.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php index c7365aee35..42080e96d5 100644 --- a/phpBB/phpbb/event/data.php +++ b/phpBB/phpbb/event/data.php @@ -63,4 +63,17 @@ class data extends Event implements \ArrayAccess { unset($this->data[$offset]); } + + /** + * Returns data with updated key in specified offset. + * + * @param string $offset Data array offset + * @param string $key Offset key + * @param mixed $value Value to update + * @return mixed Value of $value + */ + public function update_subarray($offset, $key, $value) + { + return $this->data[$offset][$key] = $value; + } } From 1eb451d0d49af102ef80e5617765f01c07eebeea Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Tue, 27 Dec 2016 22:28:34 +0100 Subject: [PATCH 2/3] [ticket/14557] Don't return $value PHPBB3-14557 --- phpBB/phpbb/event/data.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php index 42080e96d5..00ebbcefdd 100644 --- a/phpBB/phpbb/event/data.php +++ b/phpBB/phpbb/event/data.php @@ -70,10 +70,9 @@ class data extends Event implements \ArrayAccess * @param string $offset Data array offset * @param string $key Offset key * @param mixed $value Value to update - * @return mixed Value of $value */ public function update_subarray($offset, $key, $value) { - return $this->data[$offset][$key] = $value; + $this->data[$offset][$key] = $value; } } From aa888fab3404ba8544bbcc84ef96b1003979a200 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Tue, 27 Dec 2016 22:30:47 +0100 Subject: [PATCH 3/3] [ticket/14557] Rename $offset to $subarray PHPBB3-14557 --- phpBB/phpbb/event/data.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php index 00ebbcefdd..276ab027f2 100644 --- a/phpBB/phpbb/event/data.php +++ b/phpBB/phpbb/event/data.php @@ -67,12 +67,12 @@ class data extends Event implements \ArrayAccess /** * Returns data with updated key in specified offset. * - * @param string $offset Data array offset - * @param string $key Offset key - * @param mixed $value Value to update + * @param string $subarray Data array subarray + * @param string $key Subarray key + * @param mixed $value Value to update */ - public function update_subarray($offset, $key, $value) + public function update_subarray($subarray, $key, $value) { - $this->data[$offset][$key] = $value; + $this->data[$subarray][$key] = $value; } }