note 122954 deleted from language.types.array by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:23:59 +0000 |
| Subject: | note 122954 deleted from language.types.array by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210774@lists.php.net to get a copy of this message | ||
Note Submitter: ionut at eydos dot ro
----
FIX FOR PHP 7.2 UNDEFINED CONSTANT WARNING MESSAGE "Use of undefined constant ..."
Recursively clean up all files in a PHP project and automatically quote all strings which are
undefined constants used inside square brackets for the array syntax.
Observation: this fix only targets array usage like $foo[bar] which will be automatically
transformed into $foo['bar']. The clean up process DOES NOT parse and compute a list of
defined constants in your project, in order to white-list them for usage without quotes in all
possible contexts.
It's recommended to run it for your project on DEV first, check functionality and then push to
LIVE.
QUICK USAGE:
git clone https://github.com/eyroot/lx-utils
lx-utils
cd lx-utils && composer install --no-dev
php run/cleanUpSquareBrackets.php /path/you/want/to/clean/up
The complete usage instructions and source code are on the page:
https://github.com/eyroot/lx-utils