Skip to content

Commit

Permalink
Clean up redundant phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Apr 15, 2021
1 parent 9974735 commit 001076f
Show file tree
Hide file tree
Showing 48 changed files with 49 additions and 1,764 deletions.
2 changes: 0 additions & 2 deletions src/Clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ interface Clock
{
/**
* Returns the current time.
*
* @return Instant
*/
public function getTime() : Instant;
}
15 changes: 0 additions & 15 deletions src/Clock/FixedClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,25 @@ final class FixedClock implements Clock
private $instant;

/**
* Class constructor.
*
* @param Instant $instant The time to set the clock at.
*/
public function __construct(Instant $instant)
{
$this->instant = $instant;
}

/**
* {@inheritdoc}
*/
public function getTime() : Instant
{
return $this->instant;
}

/**
* @param Instant $instant
*
* @return void
*/
public function setTime(Instant $instant) : void
{
$this->instant = $instant;
}

/**
* Moves the clock by a number of seconds and/or nanos.
*
* @param int $seconds
* @param int $nanos
*
* @return void
*/
public function move(int $seconds, int $nanos = 0) : void
{
Expand Down
5 changes: 0 additions & 5 deletions src/Clock/OffsetClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ final class OffsetClock implements Clock
private $offset;

/**
* Class constructor.
*
* @param Clock $referenceClock The reference clock.
* @param Duration $offset The offset to apply to the clock.
*/
Expand All @@ -39,9 +37,6 @@ public function __construct(Clock $referenceClock, Duration $offset)
$this->offset = $offset;
}

/**
* {@inheritdoc}
*/
public function getTime() : Instant
{
return $this->referenceClock->getTime()->plus($this->offset);
Expand Down
5 changes: 0 additions & 5 deletions src/Clock/ScaleClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ final class ScaleClock implements Clock
private $timeScale;

/**
* Class constructor.
*
* - a scale > 1 makes the time move at an accelerated pace;
* - a scale == 1 makes the time move at the normal pace;
* - a scale == 0 freezes the current time;
Expand All @@ -52,9 +50,6 @@ public function __construct(Clock $referenceClock, int $timeScale)
$this->timeScale = $timeScale;
}

/**
* {@inheritdoc}
*/
public function getTime() : Instant
{
$duration = Duration::between($this->startTime, $this->referenceClock->getTime());
Expand Down
3 changes: 0 additions & 3 deletions src/Clock/SystemClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/
final class SystemClock implements Clock
{
/**
* {@inheritdoc}
*/
public function getTime() : Instant
{
[$fraction, $epochSecond] = \explode(' ', microtime());
Expand Down
7 changes: 0 additions & 7 deletions src/DateTimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,12 @@ class DateTimeException extends \RuntimeException
* @param int $value The actual value.
* @param int $min The minimum allowed value.
* @param int $max The maximum allowed value.
*
* @return DateTimeException
*/
public static function fieldNotInRange(string $field, int $value, int $min, int $max) : self
{
return new DateTimeException("Invalid $field: $value is not in the range $min to $max.");
}

/**
* @param string $region
*
* @return DateTimeException
*/
public static function unknownTimeZoneRegion(string $region) : self
{
return new self(\sprintf('Unknown time zone region "%s".', $region));
Expand Down
53 changes: 8 additions & 45 deletions src/DayOfWeek.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ private function __construct(int $value)
* Returns a cached DayOfWeek instance.
*
* @param int $value The day-of-week value, validated from 1 to 7.
*
* @return DayOfWeek
*/
private static function get(int $value) : DayOfWeek
{
Expand Down Expand Up @@ -75,11 +73,6 @@ public static function of(int $dayOfWeek) : DayOfWeek
* Returns the current day-of-week in the given time-zone, according to the given clock.
*
* If no clock is provided, the system clock is used.
*
* @param TimeZone $timeZone
* @param Clock|null $clock
*
* @return DayOfWeek
*/
public static function now(TimeZone $timeZone, ?Clock $clock = null) : DayOfWeek
{
Expand Down Expand Up @@ -110,70 +103,56 @@ public static function all(?DayOfWeek $first = null) : array

/**
* Returns a day-of-week instance for Monday.
*
* @return DayOfWeek
*/
public static function monday()
public static function monday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::MONDAY);
}

/**
* Returns a day-of-week instance for Tuesday.
*
* @return DayOfWeek
*/
public static function tuesday()
public static function tuesday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::TUESDAY);
}

/**
* Returns a day-of-week instance for Wednesday.
*
* @return DayOfWeek
*/
public static function wednesday()
public static function wednesday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::WEDNESDAY);
}

/**
* Returns a day-of-week instance for Thursday.
*
* @return DayOfWeek
*/
public static function thursday()
public static function thursday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::THURSDAY);
}

