FAQ
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;
found;
--------------------------------------------------------------------------------

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

Search Discussions

  • Gsherwood at Jan 6, 2013 at 10:10 pm
    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: Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows 7
    Package Version: SVN
    PHP Version: 5.4.7
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4, even though the docs have not been. The doc example doesn't
    actually give a
    parse error in 5.4, as the manual indicates.


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

    [2013-01-06 21:17:39] squiz

    -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.

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

    [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;
    found;
    --------------------------------------------------------------------------------

    ------------------------------------------------------------------------
  • Gsherwood at Jan 6, 2013 at 10:17 pm
    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: Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows 7
    Package Version: SVN
    PHP Version: 5.4.7
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4 with the introduction of traits, even though the docs have not been.
    The doc
    example doesn't actually give a parse error in 5.4, as the manual
    indicates, as it is
    now valid syntax for traits.


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

    [2013-01-06 22:10:15] squiz

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4, even though the docs have not been. The doc example doesn't
    actually give a
    parse error in 5.4, as the manual indicates.

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

    [2013-01-06 21:17:39] squiz

    -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.

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

    [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;
    found;
    --------------------------------------------------------------------------------

    ------------------------------------------------------------------------
  • Gsherwood at Jan 6, 2013 at 10:58 pm
    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
    +Summary: Use statements for traits not recognised correctly
    for PSR2 code style
    Status: Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows 7
    Package Version: SVN
    PHP Version: 5.4.7
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Summary: Traits don&#039;t recognized right for PSR2 code style
    +Summary: Use statements for traits not recognised correctly
    for PSR2 code style



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

    [2013-01-06 22:17:17] squiz

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4 with the introduction of traits, even though the docs have not been.
    The doc
    example doesn't actually give a parse error in 5.4, as the manual
    indicates, as it is
    now valid syntax for traits.

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

    [2013-01-06 22:10:15] squiz

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4, even though the docs have not been. The doc example doesn't
    actually give a
    parse error in 5.4, as the manual indicates.

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

    [2013-01-06 21:17:39] squiz

    -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.

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

    [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;
    found;
    --------------------------------------------------------------------------------

    ------------------------------------------------------------------------
  • Gsherwood at Jan 6, 2013 at 11:01 pm
    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: Use statements for traits not recognised correctly
    for PSR2 code style
    -Status: Feedback
    +Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Windows 7
    Package Version: SVN
    PHP Version: 5.4.7
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Feedback
    +Status: Closed
    Fix committed to gthub repo:
    https://github.com/squizlabs/PHP_CodeSniffer/commit/ab0465ecdf244fd3e9d1224c9f6
    0db6a51915833


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

    [2013-01-06 22:58:38] squiz

    -Summary: Traits don&#039;t recognized right for PSR2 code style
    +Summary: Use statements for traits not recognised correctly
    for PSR2 code style


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

    [2013-01-06 22:17:17] squiz

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4 with the introduction of traits, even though the docs have not been.
    The doc
    example doesn't actually give a parse error in 5.4, as the manual
    indicates, as it is
    now valid syntax for traits.

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

    [2013-01-06 22:10:15] squiz

    Sorry, my mistake. I was testing on php 5.3 and this has obviously been
    changed in
    5.4, even though the docs have not been. The doc example doesn't
    actually give a
    parse error in 5.4, as the manual indicates.

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

    [2013-01-06 21:17:39] squiz

    -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.

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

    [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;
    found;
    --------------------------------------------------------------------------------

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 6, '13 at 9:17p
activeJan 6, '13 at 11:01p
posts5
users1
websitepear.php.net

1 user in discussion

Gsherwood: 5 posts

People

Translate

site design / logo © 2022 Grokbase