HomePhabricator

Exclude variables used in strings inside closures when checking for…

Description

Exclude variables used in strings inside closures when checking for undeclared variables

Summary:
Improves upon D13795 to correctly handle variables within strings. Specifically, the following code currently (incorrectly) warns about $x being undeclared:

function some_func() {
  return function ($x) {
    echo "$x";
  };
}

It's worth noting that the situation would be improved if XHPAST properly parsed strings (see T8049).

Test Plan: Added test case.

Reviewers: epriestley, Blessed Reviewers

Reviewed By: epriestley, Blessed Reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13938

Details