Skip to content

kix/php-open-tag-fixer

Repository files navigation

PHP Open tag fixer

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

About

PHP Open tag fixer based on PHP tokenizer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages