Skip to content

Commit

Permalink
Menu::$date should be immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Mar 10, 2018
1 parent 370c9e7 commit d0d147b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace AdamWojs\AwokadoRobot;

use DateTimeInterface;
use DateTimeImmutable;

class Menu
{
/** @var DateTimeInterface */
/** @var DateTimeImmutable */
private $date;

/** @var MenuItem[] */
Expand All @@ -15,16 +15,16 @@ class Menu
/**
* Menu constructor.
*
* @param DateTimeInterface $date
* @param DateTimeImmutable $date
* @param MenuItem[] $items
*/
public function __construct(DateTimeInterface $date, array $items)
public function __construct(DateTimeImmutable $date, array $items)
{
$this->date = $date;
$this->items = $items;
}

public function getDate(): DateTimeInterface
public function getDate(): DateTimeImmutable
{
return $this->date;
}
Expand Down
4 changes: 2 additions & 2 deletions src/MenuProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace AdamWojs\AwokadoRobot;

use DateTime;
use DateTimeImmutable;
use DateTimeInterface;
use Goutte\Client;

Expand Down Expand Up @@ -34,7 +34,7 @@ public function __construct(Client $client, string $websiteUrl)
*/
public function getCurrentMenu(): ?Menu
{
$today = new DateTime();
$today = new DateTimeImmutable();

if (!$this->isMenuAvailable($today)) {
// Menu is not available
Expand Down

0 comments on commit d0d147b

Please sign in to comment.