Skip to content
Open
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
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
},
"require": {
"php": "^7.2 || ^8.0",
"php": "^8.0 || ^8.1",
"jeckel-lab/contract": ">=1.1"
},
"require-dev": {
Expand All @@ -32,9 +32,14 @@
"mikey179/vfsstream": "^1.6",
"vimeo/psalm": "^4.3",
"phpro/grumphp": "^0.19 || ^1.2.0",
"codeception/codeception": "^4.1"
"codeception/codeception": "^5.0.13"
},
"suggest": {
"codeception/codeception": "Use helper to handle clock with your codeception tests"
},
"config": {
"allow-plugins": {
"phpro/grumphp": true
}
}
}
9 changes: 3 additions & 6 deletions src/Clock/FakedClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@
*/
class FakedClock implements Clock
{
/** @var DateTimeImmutable */
protected $initialDatetime;
protected DateTimeImmutable $initialDatetime;

/** @var DateTimeZone */
private $timezone;
private DateTimeZone $timezone;

/** @var DateInterval */
private $diff;
private DateInterval $diff;

/**
* Clock constructor.
Expand Down
8 changes: 2 additions & 6 deletions src/Clock/FrozenClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@
*/
class FrozenClock implements ClockInterface
{
/**
* @var DateTimeImmutable
*/
protected $now;
protected DateTimeImmutable $now;

/** @var DateTimeZone */
private $timezone;
private DateTimeZone $timezone;

/**
* FakeClock constructor.
Expand Down
6 changes: 2 additions & 4 deletions src/Clock/RealClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
*/
class RealClock implements ClockInterface
{
/**
* @var DateTimeZone
*/
private $timezone;
private DateTimeZone $timezone;

/**
* Clock constructor.
* @param DateTimeZone|null $timezone
* @throws Exception
*/
public function __construct(?DateTimeZone $timezone = null)
{
Expand Down
5 changes: 2 additions & 3 deletions src/CodeceptionHelper/Clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Codeception\TestInterface;
use Codeception\Util\Fixtures;
use DateTimeImmutable;
use DateTimeInterface;
use InvalidArgumentException;
use RuntimeException;

Expand All @@ -30,7 +29,7 @@ class Clock extends Module
* @var string[]
* @psalm-suppress NonInvariantDocblockPropertyType
*/
protected $config = [
protected array $config = [
'date_format' => 'Y/m/d',
'time_format' => 'H:i:s'
];
Expand All @@ -39,7 +38,7 @@ class Clock extends Module
* @var array
* @psalm-suppress NonInvariantDocblockPropertyType
*/
protected $requiredFields = ['fake_time_path', 'date_format', 'time_format'];
protected array $requiredFields = ['fake_time_path', 'date_format', 'time_format'];

// @codingStandardsIgnoreStart
/**
Expand Down
1 change: 1 addition & 0 deletions src/Factory/ClockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ClockFactory
* @param array $config
* @return ClockInterface
* @throws RuntimeException
* @throws Exception
*/
public static function getClock(array $config = []): ClockInterface
{
Expand Down