| 1 | <?php  | 
            ||
| 27 | class CheckPattern extends Check { | 
            ||
| 28 | |||
| 29 | protected $pattern;  | 
            ||
| 30 | |||
| 31 | /**  | 
            ||
| 32 | *  | 
            ||
| 33 | * @param type $id  | 
            ||
| 34 | * @param type $pattern Regex pattern without anchors (example: [a-z]+)  | 
            ||
| 35 | * @param type $message  | 
            ||
| 36 | */  | 
            ||
| 37 |     public function __construct($id, $pattern, $message = null) { | 
            ||
| 46 | |||
| 47 |     public function __invoke($value) { | 
            ||
| 50 | |||
| 51 | }  | 
            ||
| 52 | 
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: