Skip to content

Undefined functions are not always reported #222

@cs278

Description

@cs278

If you have a non namespaced function call without a use statement or preceding \ it's usage does not appear to be detected, per the README I expect this to work:

Any function that is used, but not defined during runtime gets reported as we cannot say if that one is shadowed or not

Given the code:

<?php
declare(strict_types=1);
namespace Test;

use function also_reported_and_not_defined;

not_reported_or_defined();
\reported_and_not_defined();
also_reported_and_not_defined();

The following is reported:

Found 2 unknown functions!
(those are not declared, so we cannot check them)

  • also_reported_and_not_defined
    in test.php:9

  • reported_and_not_defined
    in test.php:8


(scanned 1 files in 0.001 s)

Notice not_reported_or_defined() is not reported as an unknown function. If I add a use statement or leading slash then the function is reported as not defined as expected.

Finally thanks for this incredible tool, the speed is impressive. 🤯

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions