Merge pull request #9271 from michalkleiner/pulls/4/check-array-props-in-custom-methods

FIX Check array keys existence when removing methods in CustomMethods
This commit is contained in:
Robbie Averill 2019-10-03 14:30:22 -07:00 committed by GitHub
commit 1265f09f4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -282,10 +282,15 @@ trait CustomMethods
if (!isset(self::$extra_methods[$class][$method])) {
continue;
}
$methodInfo = self::$extra_methods[$class][$method];
if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) {
if (
// always check for property
(isset($methodInfo['property']) && $methodInfo['property'] === $property) &&
// check for index only if provided
(!$index || ($index && isset($methodInfo['index']) && $methodInfo['index'] === $index))
) {
unset(self::$extra_methods[$class][$method]);
}
}