weissersand class c { public readonly string $s; public function f() { $this->s ??= ''; } } string c::$s Cannot modify readonly property c::$sPHP(PHP2436) PHP, even with declare(strict_types=1), does not throw an error.
JakubMisek weissersand thank you for reporting the issue; You're right, we should not report assignments to readonly property within its own class. Will be fixed.
JakubMisek Workaround for now; we're not reporting the warning if the property is assigned in a private/protected method.