Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
o0h committed Dec 30, 2017
1 parent 925a2e2 commit 19645fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/ORM/Behavior/TimestampBehavior.php
Expand Up @@ -136,8 +136,9 @@ public function implementedEvents()
*/
public function timestamp(DateTimeInterface $ts = null, $refreshTimestamp = false)
{
$class = Type::build('datetime')
->getDateTimeClassName();
/** @var \Cake\Database\Type\DateTimeType $type */
$type = Type::build('datetime');
$class = $type->getDateTimeClassName();

if ($ts) {
if ($this->_config['refreshTimestamp']) {
Expand Down
6 changes: 4 additions & 2 deletions tests/TestCase/ORM/Behavior/TimestampBehaviorTest.php
Expand Up @@ -306,16 +306,18 @@ public function testGetTimestampFollowingDatetimeClassSetting()
{
$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$behavior = new TimestampBehavior($table);
/** @var \Cake\Database\Type\DateTimeType $type */
$type = Type::build('datetime');

Type::build('datetime')->useImmutable();
$type->useImmutable();
$return = $behavior->timestamp(null, true);
$this->assertInstanceOf(
FrozenTime::class,
$return,
'Should return a immutable datetime object'
);

Type::build('datetime')->useMutable();
$type->useMutable();
$return = $behavior->timestamp(null, true);
$this->assertInstanceOf(
Time::class,
Expand Down

0 comments on commit 19645fa

Please sign in to comment.