1.2.1423. Var Keyword¶
Var was used in PHP 4 to mark properties as public. Nowadays, new keywords are available : public, protected, private. Var is equivalent to public.
It is recommended to avoid using var, and explicitly use the new keywords.
<?php
class foo {
public $bar = 1;
// Avoid var
//var $bar = 1;
}
?>
See also Visibility.
1.2.1423.1. Connex PHP features¶
1.2.1423.1.1. Suggestions¶
It is recommended to avoid using var, and explicitly use the new keywords : private, protected, public
1.2.1423.1.2. Specs¶
Short name |
Classes/OldStyleVar |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
ClearPHP |
|
Examples |
|
Available in |