1.2.946. PHP Keywords As Names¶
PHP has a set of reserved keywords. It is recommended not to use those keywords for names structures.
PHP does check that a number of structures, such as classes, methods, interfaces… can’t be named or called using one of the keywords. However, in a few other situations, no check are enforced. Using keywords in such situation is confusing.
<?php
// This keyword is reserved since PHP 7.2
class object {
// _POST is used by PHP for the $_POST variable
// This methods name is probably confusing,
// and may attract more than its share of attention
function _POST() {
}
}
?>
Name |
Default |
Type |
Description |
reservedNames |
string |
Other reserved names : all in a string, comma separated. |
|
allowedNames |
string |
PHP reserved names that can be used in the code. All in a string, comma separated. |
See also List of Keywords, Predefined Classes, Predefined Constants, List of other reserved words and Predefined Variables.
1.2.946.1. Connex PHP features¶
1.2.946.1.1. Suggestions¶
Rename the structure
Choose another naming convention to avoid conflict and rename the current structures
1.2.946.1.2. Specs¶
Short name |
Php/ReservedNames |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Examples |
|
Available in |