Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thriggs opened this issue Jan 8, 2019 · 3 comments
Open

Comments

@thriggs
Copy link

thriggs commented Jan 8, 2019

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>
@jasonmccallister
Copy link

I personally love this! I have not done this since PHP 5.2.

@hotline-emu
Copy link

This is a very legacy rule that I am more than glad to remove.

@jncarver
Copy link

jncarver commented Jan 8, 2019

I agree with this change - I really don't like leading underscores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants