revert back method name to prevent breaking change

This commit is contained in:
Mahdi Ziraki committed 2022-02-23 21:19:46 +03:30
1 parent 4db4b98065
commit 5c961e6252
5 files changed
+9 -7

No files matched your search

+1 -1
View File
@@ -220,7 +220,7 @@ $v = $v->timezone('Asia/Baku');
<pre> <pre>
$v = $v->setDateTime(1395, 4, 25, 16, 50, 42); $v = $v->setDateTime(1395, 4, 25, 16, 50, 42);
$v = $v->setDateTime(1395, 4, 25, 16, 50, 42, 1569856); $v = $v->setDateTime(1395, 4, 25, 16, 50, 42, 1569856);
$v = $v->setDateJalali(1395, 4, 25); $v = $v->setDate(1395, 4, 25);
$v = $v->setTimeString('12:25:48'); $v = $v->setTimeString('12:25:48');
</pre> </pre>
<h2 id="format">Format</h2> <h2 id="format">Format</h2>
+1 -1
View File
@@ -225,7 +225,7 @@ $v = $v->timezone('Asia/Baku');
<pre> <pre>
$v = $v->setDateTime(1395, 4, 25, 16, 50, 42); $v = $v->setDateTime(1395, 4, 25, 16, 50, 42);
$v = $v->setDateTime(1395, 4, 25, 16, 50, 42, 1569856); $v = $v->setDateTime(1395, 4, 25, 16, 50, 42, 1569856);
$v = $v->setDateJalali(1395, 4, 25); $v = $v->setDate(1395, 4, 25);
$v = $v->setTimeString('12:25:48'); $v = $v->setTimeString('12:25:48');
</pre> </pre>
<h2 id="format">قالب نمایش</h2> <h2 id="format">قالب نمایش</h2>
+4 -2
View File
@@ -5,6 +5,7 @@ namespace Hekmatinasser\Verta\Traits;
use DateTimeZone; use DateTimeZone;
use Hekmatinasser\Verta\Verta; use Hekmatinasser\Verta\Verta;
use InvalidArgumentException; use InvalidArgumentException;
use ReturnTypeWillChange;
trait Accessor trait Accessor
{ {
@@ -229,7 +230,7 @@ trait Accessor
*/ */
public function setDateTime($year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0) public function setDateTime($year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0)
{ {
return $this->setDateJalali($year, $month, $day)->setTime($hour, $minute, $second, $microseconds); return $this->setDate($year, $month, $day)->setTime($hour, $minute, $second, $microseconds);
} }
/** /**
@@ -242,7 +243,8 @@ trait Accessor
* *
* @return Verta * @return Verta
*/ */
public function setDateJalali($year, $month, $day) #[ReturnTypeWillChange]
public function setDate($year, $month, $day)
{ {
if (static::isValidDate($year, $month, $day)) { if (static::isValidDate($year, $month, $day)) {
list($year, $month, $day) = self::getGregorian($year, $month, $day); list($year, $month, $day) = self::getGregorian($year, $month, $day);
+1 -1
View File
@@ -133,7 +133,7 @@ trait Boundaries
{ {
$month = $this->quarter * static::MONTHS_PER_QUARTER; $month = $this->quarter * static::MONTHS_PER_QUARTER;
return $this->setDateJalali($this->year, $month, 1)->endMonth(); return $this->setDate($this->year, $month, 1)->endMonth();
} }
/** /**
+2 -2
View File
@@ -97,9 +97,9 @@ class AccessTest extends TestCase
$this->assertEquals(11, $datetime->second); $this->assertEquals(11, $datetime->second);
} }
public function testSetDateJalali() public function testSetDate()
{ {
$datetime = verta()->setDateJalali(1397, 10, 11); $datetime = verta()->setDate(1397, 10, 11);
$this->assertEquals(1397, $datetime->year); $this->assertEquals(1397, $datetime->year);
$this->assertEquals(10, $datetime->month); $this->assertEquals(10, $datetime->month);