From afceccb9a601be621b7cd73c0658d38717a506cb Mon Sep 17 00:00:00 2001 From: Joe Chenevey Date: Tue, 8 Jan 2019 15:14:23 -0500 Subject: [PATCH 1/3] CustomMethods->removeMethodsFrom Warnings Check to ensure `self::$extra_methods[$class][$method]` exists before trying to retrieve its value. Silences warnings generated by updating a controller's failover. --- src/Core/CustomMethods.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Core/CustomMethods.php b/src/Core/CustomMethods.php index 91b3038ea..6cff20f92 100644 --- a/src/Core/CustomMethods.php +++ b/src/Core/CustomMethods.php @@ -279,10 +279,12 @@ trait CustomMethods $methods = $this->findMethodsFromExtension($extension); if ($methods) { foreach ($methods as $method) { - $methodInfo = self::$extra_methods[$class][$method]; + if (isset(self::$extra_methods[$class][$method])) { + $methodInfo = self::$extra_methods[$class][$method]; - if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { - unset(self::$extra_methods[$class][$method]); + if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { + unset(self::$extra_methods[$class][$method]); + } } } From 3730d84d1882bdfcc31fe029513bf9b17983c806 Mon Sep 17 00:00:00 2001 From: Joe Chenevey Date: Tue, 8 Jan 2019 15:24:21 -0500 Subject: [PATCH 2/3] Update CustomMethods.php Switch to an early `continue` rather than wrapping contents of `foreach` in an `if` and indenting. --- src/Core/CustomMethods.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Core/CustomMethods.php b/src/Core/CustomMethods.php index 6cff20f92..1b6fd1677 100644 --- a/src/Core/CustomMethods.php +++ b/src/Core/CustomMethods.php @@ -279,12 +279,12 @@ trait CustomMethods $methods = $this->findMethodsFromExtension($extension); if ($methods) { foreach ($methods as $method) { - if (isset(self::$extra_methods[$class][$method])) { - $methodInfo = self::$extra_methods[$class][$method]; + if (!isset(self::$extra_methods[$class][$method])) continue; + + $methodInfo = self::$extra_methods[$class][$method]; - if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { - unset(self::$extra_methods[$class][$method]); - } + if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { + unset(self::$extra_methods[$class][$method]); } } From 068c240d3856bae5e0fef5b3819edc0fa3fcdb74 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Tue, 8 Jan 2019 15:27:38 -0500 Subject: [PATCH 3/3] Update src/Core/CustomMethods.php Co-Authored-By: jchenevey --- src/Core/CustomMethods.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Core/CustomMethods.php b/src/Core/CustomMethods.php index 1b6fd1677..1f166dd8b 100644 --- a/src/Core/CustomMethods.php +++ b/src/Core/CustomMethods.php @@ -279,7 +279,9 @@ trait CustomMethods $methods = $this->findMethodsFromExtension($extension); if ($methods) { foreach ($methods as $method) { - if (!isset(self::$extra_methods[$class][$method])) continue; + if (!isset(self::$extra_methods[$class][$method])) { + continue; + } $methodInfo = self::$extra_methods[$class][$method];