Zum Inhalt springen

Private Member Naming (ARCH7009)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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.

<?php
class Cache
{
private $store = [];
private function evict(): void
{
$this->store = [];
}
}
<?php
class Cache
{
private $_store = [];
private function _evict(): void
{
$this->_store = [];
}
}

Name private members with a leading underscore per the project convention.