- 
  Notifications
 
You must be signed in to change notification settings  - Fork 17
 
Throw an error if phpcsutils is not available #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Related to #160
@sirbrillig I see what you are trying to do here, but am not sure this is really necessary. Updating the installation instructions in the Readme should be sufficient, especially if that would include saying that stand-alone installation, while still possible, is no longer supported (only Composer install supported).
If you do want to get an error & fail fast, you could simplify this, by just adding <rule ref="PHPCSUtils"/> to the ruleset.
When PHPCS encounters that and PHPCSUtils is not installed, it should automatically throw an error, so no custom logic needed.
Oh and including the standard using a path to the ruleset <rule ref="./vendor/etc/VariableAnalysis/ruleset.xml"/> instead of by name <rule ref="VariableAnalysis"/> is also no longer supported then, but seriously, that functionality is buggy to begin with, so why anyone would ever use that.... 🙊
da7c099 to
 f61e31f  
 Compare
 
 Thanks for the hint. That's nicer really because it shows the error to the user rather than logging it in the PHP logs. It would be nice if there was a way to make it more explicit (even just "this is required by VariableAnalysis" or something) but that's fine. I've updated the branch and (finally) updated the README.
Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
As part of an effort to make sure that the dependencies are correctly installed, this adds
PHPCSUtilsas a dependency to the sniff. Without this change, it's possible to useVariableAnalysisfunctionally without phpcsutils until we hit a code path that needs it. In the interest of "fail fast" and giving a slightly more helpful error, this will fail immediately if the library is not there.This also updates the README to include installation instructions for PHPCSUtils.