FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16736&edit=1

ID: 16736
Updated by: [email protected]
Reported By: confik at gmail dot com
Summary: Multi-files sniffs aren't processed when <file> is a
single directory
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Ubuntu Linux 9.04 x86_64
Package Version: 1.2.0
PHP Version: 5.2.6
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on
pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Thanks for such a detailed report and a working patch.


Previous Comments:
------------------------------------------------------------------------

[2009-10-24 20:39:58] conf

-PHP Version: 5.2.5
+PHP Version: 5.2.6
Sorry, I'm new to PEAR bug tracking system, so I didn't knew that it's
unable to upload archives.
So, let's manually create test case:
1. Create the following directory structure:
[email protected]:/tmp$ tree -a phpcs-test
phpcs-test
-- Test
`-- TestCodingStandard.php
-- test1.php
`-- test2.php

1 directory, 3 files
2. File TestCodingStandard.php contains:
<?php

if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) ===
false) {
throw new PHP_CodeSniffer_Exception('Class
PHP_CodeSniffer_Standards_CodingStandard not found');
}

class PHP_CodeSniffer_Standards_Test_TestCodingStandard extends
PHP_CodeSniffer_Standards_CodingStandard
{
/**
* Return a list of external sniffs to include with this standard.
*
* The PHP_CodeSniffer standard combines the PEAR and Squiz
standards
* but removes some sniffs from the Squiz standard that clash with
* those in the PEAR standard.
*
* @return array
*/
public function getIncludedSniffs()
{
return array(
'Generic/Sniffs/Classes/DuplicateClassNameSniff.php'
);
}//end getIncludedSniffs()
}//end class
?>
3. Files test1.php and test2.php are identical and contain the
following:
<?php

class Test {}
4. Go to phpcs-test dir and run the command:
$ phpcs --standard=Test .
5. Expected and actual result described in description.

------------------------------------------------------------------------

[2009-10-24 20:23:07] conf

Added #patch bug:16736;patch:bugfix;revision:1256412187;.

------------------------------------------------------------------------

[2009-10-24 20:18:47] conf

Description:
------------
When invoking phpcs command like this
$ phpcs --standard=SampleStandard /path/to/directory/
multi-files sniffs are skipped.
Test case is included in the bug report.

Test script:
---------------
Use attached test case as shown below:
$ tar -xvzf phpcs-test.tar.gz
$ cd phpcs-test/
$ phpcs --standard=Test .

Expected result:
----------------
FILE: /home/conf/phpcs-test/test1.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
3 | WARNING | Duplicate class name "Test" found; first defined in
/home/conf/phpcs-test/test2.php on line 3
--------------------------------------------------------------------------------



Actual result:
--------------
No errors.

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 16, '09 at 6:06a
activeNov 16, '09 at 6:06a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2023 Grokbase