Skip to content

PSR2 incorrect fix when multiple use statements on same line do not have whitespace between them #3053

@oklqh

Description

@oklqh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions