mirror of
https://github.com/ysoftdevs/Theatrical-Players-Refactoring-Kata.git
synced 2026-03-21 08:59:51 +01:00
PHP7.2+ compatible strict types and type hinting
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Theatrical;
|
||||
|
||||
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->performances = $performances;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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->audience = $audience;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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->type = $type;
|
||||
@@ -17,4 +26,4 @@ class Play
|
||||
{
|
||||
return (string) $this->name . ' : ' . $this->type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user