Problem/Motivation
There are a number of places in core that call reset() or end() on an array in order to then call key(). Since PHP 7.3 we can use array_key_first() and array_key_last()
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3422539
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3422539-array-key-last
changes, plain diff MR !6688
Comments
Comment #3
mstrelan commentedComment #4
dpinice simple batch, replacing the
end()+key()combo is an especially good use ofarray_key_last().Looks like this is the output of Rector
\Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector, which signals to me the changes encompass all changes required in core.Comment #7
catchCommitted/pushed to 11.x and cherry-picked to 10.3.x, thanks!