Skip to content

[Scoper] Handle callables #294

Closed
Closed
@theofidry

Description

@theofidry
Member

e.g.:

if ($type & self::OUTPUT_RAW) {
                $messages = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $messages);
            }
return \call_user_func_array(array('Symfony\\Component\\Debug\\Exception\\FlattenException', $method), $args);

This peculiar case could be part of #286, but more generally I believe such strings should be scoped properly. without much risks

Activity

changed the title [-]Prefix classes in arrays[/-] [+][Scoper] Prefix classes in arrays[/+] on Sep 5, 2020
added a commit that references this issue on Nov 3, 2023
added a commit that references this issue on Nov 3, 2023
theofidry

theofidry commented on Nov 3, 2023

@theofidry
MemberAuthor

There is quite a few more cases that could be handled, in general I think to better handle it it would be worth leveraging the JetBrains' stubs to apply it to callable types in general.

Unfortunately treating user code is likely a lot more tricky as this would require reflection which would significantly slow down the process.

changed the title [-][Scoper] Prefix classes in arrays[/-] [+][Scoper] Handle callables[/+] on Nov 3, 2023
theofidry

theofidry commented on May 5, 2024

@theofidry
MemberAuthor

Closing this. It's a nice to have that I'm unlikely to ever implement myself and no one came forward to propose something in 5 years.

Moreover, it is not possible to use callables with the spread operator in PHP completely removing this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @theofidry

        Issue actions

          [Scoper] Handle callables · Issue #294 · humbug/php-scoper