mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 12:10:10 +02:00
PHP 8
This commit is contained in:
@@ -4,17 +4,12 @@ namespace DesignPatterns\Behavioral\Interpreter;
|
|||||||
|
|
||||||
class AndExp extends AbstractExp
|
class AndExp extends AbstractExp
|
||||||
{
|
{
|
||||||
private AbstractExp $first;
|
public function __construct(private AbstractExp $first, private AbstractExp $second)
|
||||||
private AbstractExp $second;
|
|
||||||
|
|
||||||
public function __construct(AbstractExp $first, AbstractExp $second)
|
|
||||||
{
|
{
|
||||||
$this->first = $first;
|
|
||||||
$this->second = $second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function interpret(Context $context): bool
|
public function interpret(Context $context): bool
|
||||||
{
|
{
|
||||||
return (bool) $this->first->interpret($context) && $this->second->interpret($context);
|
return $this->first->interpret($context) && $this->second->interpret($context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,13 +4,8 @@ namespace DesignPatterns\Behavioral\Interpreter;
|
|||||||
|
|
||||||
class OrExp extends AbstractExp
|
class OrExp extends AbstractExp
|
||||||
{
|
{
|
||||||
private AbstractExp $first;
|
public function __construct(private AbstractExp $first, private AbstractExp $second)
|
||||||
private AbstractExp $second;
|
|
||||||
|
|
||||||
public function __construct(AbstractExp $first, AbstractExp $second)
|
|
||||||
{
|
{
|
||||||
$this->first = $first;
|
|
||||||
$this->second = $second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function interpret(Context $context): bool
|
public function interpret(Context $context): bool
|
||||||
|
@@ -4,11 +4,8 @@ namespace DesignPatterns\Behavioral\Interpreter;
|
|||||||
|
|
||||||
class VariableExp extends AbstractExp
|
class VariableExp extends AbstractExp
|
||||||
{
|
{
|
||||||
private string $name;
|
public function __construct(private string $name)
|
||||||
|
|
||||||
public function __construct(string $name)
|
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function interpret(Context $context): bool
|
public function interpret(Context $context): bool
|
||||||
|
Reference in New Issue
Block a user