# Bug Report <!-- First, thank you for reporting a bug. That takes time and we appreciate that! --> | Subject | Details | | :------------- | :---------------------------------------------------------------| | Rector version: [0f0b93](https://github.com/rectorphp/rector-src/commit/0f0b93) - released at 2023-03-27 15:06 | <!-- Please describe your problem here. --> ## Minimal PHP Code Causing Issue https://getrector.com/demo/03e903e4-92b0-445a-9066-ff52a95ae876 ```php final class DemoFile { private string|null $foo; public function _construct(string $string) { $this->foo = $string; } public function do(): void { $bar = ''; if ($this->foo !== null) { $bar .= $this->foo; } } } ``` ## Expected Behaviour The `$foo` property should be marked as readonly
Bug Report
Minimal PHP Code Causing Issue
https://getrector.com/demo/03e903e4-92b0-445a-9066-ff52a95ae876
Expected Behaviour
The
$fooproperty should be marked as readonly