cancel
Showing results for 
Search instead for 
Did you mean: 

Parse error: syntax error, unexpected ';', expecting '{' in

Parse error: syntax error, unexpected ';', expecting '{' in

Parse error: syntax error, unexpected ';', expecting '{' in /home/user/domains/domain.com/public_html/app/code/Mirasvit/RewardsAdminUi/Ui/QuickDataBar/EarnedDataBlock.php on line 25

 

what is problem if i make command php bin/magento setup:di:compile

 

i get this error the code 

 

<?php
/**
 * Mirasvit
 *
 * This source file is subject to the Mirasvit Software License, which is available at https://mirasvit.com/license/.
 * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
 * If you wish to customize this module for your needs.
 * Please refer to http://www.magentocommerce.com for more information.
 *
 * @category  Mirasvit
 * @package   mirasvit/module-rewards
 * @version   3.1.1
 * @copyright Copyright (C) 2023 Mirasvit (https://mirasvit.com/)
 */



namespace Mirasvit\RewardsAdminUi\Ui\QuickDataBar;

use Magento\Backend\Block\Template;
use Magento\Framework\DB\Select;
use Mirasvit\Core\Ui\QuickDataBar\SparklineDataBlock;
use Mirasvit\Rewards\Api\Data\TransactionInterface;

class EarnedDataBlock extends SparklineDataBlock;
{
    private $dataProvider;

    public function __construct(
        DataProvider     $dataProvider,
        Template\Context $context
    ) {
        $this->dataProvider = $dataProvider;

        parent::__construct($context);
    }

    public function getLabel(): string
    {
        return (string)__('Earned Points');
    }

    public function getScalarValue(): string
    {
        $select = $this->getSelect();

        $value = (int)$this->dataProvider->getConnection()->fetchOne($select);
//echo $select;die();
        return number_format($value, 0, '.', ' ');
    }

    public function getSparklineValues(): array
    {
        $dateExpr = $this->getDateIntervalExpr(TransactionInterface::KEY_CREATED_AT);

        $select = $this->getSelect([$dateExpr])
            ->group($dateExpr);

        $result = [];
        foreach ($this->dataProvider->getConnection()->fetchPairs($select) as $date => $value) {
            $result[$date] = (int)$value;
        }

        return $result;
    }

    private function getSelect(array $columns = []): Select
    {
        $select = $this->dataProvider->getTransactionSelect($columns);
        $select->where(TransactionInterface::KEY_AMOUNT . ' > ?', 0)
            ->where(TransactionInterface::KEY_CREATED_AT . ' >= ?', $this->dateFrom)
            ->where(TransactionInterface::KEY_CREATED_AT . ' <= ?', $this->dateTo);

        return $select;
    }
}
2 REPLIES 2

Re: Parse error: syntax error, unexpected ';', expecting '{' in

Remove the semicolon at the end of this line:

 

class EarnedDataBlock extends SparklineDataBlock;

Re: Parse error: syntax error, unexpected ';', expecting '{' in

error not fixed i'm remove the semicolon and i'm making upgrade command and setup:static-content:deploy after this command i'm making this command php bin/magento indexer:reindex

 

setup:di:compile 

 

and error not fixed