Skip to content

Squiz.Arrays.ArrayDeclaration.ValueNoNewline false positive with static fn #559

Open
@simPod

Description

@simPod

Describe the bug

Squiz.Arrays.ArrayDeclaration.ValueNoNewline triggers false positive at static fn.

Code sample

return [
    static fn (string $value): AAA => new AAA($value),
    BBB::fromString(...),
];

To reproduce

Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcs test.php ...
  3. See error message displayed
PHPCS output here

Expected behavior

No error

Versions (please complete the following information)

Operating System macos 14
PHP version 8.3
PHP_CodeSniffer version 3.10.1
Standard Squiz
Install type composer

Additional context

Add any other context about the problem here.

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

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions