mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-10 08:54:03 +02:00
update deps & install rector
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user