Where is syntax error?

Hello, there is a code there is an error of syntax.
<?php
//Get the current user
 static function getOrdersByUser(){
 if (CModule::IncludeModule('sale'))
{
 global $USER;
 $result = array();
 $arFilter = Array(
 "USER_ID" => $USER->GetID(),
 "DATE_CANCELED" => ""
);

 $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
 while ($ar_sales = $db_sales->Fetch())
{
 $result[] = $ar_sales;
}

 return $result;
}
}
//Get properties order by ID
 static function GetPropsOfOrder($order_id){
 $arrResult = array();
 $obBasket = \Bitrix\Sale\Basket::getList(array('filter' => array('ORDER_ID' => $order_id)));
 while($bItem = $obBasket->Fetch()){
 $arrResult[] = $bItem;
}
 return $arrResult;
}
?>

Parse error: syntax error, unexpected 'getOrdersByUser' (T_STRING), expecting '(' in /components/bitrix/sale.personal.section/bootstrap_v5/template.php on line 596


Can't find a syntax error :/
I will be glad if you help! Thanks in advance :)
April 3rd 20 at 18:55
1 answer
April 3rd 20 at 18:57
You have bracket "}" are missing
static function getOrdersByUser(){
 if (CModule::IncludeModule('sale'))
{
 global $USER;
 $result = array();
 $arFilter = Array(
 "USER_ID" => $USER->GetID(),
 "DATE_CANCELED" => ""
);


 $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
 while ($ar_sales = $db_sales->Fetch())
{
 $result[] = $ar_sales;
}

 return $result;
}
} //-- Here


But strangely, it turns out, if the condition is not met, the function returns nothing...
Perhaps the parenthesis are needed in the condition, but then you need to ad $result= array(); to submit to the conditions and after return, in General, to change the logic that would return something understandable.
Well, about static functions You have already said. Also, the error in a different location, you need additional code before and after error.

Find more questions by tags PHP