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

ID: 18933
Updated by: gsherwood@squiz.net
Reported By: sb at sebastian-bergmann dot de
Summary: Alternative namespace declaration syntax confuses
scope sniffs
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Irrelevant
Package Version: 1.3.0
PHP Version: Irrelevant
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
Fixed in SVN, although there was only one error and not two. That
ScopeIndent one
at the end is correct because the PEAR standard says that CASE
statements should
not be indented 4 spaces from the SWITCH. They are supposed to align.

The ClassDeclaration one was a bug though. It didn't support class
definitions inside a
namespace.


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

[2011-10-26 10:17:30] sebastian

Description:
------------
When using the alternative namespace declaration syntax, PHP_CodeSniffer
wrongly complains about the indentation of switch/case statements.

The expected and actual output shown below were generated with
PHP_CodeSniffer 1.3.0 +
http://svn.php.net/viewvc/pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Tokenizers/PHP.php?r1=307870&r2=310221

This is not a duplicate of http://pear.php.net/bugs/18930 or
pear.php.net/bugs/bug.php?id=18043.

Test script:
---------------
<?php
namespace A
{
class B
{
function c()
{
switch (true) {
case true:
;
break;
}
}
}
}

Expected result:
----------------
FILE: /home/sb/test.php
--------------------------------------------------------------------------------
FOUND 5 ERROR(S) AFFECTING 5 LINE(S)
--------------------------------------------------------------------------------
2 | ERROR | Missing file doc comment
(PEAR.Commenting.FileComment.Missing)
4 | ERROR | Missing class doc comment
(PEAR.Commenting.ClassComment.Missing)
6 | ERROR | Missing function doc comment
(PEAR.Commenting.FunctionComment.Missing)
--------------------------------------------------------------------------------

Actual result:
--------------
FILE: /home/sb/test.php
--------------------------------------------------------------------------------
FOUND 5 ERROR(S) AFFECTING 5 LINE(S)
--------------------------------------------------------------------------------
2 | ERROR | Missing file doc comment
(PEAR.Commenting.FileComment.Missing)
4 | ERROR | Missing class doc comment
(PEAR.Commenting.ClassComment.Missing)
5 | ERROR | Expected 0 spaces before opening brace; 4 found
(PEAR.Classes.ClassDeclaration.SpaceBeforeBrace)
6 | ERROR | Missing function doc comment
(PEAR.Commenting.FunctionComment.Missing)
9 | ERROR | Line indented incorrectly; expected 12 spaces, found 16
(PEAR.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 1, '11 at 10:41p
activeNov 1, '11 at 10:41p
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase