| 1 | <?php |
||
| 11 | class WPFilterRule implements Rule { |
||
| 12 | /** |
||
| 13 | * The id of the filter to apply |
||
| 14 | * |
||
| 15 | * @var string filter_name |
||
| 16 | */ |
||
| 17 | private $filter_name; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The value to be compared with the filter output |
||
| 21 | * |
||
| 22 | * @var string required_value |
||
| 23 | */ |
||
| 24 | private $required_value; |
||
| 25 | |||
| 26 | // phpcs:ignore Squiz.Commenting.FunctionComment.Missing |
||
| 27 | public function __construct( $filter_name, $required_value, $initial_value = false ) { |
||
| 32 | |||
| 33 | // phpcs:ignore Squiz.Commenting.FunctionComment.Missing |
||
| 34 | public function check( ...$args ) { |
||
| 46 | } |
||
| 47 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: