【问题标题】:php-cs-fixer got broken for linux users after fixing the issue 6 for windows users在为 windows 用户修复问题 6 后,php-cs-fixer 为 linux 用户损坏
【发布时间】:2016-08-12 12:56:39
【问题描述】:

我使用 Linux Ubuntu 16.04。我已经为 atom 1.9.8 安装了 php-cs-fixer。

$ php-cs-fixer
PHP CS Fixer version 1.11.6 by Fabien Potencier

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  fix          Fixes a directory or a file
  help         Displays help for a command
  list         Lists commands
  readme       Generates the README content, based on the fix command help
  self-update  Update php-cs-fixer.phar to the latest version.
  selfupdate   Update php-cs-fixer.phar to the latest version.

问题来自于 php-cs-fixer with atom 的配置。实际上,包需要:

  • 一个 PHP 可执行路径(默认为 php)(对于 linux 用户,它必须为空,这在包的实际版本中是不可能的)(参见 isse #6
  • 一个 PHP-CS 修复程序可执行路径(仅适用于 linux 用户 php-cs-fixer(不使用 PHAR 文件)

因此,当我从 atom 运行 php-cs-fixer 时,出现以下错误:无法打开输入文件:php-cs-fixer

我可以使用此控制台命令生成此错误消息:

php php-cs-fixer fix Class.php 
    Could not open input file: php-cs-fixer

那么,您能否将 PHP Executable path 设为该 atom 包的可选(非强制性)???

谢谢,


关于这个问题的更新:

我设法从https://github.com/FriendsOfPHP/PHP-CS-Fixer 下载了php-cs-fixer.phar,并将其放在文件夹~/.composer/ 中,这样:

  • PHP 可执行文件路径为php
  • 一个 PHP-CS 修复程序可执行路径是:~/.composer/php-cs-composer.phar

但现在我收到此错误:无法打开输入文件:~/.composer/php-cs-fixer.phar

那怎么了??

供您参考,运行控制台php ~/.composer/php-cs-composer.phar Class.php命令成功。

【问题讨论】:

    标签: atom-editor


    【解决方案1】:

    解决方法在github上找到:

    • PHP 可执行文件路径为php
    • PHP-CS 修复程序可执行路径是:/home/username/.composer/php-cs-composer.phar,并且不要在 atom 中使用 ~

    【讨论】:

      猜你喜欢
      • 2019-06-14
      • 1970-01-01
      • 2018-02-28
      • 1970-01-01
      • 2018-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多