Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSR2.Namespaces.UseDeclaration not giving error for use statements before the namespace declaration #1876

Closed
artureiji opened this issue Feb 6, 2018 · 4 comments
Milestone

Comments

@artureiji
Copy link

The PSR2 Namespaces/UseDeclarationSniff does not seem to be validating the When present, all use declarations MUST go after the namespace declaration. rule properly.

Example (passes without any errors!):

<?php

use DateTime;
use Exception;
use Throwable;

namespace App;

class Foo
{
    protected $bar;
}

phpcs --version
PHP_CodeSniffer version 3.2.2 (stable) by Squiz (http://www.squiz.net)

Running: phpcs -s --standard=PSR2 test.php

@artureiji artureiji changed the title PSR2 Namespaces/UseDeclarationSniff validating correctly PSR2 Namespaces/UseDeclarationSniff not validating correctly Feb 7, 2018
@artureiji
Copy link
Author

Any updates on this?

@gsherwood
Copy link
Member

No, I haven't got to this yet.

@gsherwood gsherwood added this to the 3.3.0 milestone Mar 19, 2018
@gsherwood gsherwood changed the title PSR2 Namespaces/UseDeclarationSniff not validating correctly PSR2.Namespaces.UseDeclaration not giving error for use statements before the namespace declaration Mar 19, 2018
gsherwood added a commit that referenced this issue Mar 19, 2018
… use statements before the namespace declaration
@gsherwood
Copy link
Member

Thanks for reporting this. Fix will be in 3.3.0.

@artureiji
Copy link
Author

Neat! Thanks for the support @gsherwood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants