fix set date
This commit is contained in:
1 parent
2df8243f3b
commit
6abdde20bb
1 file changed
+6
-4
@@ -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
|
||||||
{
|
{
|
||||||
@@ -34,12 +35,13 @@ trait Accessor
|
|||||||
|
|
||||||
if(array_key_exists($name, $formats)) {
|
if(array_key_exists($name, $formats)) {
|
||||||
return (int) $this->format($formats[$name]);
|
return (int) $this->format($formats[$name]);
|
||||||
} elseif ($name === 'quarter') {
|
}
|
||||||
|
elseif ($name === 'quarter') {
|
||||||
return (int) ceil($this->month / static::MONTHS_PER_QUARTER);
|
return (int) ceil($this->month / static::MONTHS_PER_QUARTER);
|
||||||
} elseif ($name === 'timezone') {
|
}
|
||||||
|
elseif ($name === 'timezone') {
|
||||||
return $this->getTimezone()->getName();
|
return $this->getTimezone()->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
|
throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ trait Accessor
|
|||||||
* @param \DateTimeZone|int|string $value
|
* @param \DateTimeZone|int|string $value
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function __set(string $name, DateTimeZone|int|string $value)
|
public function __set(string $name, $value)
|
||||||
{
|
{
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'year':
|
case 'year':
|
||||||
|
|||||||
Reference in new issue
Block a user