Bug #19763 [Opn->Fbk]: Traits don't recognized right for PSR2 code style
| From: | gsherwood at squiz dot net | Date: | Sun, 06 Jan 2013 21:17:39 +0000 |
| Subject: | Bug #19763 [Opn->Fbk]: Traits don't recognized right for PSR2 code style | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9457@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19763&edit=1
ID: 19763
Updated by: gsherwood@squiz.net
Reported By: hinikato at mail dot ru
Summary: Traits don't recognized right for PSR2 code style
-Status: Open
+Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Windows 7
Package Version: SVN
PHP Version: 5.4.7
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
Your code contains a parse error. Use statements cannot be included
inside class
declarations like that. See "Scoping rules for importing" here:
http://php.net/manual/en/language.namespaces.importing.php
If you put the use statement in the global scope, or inside a namespace
block, the
checks will work correctly.
Previous Comments:
------------------------------------------------------------------------
[2013-01-01 14:12:49] hinikato
Description:
------------
The following code is reported as invalid. If I add a one empty line, it
detected as invalid also:
FILE: x:\path\Component\Container.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
8 | ERROR | The closing brace for the class must go on the next line
after the
| | body
--------------------------------------------------------------------------------
So it seems like there is a conflict between this two checks also.
Test script:
---------------
<?php
namespace Myak\Component;
class Container extends Component implements IContainer
{
use TContainer;
}
Expected result:
----------------
File is valid.
Actual result:
--------------
FILE: x:\path\Component\Container.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
6 | ERROR | There must be one blank line after the last USE statement;
0
| | found;
--------------------------------------------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19763&edit=1