Skip to content
Merged
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
17 changes: 8 additions & 9 deletions tests/system/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,22 +502,18 @@ public function testCastDateTime(): void

public function testCastDateTimeWithTimestampTimezone(): void
{
// Save the current timezone.
$tz = date_default_timezone_get();

// Change the timezone other than UTC.
date_default_timezone_set('Asia/Tokyo'); // +09:00
date_default_timezone_set('Asia/Tokyo');

$entity = $this->getCastEntity();

$entity->eighth = 1722988800; // 2024-08-07 00:00:00 UTC

$this->assertInstanceOf(DateTimeInterface::class, $entity->eighth);
$this->assertInstanceOf(Time::class, $entity->eighth);
// The timezone is the default timezone, not UTC.
$this->assertSame('2024-08-07 09:00:00', $entity->eighth->format('Y-m-d H:i:s'));
$this->assertSame('Asia/Tokyo', $entity->eighth->getTimezoneName());

// Restore timezone.
date_default_timezone_set($tz);
}

Expand Down Expand Up @@ -651,8 +647,8 @@ public function testCastAsJSON(): void
$check = $this->getPrivateProperty($entity, 'attributes')['tenth'];
$this->assertSame('{"foo":"bar"}', $check);

$this->assertInstanceOf('stdClass', $entity->tenth);
$this->assertSame(['foo' => 'bar'], (array) $entity->tenth);
$this->assertInstanceOf(stdClass::class, $entity->tenth);
$this->assertSame('bar', $entity->tenth->foo);
}

public function testCastAsJSONArray(): void
Expand Down Expand Up @@ -1744,7 +1740,10 @@ private function getSimpleSwappedEntity(): object
};
}

private function getCastEntity($data = null): object
/**
* @param array<string, mixed>|null $data
*/
private function getCastEntity(?array $data = null): Entity
{
return new class ($data) extends Entity {
protected $attributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ protected function setUp(): void
$this->injectSession($this->hash);
}

private function createSession($options = []): Session
/**
* @param array<string, mixed> $options
*/
private function createSession(array $options = []): Session
{
$defaults = [
'driver' => FileHandler::class,
Expand Down
5 changes: 4 additions & 1 deletion tests/system/Security/SecurityCSRFSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ protected function setUp(): void
$this->injectSession($this->hash);
}

private function createSession($options = []): Session
/**
* @param array<string, mixed> $options
*/
private function createSession(array $options = []): Session
{
$defaults = [
'driver' => FileHandler::class,
Expand Down
3 changes: 1 addition & 2 deletions utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 102 errors
# total 99 errors

includes:
- argument.type.neon
Expand All @@ -10,6 +10,5 @@ includes:
- method.childReturnType.neon
- method.notFound.neon
- missingType.iterableValue.neon
- missingType.parameter.neon
- property.defaultValue.neon
- property.phpDocType.neon
18 changes: 0 additions & 18 deletions utils/phpstan-baseline/missingType.parameter.neon

This file was deleted.

Loading