Open glen-84 opened 8 years ago
Issue confirmed under Eclipse Neon
I got around that by forcing my locally installed CodeSniffer:
/Applications/Eclipse.app/Contents/Eclipse/plugins/org.phpsrc.eclipse.pti.tools.codesniffer_1.3.0.R20111119000000/php/tools/phpcs.php
Change include line to the following:
include_once '/Users/youruser/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php';
After that I referenced PSR2 in the settings via this path:
/Users/youruser/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PSR2
Definitely, this plugin uses an old version of PHP_CodeSniffer : with eclipse Neon 4.3 and PDT 4.3, I got PHP_CodeSniffer 1.3, released in 2011... (latest release is 2.8.1, march 2017)
After trying many workarounds like installing PEAR manually, working aroung with "pti_phpcs.launch" file, etc. I was about to give up to get PSR2 support in eclipse, until I ended up on @binarious answer. His workaround actually still works! Thanks!
So here is another way (which I found less hacky) to update PHP_CodeSniffer support in eclipse with PTI (so it's working with PDT-ext):
/opt/.p2/pool/plugins/org.phpsrc.eclipse.pti.tools.codesniffer_1.3.0.R20111119000000/php/tools/phpcs.php
php
folder (parent of parent of 'phpcs.php') to your PHP_CodeSniffer installation path.
No need to edit the phpcs.php file since it is actually searching for a local installation of PHP_CodeSniffer inside the php
folder.
ln -s /opt/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer /opt/.p2/pool/plugins/org.phpsrc.eclipse.pti.tools.codesniffer_1.3.0.R20111119000000/php/
/opt/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PSR1
)Note: Installation methods of PHP_CodeSniffer. I used composer global installation, adapt your paths depending on your installation.
Edit: you could also consider using this fork.
Does this plug-in use an old version of PHP CodeSniffer?