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

Incorrect formatting for comma-separated use statement #3678

Open
theodorejb opened this issue Sep 28, 2022 · 0 comments
Open

Incorrect formatting for comma-separated use statement #3678

theodorejb opened this issue Sep 28, 2022 · 0 comments

Comments

@theodorejb
Copy link

theodorejb commented Sep 28, 2022

Code sample

<?php

namespace Bar;

use DateTimeImmutable, DateTimeZone;

class Foo
{
}

To reproduce

  1. Create a file called Foo.php with the code sample above...
  2. Run phpcs --standard=PSR12 Foo.php
  3. See error message displayed
 5 | ERROR | [x] Header blocks must be separated by a single blank line

Expected behavior
No error.

Versions:

  • OS: Windows 11
  • PHP: 8.1
  • PHPCS: 3.7.1
  • Standard: PSR12

Additional context
If I run phpcbf --standard=PSR12 Foo.php, it formats the file as follows:

<?php

namespace Bar;

use DateTimeImmutable,

DateTimeZone;

class Foo
{
}

This does not appear to match the PSR-12 specification, and it makes no sense anyway given that an import like the following is correctly left on one line without any error:

use Package\{ClassA, ClassB};
@theodorejb theodorejb changed the title Error and incorrect formatting for comma-separated use statement Incorrect formatting for comma-separated use statement Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant