Skip to content

Remove requirement for private properties to be prefaced with underscore #86

Description

@thriggs

Zend.NamingConventions.ValidVariableName rule requires an underscore for private class properties.

Actual Behavior

FILE: controller/DealerDetail.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 35 | ERROR | Private member variable "newPrivateVar" must contain a
    |       | leading underscore
----------------------------------------------------------------------

This contradicts PSR-2:
https://www.php-fig.org/psr/psr-2/#42-properties

Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility.

We should be able to do something like this to exclude that rule:

<rule ref="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore">
    <exclude-pattern>*</exclude-pattern>
</rule>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions