klaviyo / magento2-klaviyo

37 stars 51 forks source link

M2.3 unexpected '$result' (T_VARIABLE) #44

Closed DavaGordon closed 5 years ago

DavaGordon commented 5 years ago

During magneto 2.3.2 compilation the following error occured

Parse error: syntax error, unexpected '$result' (T_VARIABLE) inl/vendor/klaviyo/magento2-extension/Plugin/Customer/Model/CustomerData.php on line 38;

after reviewing the code it was found you were missing the semicolon from end of variables but can i suggest you rewrite from

    public function afterGetSectionData(Customer $subject, $result)
    {
        if ($this->currentCustomer->getCustomerId()) {
            $result['lastname'] = $this->currentCustomer->getCustomer()->getLastname()
            $result['email'] = $this->currentCustomer->getCustomer()->getEmail()
        } else {
            $result['lastname'] = '';
            $result['email'] = '';
        }

        return $result;
    }

To

    public function afterGetSectionData(Customer $subject, $result)
    {
    $result['lastname'] = '';
    $result['email'] = '';      
        if ($this->currentCustomer->getCustomerId()) {
            $result['lastname'] = $this->currentCustomer->getCustomer()->getLastname();
            $result['email'] = $this->currentCustomer->getCustomer()->getEmail();
        }
        return $result;
    }
remstone7 commented 5 years ago

43 thanks

remstone7 commented 5 years ago

@DavaGordon merged in dev-master will update package later today