From 582d9d6871942d37268f87a33a19c96bd315fa8c Mon Sep 17 00:00:00 2001 From: Brandon Kelly Date: Tue, 14 Jul 2020 10:48:27 -0700 Subject: [PATCH] No need to explicitly bind the method --- src/models/LineItem.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/models/LineItem.php b/src/models/LineItem.php index b1943b60db..2474355050 100644 --- a/src/models/LineItem.php +++ b/src/models/LineItem.php @@ -445,7 +445,7 @@ public function defineRules(): array $purchasable = Craft::$app->getElements()->getElementById($this->purchasableId); if ($purchasable && !empty($purchasableRules = $purchasable->getLineItemRules($this))) { foreach ($purchasableRules as $rule) { - $rules[] = $this->_normalizePurchasableRule($rule, $purchasable); + $rules[] = $this->_normalizePurchasableRule($rule); } } } @@ -457,14 +457,12 @@ public function defineRules(): array * Normalizes a purchasable’s validation rule. * * @param mixed $rule - * @param PurchasableInterface $purchasable * @return mixed */ - private function _normalizePurchasableRule($rule, PurchasableInterface $purchasable) + private function _normalizePurchasableRule($rule) { if (isset($rule[1]) && $rule[1] instanceof \Closure) { $method = $rule[1]; - $method->bindTo($purchasable); $rule[1] = function($attribute, $params, $validator, $current) use($method) { $method($attribute, $params, $validator, $current); };