class ArrKeyLookup

internal  
 

Follows a key through an array like Arr::get(), asking PHPStan whether each segment exists.

Constants

GET_METHODS

The methods Arr::get() runs, which pull() also reads keys through.

Methods

static bool
appliesTo(Scope $scope, StaticCall $call, array $methods)

Determine whether a static call runs Arr's own implementation of each of the methods.

static array|null
find(Scope $scope, Expr $array, Expr $key)

Get, for each possible key, the lookups Arr::get() may take: the literal key, then its "dot" path unless the literal key always exists. Each lookup is whether it finds a value and the access that reads it, or the first missing access.

Details

at line 41
static bool appliesTo(Scope $scope, StaticCall $call, array $methods)

Determine whether a static call runs Arr's own implementation of each of the methods.

A subclass may override the called method or one that it calls on static.

Parameters

Scope $scope
StaticCall $call
array $methods

Return Value

bool

at line 66
static array|null find(Scope $scope, Expr $array, Expr $key)

Get, for each possible key, the lookups Arr::get() may take: the literal key, then its "dot" path unless the literal key always exists. Each lookup is whether it finds a value and the access that reads it, or the first missing access.

Parameters

Scope $scope
Expr $array
Expr $key

Return Value

array|null

null when the key isn't an integer or constant string