Skip to content

dmytrotus/phpcs-extending

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

How to extend PHP code sniffer standards?

This implementation was tested and working perfectly on VsCode.

Before implementation

PHP coding standards need to be installed and working.

Change the settings in VsCode

Go to Code -> Preferences -> Settings -> [find: phpcs] -> Phpcs: Standard -> Edit in settings.json Click on that and change the line

"phpcs.standard": "PSR12" into "phpcs.standard": "~/phpcs-custom/DmytrosCustomCodeStyleStandard/ruleset.xml"

Create ruleset

Create a folder

touch ~/phpcs-custom/DmytrosCustomCodeStyleStandard/ruleset.xml

Inside the content of ruleset.xml copy ruleset.xml from root of this repo

Create sniffs

Ruleset already extends default PSR12 standards and has 2 additional sniffs

  • RequireReturnType
  • RequireArgumentType

These sniffs are inside sniffs folder.

Happy Codding.

About

How to extend PHP code sniffer standards?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages