for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://github.com/flipboxfactory/craft-ember/blob/master/LICENSE
* @link https://github.com/flipboxfactory/craft-ember/
*/
namespace flipbox\craft\ember\objects;
use craft\helpers\DateTimeHelper;
use DateTime;
* @property DateTime|null $dateCreated
*
* @author Flipbox Factory <[email protected]>
* @since 2.0.0
trait DateCreatedMutatorTrait
{
* @param $value
* @return $this
* @throws \Exception
public function setDateCreated($value)
if ($value) {
$value = DateTimehelper::toDateTime($value);
}
$this->dateCreated = $value ?: null;
return $this;
* @return DateTime|false|null
public function getDateCreated()
if (empty($this->dateCreated)) {
return DateTimeHelper::toDateTime(
new DateTime('now')
new \DateTime('now')
object<DateTime>
string|integer|array|null
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
);
return $this->dateCreated;
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: