diff --git a/.travis.yml b/.travis.yml index 1626ca1..e8cd930 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,11 +40,11 @@ before_install: # Java, C, C++, C#, Objective-C, D, Pawn, Vala - brew install uncrustify # PHP - # - brew tap homebrew/homebrew-php - # - brew gist-logs php56 - # - brew install php56 - # - echo -e "\n[Phar]\nphar.readonly = Off\n" >> /usr/local/etc/php/5.6/php.ini - # - brew gist-logs php-cs-fixer - # - brew install php-cs-fixer + - brew tap homebrew/homebrew-php + - brew install php56 + - brew gist-logs php56 + - echo -e "\n[Phar]\nphar.readonly = Off\n" >> /usr/local/etc/php/5.6/php.ini + - brew install php-cs-fixer + - brew gist-logs php-cs-fixer # CoffeeScript - npm install coffee-formatter diff --git a/examples/simple-jsbeautifyrc/php/expected/test3.php b/examples/simple-jsbeautifyrc/php/expected/test3.php index 415310e..7efea69 100644 --- a/examples/simple-jsbeautifyrc/php/expected/test3.php +++ b/examples/simple-jsbeautifyrc/php/expected/test3.php @@ -1,13 +1,18 @@ beautifyCompleted = false completionFun = (text) -> - if text instanceof Error - return beautifyCompleted = text # text == Error + expect(text instanceof Error).not.toEqual(true, text) + # if text instanceof Error + # return beautifyCompleted = text # text == Error expect(typeof text).toEqual "string" # Check for beautification errors if text isnt expectedContents diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index bf3c93d..b1d66e4 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -150,7 +150,7 @@ module.exports = class Beautifier options = { env: env } - # console.log('spawn', exe, args) + console.log('spawn', exe, args) cmd = spawn(exe, args, options) # add a 'data' event listener for the spawn instance cmd.stdout.on('data', (data) -> stdout += data ) diff --git a/src/beautifiers/php-cs-fixer.coffee b/src/beautifiers/php-cs-fixer.coffee index b9d04d7..0ee7ff1 100644 --- a/src/beautifiers/php-cs-fixer.coffee +++ b/src/beautifiers/php-cs-fixer.coffee @@ -7,17 +7,19 @@ Beautifier = require('./beautifier') module.exports = class PHPCSFixer extends Beautifier name: "PHP-CS-Fixer" - + options: { PHP: true } beautify: (text, language, options) -> + console.log('php-cs-fixer', options) @run("php-cs-fixer", [ - "--level=#{options.level}" if options.level? - "--fixers=#{options.fixers}" if options.fixers? + "fix" + "--level=#{options.level}" if options.level + "--fixers=#{options.fixers}" if options.fixers tempFile = @tempFile("temp", text) - ]) + ], {ignoreReturnCode: true}) .then(=> @readFile(tempFile) )