symplify / php7_codesniffer
This package is abandoned and no longer maintained.
The author suggests using the symplify/easy-coding-standard package instead.
PHP7_CodeSniffer detects and fixes violations against your coding standard.
v0.6.1
2016-09-05 20:27 UTC
Requires
- php: ^7.0
- ext-simplexml: *
- ext-tokenizer: *
- nette/bootstrap: ^2.4
- nette/di: ^2.4
- nette/robot-loader: ^2.4
- nette/utils: ^2.4
- squizlabs/php_codesniffer: 3.0.x-dev as 2.6
- symfony/console: 3.2.x-dev as 3.1
- symfony/event-dispatcher: ^3.0
- symfony/finder: ^3.0
- symfony/options-resolver: ^3.0
Requires (Dev)
- phpunit/phpunit: ^5.4
- slevomat/coding-standard: ^1.0
- tracy/tracy: ^2.4
README
This is essential development tool that ensures your code remains clean and consistent.
Install
composer require symplify/php7_codesniffer --dev
Use
Run it from cli:
vendor/bin/php7cs src --standards=PSR2
To fix the issues just add --fix
:
vendor/bin/php7cs src --standards=PSR2 --fix
How to Use Specific Sniff Only?
vendor/bin/php7cs src --sniffs=PSR2.Classes.ClassDeclaration vendor/bin/php7cs src --sniffs=PSR2.Classes.ClassDeclaration,Zend.Files.ClosingTag
You can combine them as well:
vendor/bin/php7cs src --standards=PSR2 --sniffs=Zend.Files.ClosingTag
Or Use Standard WITHOUT One Sniff?
vendor/bin/php7cs src --standards=PSR2 --exclude-sniffs=PSR2.Namespaces.UseDeclaration
Testing
bin/php7cs src tests --standards=PSR2 vendor/bin/phpunit
Contributing
Rules are simple:
- new feature needs tests
- all tests must pass
- 1 feature per PR
I'd be happy to merge your feature then.