/**
* Returns a day-of-week instance for Friday.
*
* @return DayOfWeek
*/
public static function friday()
public static function friday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::FRIDAY);
}

/**
* Returns a day-of-week instance for Saturday.
*
* @return DayOfWeek
*/
public static function saturday()
public static function saturday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::SATURDAY);
}

/**
* Returns a day-of-week instance for Sunday.
*
* @return DayOfWeek
*/
public static function sunday()
public static function sunday() : DayOfWeek
{
return DayOfWeek::get(DayOfWeek::SUNDAY);
}
Expand Down Expand Up @@ -206,10 +185,6 @@ public function is(int $dayOfWeek) : bool
* Even though of() returns the same instance if the same day is requested several times,
* do *not* use strict object comparison to compare two DayOfWeek instances,
* as it is possible to get a different instance for the same day using serialization.
*
* @param DayOfWeek $that
*
* @return bool
*/
public function isEqualTo(DayOfWeek $that) : bool
{
Expand All @@ -218,10 +193,6 @@ public function isEqualTo(DayOfWeek $that) : bool

/**
* Returns the DayOfWeek that is the specified number of days after this one.
*
* @param int $days
*
* @return DayOfWeek
*/
public function plus(int $days) : DayOfWeek
{
Expand All @@ -230,10 +201,6 @@ public function plus(int $days) : DayOfWeek

/**
* Returns the DayOfWeek that is the specified number of days before this one.
*
* @param int $days
*
* @return DayOfWeek
*/
public function minus(int $days) : DayOfWeek
{
Expand All @@ -242,8 +209,6 @@ public function minus(int $days) : DayOfWeek

/**
* Serializes as a string using {@see DayOfWeek::__toString()}.
*
* @return string
*/
public function jsonSerialize() : string
{
Expand All @@ -252,10 +217,8 @@ public function jsonSerialize() : string

/**
* Returns the capitalized English name of this day-of-week.
*
* @return string
*/
public function __toString()
public function __toString() : string
{
return [
1 => 'Monday',
Expand Down
18 changes: 0 additions & 18 deletions src/DefaultClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ private function __construct()

/**
* Gets the default clock.
*
* @return Clock
*/
public static function get() : Clock
{
Expand All @@ -44,10 +42,6 @@ public static function get() : Clock

/**
* Sets the default clock.
*
* @param Clock $clock
*
* @return void
*/
public static function set(Clock $clock) : void
{
Expand All @@ -56,8 +50,6 @@ public static function set(Clock $clock) : void

/**
* Resets the default clock to the system clock.
*
* @return void
*/
public static function reset() : void
{
Expand All @@ -68,8 +60,6 @@ public static function reset() : void
* Freezes time to a specific point in time.
*
* @param Instant $instant The time to freeze to.
*
* @return void
*/
public static function freeze(Instant $instant) : void
{
Expand All @@ -80,10 +70,6 @@ public static function freeze(Instant $instant) : void
* Travels to a specific point in time, but allows time to continue moving forward from there.
*
* If the current default clock is frozen, you must `reset()` it first, or the time will stay frozen.
*
* @param Instant $instant
*
* @return void
*/
public static function travel(Instant $instant) : void
{
Expand All @@ -103,10 +89,6 @@ public static function travel(Instant $instant) : void
*
* If the current default clock is frozen, you must `reset()` it first, or the time will stay frozen.
* Multiple calls to `scale()` will result in a clock with the combined scales.
*
* @param int $timeScale The time scale.
*
* @return void
*/
public static function scale(int $timeScale) : void
{
Expand Down
Loading

0 comments on commit 001076f

Please sign in to comment.