Skip to content

Incorrect warning for arguments are thrown on static arrow functions #275

Closed
@arkener

Description

@arkener

Related to #272, incorrect warnings for arguments are thrown on static arrow functions as stated on https://www.drupal.org/project/coder/issues/3303720#comment-14652996

<?php

function lorem() {
  $foo = static fn (string $value) => $value;
  echo $foo('bar');
}

Will result in the following:

FILE: test.php
-----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------------
 4 | WARNING | Unused static variable $value. (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable)
 4 | WARNING | Redeclaration of function parameter $value as static variable.
   |         | (VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration)
-----------------------------------------------------------------------------------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions