简体   繁体   English

SublimeLinter-php或SublimeLinter-phplint

[英]SublimeLinter-php or SublimeLinter-phplint

I'm a new user of Sublime Text / Sublime Text 3 on OS X. 我是OS X上Sublime Text / Sublime Text 3的新用户。

I installed the plugin SublimeLinter. 我安装了插件SublimeLinter。 I also installed xampp on my local machine. 我还在本地机器上安装了xampp。

Which should I install next for the linter to work on PHP? 我应该在下一步安装哪个linter来处理PHP? SublimeLinter-php or SublimeLinter-phplint? SublimeLinter-php还是SublimeLinter-phplint? What's the difference of each plugin? 每个插件有什么区别?

不同之处在于它们使用的linter:SublimeLinter-php使用php -l ,SublimeLinter-phplint使用phplint

To supplement the answer from @idleberg above, the two linters are very different in the number and type of errors that they generate. 为了补充上面@idleberg的答案,这两个短语在它们产生的错误的数量和类型上是非常不同的。

We installed both, and ran them side-by-side for a month. 我们安装了两个,并将它们并排运行了一个月。 Our observations were as follows. 我们的观察如下。

  • SublimeLinter-php tagged only the errors that were genuinely problematic. SublimeLinter-php仅标记了真正有问题的错误。 We found the linter useful and have continued to use it. 我们发现这种棉绒很有用并且继续使用它。

  • SublimeLinter-phplint, by contrast, flagged numerous errors in every file, most of which did not affect the functioning of the file. 相比之下,SublimeLinter-phplint在每个文件中标记了许多错误,其中大多数错误不会影响文件的功能。 It seemed that SublimeLinter-phplint was either generating false positives or took a very prescriptive / academic perspective of php. 似乎SublimeLinter-phplint要么产生误报,要么采用了非常规范/学术的视角。 Advanced users may benefit from the comprehensive reporting in SublimeLinter-phplint, but less advanced users are likely to find the lints overwhelming and impractical. 高级用户可以从SublimeLinter-phplint中的综合报告中受益,但不太高级的用户可能会发现压倒性和不切实际的lint。

Here is an example. 这是一个例子。 The file phpmyadmin.config.inc.php comes from https://docs.phpmyadmin.net/en/latest/config.html and is installed by default if you run brew install phpmyadmin . phpmyadmin.config.inc.php文件来自https://docs.phpmyadmin.net/en/latest/config.html ,如果你运行brew install phpmyadmin ,默认brew install phpmyadmin

SublimeLinter-php finds no fault with the file, but SublimeLinter-phplint identifies four errors - as shown in the screenshot below. SublimeLinter-php发现文件没有错误,但SublimeLinter-phplint识别出四个错误 - 如下面的屏幕截图所示。

在此输入图像描述

Bottom line: If you are fairly new to coding, start with SublimeLinter-php - it's easy to use and practical. 结论:如果您对编码很陌生,请从SublimeLinter-php开始 - 它易于使用且实用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM