> If I understand your use case properly, you should be confused by properties 
> with default values that are not constructor-promoted as well ? Am I wrong ? 
> In this case, your problem is not with promoted properties ?

If we specify it the way you say, the initial values ​​of the constructor 
arguments will be available even when the constructor is not called.

```
class Foo
{
    public function __construct()
    {
    }
}

$foo = serialize(new Foo()); 
// save to redis

---- update ----

class Foo
{
    public function __construct(
        public $val = 'abc'
    ) {
    }
}

$foo = unserialize($redis_foo);
var_dump($foo->val);
// string(3) "abc"
// Doesn't it look like the constructor is being called?
```

Such behavior felt a little counterintuitive.

Regards.

Saki

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

Reply via email to