Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatible with php 8.2 #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions inc/WPSH_Core.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,7 @@ private function normalize_date($data)
'9'
);

$data = str_replace($fa, $en, $data);

return $data;
return $data ? str_replace($fa, $en, $data) : null;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Date/Jalali.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class WPSH_Jalali extends WPSH_DateAbstract
*/
public function __construct($time = null, $tz = null)
{
parent::__construct(null, self::safeCreateDateTimeZone($tz));
parent::__construct('now', self::safeCreateDateTimeZone($tz));
$this->decode($this->faToEn($time));
}

Expand All @@ -94,7 +94,7 @@ public function __construct($time = null, $tz = null)
* @param int $day
* @return void
*/
public function setDate($year, $month, $day = 1)
public function setDate($year, $month, $day = 1): DateTime
{
$this->jYear = (int) $year;
$this->jMonth = (int) $month;
Expand Down Expand Up @@ -220,7 +220,7 @@ public function __get($name)
* @param string $format
* @return mixed
*/
public function format($format)
public function format($format): string
{
$symbols = array('Y', 'm', 'd', 'D', 'H', 'i', 's', 'l', 'j', 'N', 'w', 'z', 'W', 'F', 'M', 'n', 't', 'L', 'o', 'y', 'a', 'A', 'B', 'g', 'G', 'h', 's', 'u', 'e', 'i', 'I', 'O', 'P', 'T', 'U', 'c', 'r');
$intactSymbols = array('H', 'i', 's', 'N', 'w', 'B', 'g', 'G', 'h', 's', 'u', 'e', 'i', 'I', 'O', 'P', 'T', 'U', 'c', 'r');
Expand Down