Skip to content
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

Disallow use function and use const #188

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Added
- Included `WordPress-Docs` by default in PHPCS #177
- Add ESLint rule for JSX boolean values #183
- Disallow `use function` and `use const` #188

### Updated
- Updated WPCS to 2.2.1 #151
Expand Down
3 changes: 3 additions & 0 deletions HM/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,7 @@
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
</rule>

<!-- Disallow usage of `use function`, while still allowing `use`ing os namespaces -->
<rule ref="Universal.UseStatements.DisallowUseFunction" />
<rule ref="Universal.UseStatements.DisallowUseConst" />
</ruleset>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
"description": "Human Made coding standards",
"type": "phpcodesniffer-standard",
"license": "GPL-2.0-or-later",
"minimum-stability": "dev",
"prefer-stable": true,
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes intentional? Neither of them will have any effect if the project isn't the root project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were, yes. phpcsextra is only released as alpha and it wouldn't install without adding these in: https://github.com/PHPCSStandards/PHPCSExtra/releases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we'll have to hold on releasing this then until phpcsextra is released, as the minimum-stability won't flow through, and would make the coding standards uninstallable as a dependency.

"require": {
"php": ">=7.1",
"wp-coding-standards/wpcs": "2.2.1",
"automattic/vipwpcs": "2.0.0",
"fig-r/psr2r-sniffer": "^0.5.0",
"phpcompatibility/phpcompatibility-wp": "^2.0.0",
"squizlabs/php_codesniffer": "~3.5.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.0"
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.0",
"phpcsstandards/phpcsextra": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
Expand Down