Apply "Preserve" also to properties
This constructor may not be ideal, but is perfectly valid:
public readonly int $someCount;
public function __construct(
public readonly array $someArray,
) {
$someCount = 0;
foreach ($this->someArray as $someItem) {
// some logic which adds to $someCount
}
$this->someCount = $someCount;
}
Of course, with constructorWithPromotedProperties()
this is not possible. However, if I #[Preserve]
the constructor, the $someCount
definition is lost.
#[Preserve]
attribute has a potential to be used to more than methods. I suggest to apply it on properties as well.