Skip to content

Commit

Permalink
Use of DateTimeInterface instead of DateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky authored and scheb committed Feb 22, 2021
1 parent df13333 commit f423508
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function search(string $searchTerm): array
*
* @throws ApiException
*/
public function getHistoricalData(string $symbol, string $interval, \DateTime $startDate, \DateTime $endDate): array
public function getHistoricalData(string $symbol, string $interval, \DateTimeInterface $startDate, \DateTimeInterface $endDate): array
{
$allowedIntervals = [self::INTERVAL_1_DAY, self::INTERVAL_1_WEEK, self::INTERVAL_1_MONTH];
if (!\in_array($interval, $allowedIntervals)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Results/HistoricalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function jsonSerialize(): array
return get_object_vars($this);
}

public function getDate(): \DateTime
public function getDate(): \DateTimeInterface
{
return $this->date;
}
Expand Down
14 changes: 7 additions & 7 deletions src/Results/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@ public function getCurrency(): ?string
return $this->currency;
}

public function getDividendDate(): ?\DateTime
public function getDividendDate(): ?\DateTimeInterface
{
return $this->dividendDate;
}

public function getEarningsTimestamp(): ?\DateTime
public function getEarningsTimestamp(): ?\DateTimeInterface
{
return $this->earningsTimestamp;
}

public function getEarningsTimestampStart(): ?\DateTime
public function getEarningsTimestampStart(): ?\DateTimeInterface
{
return $this->earningsTimestampStart;
}

public function getEarningsTimestampEnd(): ?\DateTime
public function getEarningsTimestampEnd(): ?\DateTimeInterface
{
return $this->earningsTimestampEnd;
}
Expand Down Expand Up @@ -289,7 +289,7 @@ public function getPostMarketPrice(): ?float
return $this->postMarketPrice;
}

public function getPostMarketTime(): ?\DateTime
public function getPostMarketTime(): ?\DateTimeInterface
{
return $this->postMarketTime;
}
Expand All @@ -309,7 +309,7 @@ public function getPreMarketPrice(): ?float
return $this->preMarketPrice;
}

public function getPreMarketTime(): ?\DateTime
public function getPreMarketTime(): ?\DateTimeInterface
{
return $this->preMarketTime;
}
Expand Down Expand Up @@ -374,7 +374,7 @@ public function getRegularMarketPrice(): ?float
return $this->regularMarketPrice;
}

public function getRegularMarketTime(): ?\DateTime
public function getRegularMarketTime(): ?\DateTimeInterface
{
return $this->regularMarketTime;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ValueMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private function mapBoolValue($rawValue): bool
/**
* @param mixed $rawValue
*/
private function mapDateValue($rawValue): \DateTime
private function mapDateValue($rawValue): \DateTimeInterface
{
try {
return new \DateTime('@'.$rawValue);
Expand Down

0 comments on commit f423508

Please sign in to comment.