kix/open-tag-fixer

A tool to automatically change PHP short-tag <?/<?= notation into valid <?php and <?php echo syntax

dev-master 2013-12-28 08:51 UTC

This package is auto-updated.

Last update: 2024-12-14 03:06:44 UTC


README

This tiny script is aimed at fixing the bad and ugly PHP short open tag syntax. It is based on PHP's tokenizer extension, so you'll have to install it first.

Please note, this is not a Regex replace implementation, this script will only match valid <?php open tags in valid PHP files.

Usage

Usage is pretty straightforward:

# bin/console should actually point to matching file from this repo
bin/console fix ./ # where ./ is the path

Also you can only fix <?'s and <?='s using -c and -e options respectively.

To do

Support nikic/php-parser when tokenizer is not available (is that possible?)

Fix issue that deletes whitespace after opening tags (e.g. newline after first opening tag in file)

Add pattern matching