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 incorrect fix when multiple use statements on same line do not have whitespace between them #3053

Closed
oklqh opened this issue Aug 21, 2020 · 2 comments
Milestone

Comments

@oklqh
Copy link

oklqh commented Aug 21, 2020

Describe the bug
phpcbf can not process 'use' keyword correctly when i use mulitiple namespaces seperated by ','.

Code sample

<?php
namespace QL;

use phpQuery,Exception,ReflectionClass;

To reproduce
Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcbf --standard=psr2 --extensions=php test.php
  3. Content of test.php became:
<?php
namespace QL;

use phpQuery;

useException,ReflectionClass;

Expected behavior
I hope it would be:

<?php
namespace QL;

use phpQuery;
use Exception;
use ReflectionClass;

Versions (please complete the following information):

  • OS: CentOS Linux release 7.6.1810 (Core)
  • PHP: 7.1.7
  • PHPCS: PHP_CodeSniffer version 3.5.7 (stable)
  • Standard: PSR2
@oklqh
Copy link
Author

oklqh commented Sep 8, 2020

it's easy reproducted. nobody want to fixe this bug?

@gsherwood gsherwood changed the title phpcbf: fail to fix 'use' keyword Incorrect fix when multiple use statements on same line do not have whitespace between them Sep 24, 2020
@gsherwood gsherwood changed the title Incorrect fix when multiple use statements on same line do not have whitespace between them PSR2 incorrect fix when multiple use statements on same line do not have whitespace between them Sep 24, 2020
@gsherwood gsherwood added this to the 3.5.7 milestone Sep 24, 2020
gsherwood added a commit that referenced this issue Sep 24, 2020
…same line do not have whitespace between them
gsherwood added a commit that referenced this issue Sep 24, 2020
…same line do not have whitespace between them
@gsherwood
Copy link
Member

Thanks for the bug report. I've committed a fix, which will be released in 3.5.7.

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