update deps & install rector

This commit is contained in:
Dominik Liebler
2019-12-14 12:50:05 +01:00
parent 04acce6759
commit 579a5ac946
87 changed files with 2432 additions and 786 deletions

View File

@@ -9,7 +9,7 @@ class CityJourney extends Journey
return "Eat, drink, take photos and sleep";
}
protected function buyGift(): string
protected function buyGift(): ?string
{
return "Buy a gift";
}

View File

@@ -7,7 +7,7 @@ abstract class Journey
/**
* @var string[]
*/
private $thingsToDo = [];
private array $thingsToDo = [];
/**
* This is the public service provided by this class and its subclasses.
@@ -37,10 +37,8 @@ abstract class Journey
/**
* This method is also part of the algorithm but it is optional.
* You can override it only if you need to
*
* @return null|string
*/
protected function buyGift()
protected function buyGift(): ?string
{
return null;
}

View File

@@ -2,14 +2,15 @@
namespace DesignPatterns\Behavioral\TemplateMethod\Tests;
use DesignPatterns\Behavioral\TemplateMethod;
use DesignPatterns\Behavioral\TemplateMethod\BeachJourney;
use DesignPatterns\Behavioral\TemplateMethod\CityJourney;
use PHPUnit\Framework\TestCase;
class JourneyTest extends TestCase
{
public function testCanGetOnVacationOnTheBeach()
{
$beachJourney = new TemplateMethod\BeachJourney();
$beachJourney = new BeachJourney();
$beachJourney->takeATrip();
$this->assertSame(
@@ -20,7 +21,7 @@ class JourneyTest extends TestCase
public function testCanGetOnAJourneyToACity()
{
$cityJourney = new TemplateMethod\CityJourney();
$cityJourney = new CityJourney();
$cityJourney->takeATrip();
$this->assertSame(