I have a large collection of php files written over the years and I need to properly replace all the short open tags into proper explicit open tags.
change \
The problem has been solved as a fixer in the php-cs-fixer
tool which can be easily installed and which is tested and maintained.
Fixing then is easy:
$ php-cs-fixer fix --rules=full_opening_tag,no_short_echo_tag --diff --dry-run
Just replace
with the path to the directory or file you'd like to change. The command as given is to review first (--dry-run
and --diff
parameters).
Installing php-cs-fixer is as easy as
$ composer global require friendsofphp/php-cs-fixer
if you've got composer installed with global composer bin directory in your path (recommended).