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

From: Date: Wed, 17 Oct 2012 07:44:26 +0000
Subject: Bug #19654 [Fbk->Csd]: 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-9196@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: epsepeps@gmail.com Reported By: epsepeps at gmail dot com Summary: PSR class name sniff complains about camel caps instead of StudlyCaps -Status: Feedback +Status: Closed Type: Bug Package: PHP_CodeSniffer Operating System: Win 7 64 bits Package Version: 1.4.0 PHP Version: 5.3.8 Assigned To: squiz Roadmap Versions: New Comment: -Status: Feedback +Status: Closed Thanks for the quick (and detailed) response. Previous Comments: ------------------------------------------------------------------------ [2012-10-16 23:40:46] squiz -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. ------------------------------------------------------------------------ [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 (#9196) next »