Questions tagged [phpcs]

A component of Php Code Sniffer Package, phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.

Useful links:

203 questions
0
votes
1 answer

Is it possible to have different phpcs configuration values for different files?

I'm using PHP_CodeSniffer with PHPCompatibility and I'd like to have different configuration values for different files. For some files I want the following configuration: And for other files:
bfl
  • 403
  • 2
  • 8
0
votes
1 answer

Php Codesniffer Should ignore Capital letter and full stop

I'm implementing PHPCS for an existing project. I want to check if functions has a docblock. I'm currently using the following rules:
Taacoo
  • 277
  • 1
  • 3
  • 11
0
votes
0 answers

Include migration file in phpcs

I realize this goes against proper coding standards but I don't care. I want my migration files checked by PHPCS. I removed the following line from my phpcs.xml file. */migrations/* I then formatted the following…
Evan Lalo
  • 1,209
  • 1
  • 14
  • 34
0
votes
1 answer

Sanitizing the code as per wpcs for yoda condition checks

i am trying to cleanup the file with phpcs --standard=Wordpress ../filename.php . But it seems phpcbf is unable to perform the action. So, can anyone share some help as how can i manually fix these doc comment and yoda errors. Attached is related…
dignustech
  • 37
  • 5
0
votes
1 answer

How to check the parse or syntax error in Yii2 code Standard?

I have used this phpcs.xml.dist to check for code standard: Yii 2 Web Application Framework Coding Standard