Bug #19654 [Opn->Fbk]: PSR class name sniff complains about camel caps instead of StudlyCaps

From: Date: Tue, 16 Oct 2012 22:40:46 +0000
Subject: Bug #19654 [Opn->Fbk]: PSR class name sniff complains about camel caps instead of StudlyCaps
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-9192@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=19654&edit=1 ID: 19654 Updated by: gsherwood@squiz.net Reported By: epsepeps at gmail dot com Summary: PSR class name sniff complains about camel caps instead of StudlyCaps -Status: Open +Status: Feedback Type: Bug Package: PHP_CodeSniffer Operating System: Win 7 64 bits Package Version: 1.4.0 PHP Version: 5.3.8 -Assigned To: +Assigned To: squiz Roadmap Versions: New Comment: -Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz As far as I can tell, PSR-1 requires class names like ThisIsMyClassName from PHP 5.3 onwards and classes like Vendor_NameSpace_ThisIsMyClassName for earlier PHP versions. You indicate you are using PHP 5.3.8, so the class should be defined as: namespace Vendor\Resources; class CandidateResource {} If you run on PHP 5.2 or earlier, namespaces are obviously not supported, so you are required to do this: class Vendor_Resources_CandidateResource {} There was a bug in the 1.4.0 version that threw an error on PHP 5.2 if you didn't have namespaces. but of course, you had no way to correct this and PSR-1 was pretty clear that you can revert to the old way of namespacing if needed. But this shouldn't affect your testing given you are on PHP 5.3. Previous Comments: ------------------------------------------------------------------------ [2012-10-16 08:47:04] epsepeps Description: ------------ According to PSR-1 a class name should be StudlyCaps, see: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md#3-namespace-and-class-names The current PSR codesniffer ruleset doesn't enforce this - or I am not interpreting the PSR correctly ;-). More info: http://en.wikipedia.org/wiki/StudlyCaps Expected result: ---------------- class Vendor_Resources_CandidateResource results in message: Class name "Vendor_Resources_CandidateResource" is not in StudlyCaps format Actual result: -------------- class Vendor_Resources_CandidateResource results in message: Class name "Vendor_Resources_CandidateResource" is not in camel caps format ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=19654&edit=1

« previous php.pear.bugs (#9192) next »