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

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

-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:
conf@avalon:/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.


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

[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
postedOct 24, '09 at 6:40p
activeOct 24, '09 at 6:40p
posts1
users1
websitepear.php.net

1 user in discussion

Confik: 1 post

People

Translate

site design / logo © 2022 Grokbase