我正在尝试使用PHP CodeSniffer + CakePHP Sniffer + Eclipse PHP工具集成
我安装了Eclipse插件,并在Eclipse上下载并安装了CakePHP CodeSniffer代码,如下图所示。
我选择print PHP output to console这样我就可以在尝试分析代码时看到并出错
PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff PSR2.Namespaces.NamespaceDeclaration does not exist' in /home/israel/.eclipse/org.eclipse.platform_4.3.0_1473617060_linux_gtk_x86_64/plugins/org.phpsrc.eclipse.pti.library.pear_1.2.2.R20120127000000/php/library/PEAR/PHP/CodeSniffer.php:814可能是什么问题呢?
另一方面,我希望能够在CakePHP约定之后格式化我的代码,在那里我可以找到与CakePHP代码约定匹配的fomatter profile 。
谢谢
I'm trying to use PHP CodeSniffer + CakePHP Sniffer + Eclipse PHP Tool Integration
I installed the Eclipse plugin as well as download and install the CakePHP CodeSniffer code on my Eclipse as you can see on the image below.
I select the print PHP output to console so I can see and error when it's trying to analyze my code
PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff PSR2.Namespaces.NamespaceDeclaration does not exist' in /home/israel/.eclipse/org.eclipse.platform_4.3.0_1473617060_linux_gtk_x86_64/plugins/org.phpsrc.eclipse.pti.library.pear_1.2.2.R20120127000000/php/library/PEAR/PHP/CodeSniffer.php:814What could be the problem?
In the other hand I want to be able to format my code following the CakePHP Conventions where can I found a fomatter profile that match with the CakePHP code conventions.
Thanks
最满意答案
我有几个问题试图安装CodeSniffer并使其正确运行Eclipse。
这是我为使其正常运行所遵循的步骤,您将在本文中找到有关如何配置, 如何Eclipse + CodeSniffer + CakePHP Sniff的详细说明。
转到Eclipse上的首选项菜单并导航到...
PHP -> PHP Executables -> Add...http://blog.zot24.com/content/images/2014/Feb/configuring_php_homebrew_in_eclipse.png
一旦我们在Eclipse上配置了PHP,我们就必须设置PEAR去...
PHP Tools -> Library -> PEAR -> New...并选择使用homebrew程序安装php55的path ,您可以运行此命令来了解php55的路径
brew --prefix php55然后在该命令的末尾添加
.../lib/PHPhttp://blog.zot24.com/content/images/2014/Feb/codesniffer_cakephp_eclipse_1.png
最后一步是选择我们刚刚配置的PEAR路径作为PHP CodeSniffer使用的默认库,如下图所示:
http://blog.zot24.com/content/images/2014/Feb/codesniffer_cakephp_eclipse_2.png
并做了! 只是享受清洁代码! :)
http://blog.zot24.com/content/images/2014/Feb/codesniffer_cakephp_eclipse_3.png
I had several problem trying to install CodeSniffer and make it run with Eclipse properly.
That was the steps I followed to made it run properly, you will find on this post detailed instructions about how to configure, How to Eclipse + CodeSniffer + CakePHP Sniff.
Go to the preferences menu on Eclipse and navigate to...
PHP -> PHP Executables -> Add...http://blog.zot24.com/content/images/2014/Feb/configuring_php_homebrew_in_eclipse.png
Once we have PHP configured on our Eclipse we have to setup PEAR go to...
PHP Tools -> Library -> PEAR -> New...And select the path where php55 was installed using homebrew, you can run this command to know the path of php55
brew --prefix php55Then just add at the end of that command
.../lib/PHPhttp://blog.zot24.com/content/images/2014/Feb/codesniffer_cakephp_eclipse_1.png
And the last step is select our just configured PEAR path a the default library used by our PHP CodeSniffer, as you can see on the imagen below:
http://blog.zot24.com/content/images/2014/Feb/codesniffer_cakephp_eclipse_2.png
And done! just enjoy a code clean! :)
http://blog.zot24.com/content/images/2014/Feb/codesniffer_cakephp_eclipse_3.png
更多推荐
发布评论