Private Member Naming (ARCH7009)
Key php.naming.private-member-naming · Severity info · Category naming
Some codebases mark private members with a leading underscore. When that convention is adopted, private members without the underscore create inconsistency and obscure visibility at a glance.
Incorrect
Section titled “Incorrect”<?php
class Cache{ private $store = [];
private function evict(): void { $this->store = []; }}Correct
Section titled “Correct”<?php
class Cache{ private $_store = [];
private function _evict(): void { $this->_store = []; }}Name private members with a leading underscore per the project convention.