Skip to content

Commit

Permalink
Merge pull request #177 from WPTRT/feature/173-add-phpcompatibility-wp
Browse files Browse the repository at this point in the history
Ruleset: add the PHPCompatibilityWP standard
  • Loading branch information
jrfnl authored Oct 8, 2018
2 parents d9f8687 + e737412 commit 787b28b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The WPThemeReview Standard requires:
* PHP 5.4 or higher.
* [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) version **3.3.0** or higher.
* [WordPress Coding Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) version **1.0.0** or higher.
* [PHPCompatibilityWP](https://github.com/PHPCompatibility/PHPCompatibilityWP) version **1.0.0** or higher.


## Installation
Expand Down Expand Up @@ -86,7 +87,7 @@ $ vendor/bin/phpcs -i

If everything went well, the output should look something like this:
```
The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra, WordPress-VIP and WPThemeReview
The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, PHPCompatibility, PHPCompatibilityWP, WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra, WordPress-VIP and WPThemeReview
```


Expand Down
4 changes: 4 additions & 0 deletions WPThemeReview/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<!-- Treat all files as UTF-8. -->
<config name="encoding" value="utf-8"/>

<!-- Themes should be compatible with PHP 5.2 and higher. -->
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibilityWP"/>

<!-- No PHP short open tags allowed. -->
<!-- Covers: https://github.com/Otto42/theme-check/blob/master/checks/phpshort.php -->
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"require" : {
"php" : ">=5.4",
"squizlabs/php_codesniffer": "^3.3.0",
"wp-coding-standards/wpcs" : "^1.0.0"
"wp-coding-standards/wpcs" : "^1.0.0",
"phpcompatibility/phpcompatibility-wp": "^1.0"
},
"require-dev": {
"phpunit/phpunit" : "^4.0 || ^5.0 || ^6.0 || ^7.0",
Expand All @@ -50,8 +51,8 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
},
"scripts" : {
"install-standards" : "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set installed_paths ../../..,../../wp-coding-standards/wpcs",
"install-standards-dev": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set installed_paths ../../..,../../wp-coding-standards/wpcs,../../phpcompatibility/php-compatibility",
"install-standards" : "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set installed_paths ../../..,../../wp-coding-standards/wpcs,../../phpcompatibility/phpcompatibility-wp",
"install-standards-dev": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set installed_paths ../../..,../../wp-coding-standards/wpcs,../../phpcompatibility/phpcompatibility-wp,../../phpcompatibility/php-compatibility",
"run-tests" : "@php ./vendor/phpunit/phpunit/phpunit --filter WPThemeReview ./vendor/squizlabs/php_codesniffer/tests/AllTests.php",
"phpcs-i" : "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs -i",
"check-cs" : "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
Expand Down

0 comments on commit 787b28b

Please sign in to comment.