variableConflict()
variableConflict(array $tokens, array{name: string, line: int, open: int, declared: array{int, int}|null, close: int, arity: int, public: bool, static: bool, body: array{int, int}|null, typed: bool} $method, string $variable, string $type, string $name, bool $parentCall) : string|null
Judges a returned variable: every use of it in the method must keep it of the type.
Allowed uses are an assignment of a provable value at the start of a statement, an element
access on an array, the returned value itself, and isset, empty, count and is_array.
Anything else, including a parameter of the same name, might change the variable.
Parameters
| array |
$tokens |
The token list.
|
| array{name: string, line: int, open: int, declared: array{int, int}|null, close: int, arity: int, public: bool, static: bool, body: array{int, int}|null, typed: bool} |
$method |
The method.
|
| string |
$variable |
The variable, with its dollar sign.
|
| string |
$type |
The parent's type.
|
| string |
$name |
Lowercase method name.
|
| bool |
$parentCall |
Whether the parent's version of the method returns the type.
|
Returns
string|null
— A reason, or null when the variable is provably of the type.