> ```php
> class User {
>     private string $first;
>     private string $last;
>     public string $fullName {
>         get => $this->first . ' ' . $this->last;
>         set => [$this->first, $this->last] = explode(' ', $value, 2);
>     }
>
>     public function __construct($this->fullName) {}
> }
> ```

Not entirely true, you created redundancy code for ```$fullName```.
This is why we created constructor property promotion: to eliminate
redundancy.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to