Skip to content

Tokeniser issue for function call parenthesis - inside switch #630

Closed
@michalbundyra

Description

@michalbundyra

Describe the bug

Since 3.10.0 (PR: #461) we have new tokens - T_TYPE_(OPEN|CLOSE)_PARENTHESIS and as I understand these should be used just for DNF types, so tokens for function calls should remain unchanged.

Here is the small example when it is wrong:

Code sample

<?php

declare(strict_types=1);

namespace FooBar;

\Bar\Baz\barBaz(); // <-- it is OK here, T_(OPEN|CLOSE)_PARENTHESIS

switch (true) {
    case 1:
        \Name\functionInSwitch(); // <-- it is wrong here T_TYPE_(OPEN|CLOSE)_PARENTHESIS
        break;
}

Custom ruleset

N/A

To reproduce

Just check tokens on the above code sample using the latest version and version pre-3.10.0.

Expected behavior

In the above example we should get T_(OPEN|CLOSE)_PARENTHESIS tokens in both cases.

Versions (please complete the following information)

Operating System -
PHP version 8.3
PHP_CodeSniffer version 3.10.3, master
Standard -
Install type -

Additional context

N/A

Please confirm

  • I have searched the issue list and am not opening a duplicate issue.
  • I have read the Contribution Guidelines and this is not a support question.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the master branch of PHP_CodeSniffer.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions