Revision 875221b6
Added by Reid Linnemann over 2 years ago
rector.php | ||
---|---|---|
37 | 37 |
*/ |
38 | 38 |
|
39 | 39 |
$rectorConfig->ruleWithConfiguration(Rules\ArrayGetExprRector::class, |
40 |
['g' => 'g_get']); |
|
40 |
['g' => 'g_get', |
|
41 |
'config' => 'config_get_path']); |
|
41 | 42 |
|
42 | 43 |
}; |
Also available in: Unified diff
ArrayGetExprRector support for variable and funccall array keys
Change how buildPathArgNode() generates an Arg node - as we introduce support
for more complicated expressions in array keys to be converted to string path
expressions, a simple implode() is no longer sufficient. The following changes
are introduced:
into a single delimited path String_ node
generate EncapsedStringPart nodes, aggregating them along with successive
Variables and String_s as parts in an Encapsed node, adding delimiters as
appropriate to String_ parts
String_ or Encapsed node as appropriate from the consumed nodes
the first node and second node in the list, aggregating the second node on
into either a String_ or Encapsed node with helpers as appropriate
append a delimiter to a String_ or to the appropriate part of an Encapsed
node, creating an additional String_ part if necessary for it
root node as appropriate depending on the input nodes, and properly nest
Concat nodes into a root Concat node until all input nodes have been consumed
by helpers
With these changes additional tests are provided to validate the desired output
is generated for a number of cases, using the variable 'config' for reference
fixtures.