mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-12 01:44:09 +02:00
PHP8
This commit is contained in:
@@ -12,11 +12,8 @@ class Character implements Text
|
||||
* Any state stored by the concrete flyweight must be independent of its context.
|
||||
* For flyweights representing characters, this is usually the corresponding character code.
|
||||
*/
|
||||
private string $name;
|
||||
|
||||
public function __construct(string $name)
|
||||
public function __construct(private string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function render(string $font): string
|
||||
|
@@ -4,11 +4,8 @@ namespace DesignPatterns\Structural\Flyweight;
|
||||
|
||||
class Word implements Text
|
||||
{
|
||||
private string $name;
|
||||
|
||||
public function __construct(string $name)
|
||||
public function __construct(private string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function render(string $font): string
|
||||
|
Reference in New Issue
Block a user