mirror of
https://github.com/ysoftdevs/Theatrical-Players-Refactoring-Kata.git
synced 2026-04-24 09:48:53 +02:00
PHP7.2+ compatible strict types and type hinting
This commit is contained in:
@@ -1,16 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Theatrical;
|
namespace Theatrical;
|
||||||
|
|
||||||
class Invoice
|
class Invoice
|
||||||
{
|
{
|
||||||
public string $customer;
|
/**
|
||||||
public array $performances;
|
* @var string
|
||||||
|
*/
|
||||||
|
public $customer;
|
||||||
|
|
||||||
public function __construct($customer, $performances)
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $performances;
|
||||||
|
|
||||||
|
public function __construct(string $customer, array $performances)
|
||||||
{
|
{
|
||||||
$this->customer = $customer;
|
$this->customer = $customer;
|
||||||
$this->performances = $performances;
|
$this->performances = $performances;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,15 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Theatrical;
|
namespace Theatrical;
|
||||||
|
|
||||||
class Performance
|
class Performance
|
||||||
{
|
{
|
||||||
public string $play_id;
|
/**
|
||||||
public int $audience;
|
* @var string
|
||||||
|
*/
|
||||||
|
public $play_id;
|
||||||
|
|
||||||
public function __construct($play_id, $audience)
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $audience;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Play
|
||||||
|
*/
|
||||||
|
public $play;
|
||||||
|
|
||||||
|
public function __construct(string $play_id, int $audience)
|
||||||
{
|
{
|
||||||
$this->play_id = $play_id;
|
$this->play_id = $play_id;
|
||||||
$this->audience = $audience;
|
$this->audience = $audience;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Theatrical;
|
namespace Theatrical;
|
||||||
|
|
||||||
class Play
|
class Play
|
||||||
{
|
{
|
||||||
public string $name;
|
/**
|
||||||
public string $type;
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name;
|
||||||
|
|
||||||
public function __construct($name, $type)
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type;
|
||||||
|
|
||||||
|
public function __construct(string $name, string $type)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
@@ -17,4 +26,4 @@ class Play
|
|||||||
{
|
{
|
||||||
return (string) $this->name . ' : ' . $this->type;
|
return (string) $this->name . ' : ' . $this->type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user