mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-11 09:24:01 +02:00
PHP8
This commit is contained in:
@@ -4,11 +4,8 @@ namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
class Item
|
||||
{
|
||||
private float $price;
|
||||
|
||||
public function __construct(float $price)
|
||||
public function __construct(private float $price)
|
||||
{
|
||||
$this->price = $price;
|
||||
}
|
||||
|
||||
public function getPrice(): float
|
||||
|
@@ -4,11 +4,8 @@ namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
class NotSpecification implements Specification
|
||||
{
|
||||
private Specification $specification;
|
||||
|
||||
public function __construct(Specification $specification)
|
||||
public function __construct(private Specification $specification)
|
||||
{
|
||||
$this->specification = $specification;
|
||||
}
|
||||
|
||||
public function isSatisfiedBy(Item $item): bool
|
||||
|
@@ -4,13 +4,8 @@ namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
class PriceSpecification implements Specification
|
||||
{
|
||||
private ?float $maxPrice;
|
||||
private ?float $minPrice;
|
||||
|
||||
public function __construct(?float $minPrice, ?float $maxPrice)
|
||||
public function __construct(private ?float $minPrice, private ?float $maxPrice)
|
||||
{
|
||||
$this->minPrice = $minPrice;
|
||||
$this->maxPrice = $maxPrice;
|
||||
}
|
||||
|
||||
public function isSatisfiedBy(Item $item): bool
|
||||
|
Reference in New Issue
Block a user