Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question