-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Improve Composer + PHPCS #2611
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
Improve Composer + PHPCS #2611
Conversation
Makes it easier to see that PHPCS actually ran.
The phpcodesniffer-composer-installer plugin recognises composer packages with the: `"type": "phpcodesniffer-standard"` value, and will automatically register the standard with PHP_CodeSniffer.
WordPress Coding Standards now supports PHP_CodeSniffer v3 (3.0.2+), and has it as one of the required dependencies, so no need to limit PHPCS to the 2.9 branch. `composer.lock` references PHPCS 3.0.2
This standard checks for PHP syntax that was only introduced in a version of PHP later than the desired minimum version. Assuming PHP 5.2 is the minimum version, as per WordPress core, the only error was a `__dir__` magic constant in the `phpunit/bootstrap.php` file.
Four spaces is what Composer uses itself when updating `composer.json`, so for constistency, it makes to enforce this when editing it manually as well.
aduth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to composer install from an existing installation resulted in an error for me:
[Symfony\Component\Process\Exception\ProcessFailedException]
The command "'/Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg/vendor/bin/phpcs' '--config-show' 'installed_paths'" failed.
Exit Code: 255(Unknown error)
Working directory: /Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg
Output:
================
Warning: require(/Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or
directory in /Users/andrew/Documents/Code/vvv/www/editor/htdocs/wp-content/plugins/gutenberg/vendor/composer/autoload_real.php on line 66
But after clearing out my vendor directory and trying again, it worked fine.
Looks good 👍
Wasn't caught 'til merge of #2611, since issue was introduced after original branch time
|
@GaryJones Why switch We explicitly changed it to use tabs in #1067 (comment) Edit: I didn't read the commit message "Four spaces is what Composer uses itself when updating |
|
Having more experience with We already allow the two-space in Lines 11 to 13 in a2756aa
|
See the individual commits for more detailed information.