[phpMyAdmin Developers] PHPCS: leading underscore on protected / private attributes / methods

Michal Čihař michal at cihar.com
Mon Aug 24 09:01:52 CEST 2015


Dne Sun, 23 Aug 2015 18:58:19 +0000
Hugues Peccatte <hugues.peccatte at gmail.com> napsal(a):

> phpMyAdmin's ruleset is based on PEAR standards. One of this standard
> (PEAR_Sniffs_NamingConventions_ValidVariableNameSniff) is to name class'
> attributes / methods with a leading underscore when the element is
> protected / private.
> This rule is quite useful because it helps to see very quickly if an
> element is public or not. But
> http://www.php-fig.org/psr/psr-2/#4-2-properties asks not to use this
> leading underscore.
> For attributes, I'm not sure this is a big deal because almost all the
> attributes shouldn't be visible and accessible only by getters / setters.
> But for methods, there is nothing to know the visibility of a method.
> However actual IDE help to see this.
> Do you think that we should follow PSR2? Only for attributes maybe?
> Should we consider to base our ruleset on another standard closest to PSR
> rules?

I think leaning towards PSR-1/2 is good idea.

	Michal Čihař | http://cihar.com | http://blog.cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20150824/96cfc604/attachment.sig>

More information about the Developers mailing list