G
G
German Zvonchuk2016-11-08 14:27:40
phpstorm
German Zvonchuk, 2016-11-08 14:27:40

How to automatically control the names of variables, keys and properties?

Good day, friends.
Our project has the following rules:
All variable names must be camelCase:
$oneTwoThree
$userId
$clientId
All key and property names must be underlined:
['hello_world']
['user_id']
['client_id']
->client_id
->user_id
All controller names must be CamelCase:
TestController
HelloworldController
The problem is that not all programmers follow these rules.
Is it possible to write a test in PhpStorm that will inspect the code and check variables and keys?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Novikov, 2016-11-22
@BOOMER_74

PhpStorm allows you to use additional code checking tools: PHP_CodeSniffer and PHPMD . They have the rules you need, but I'm not sure that they will cover all possible options. There is also PHP Coding Standards Fixer .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question