Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
48 | protected function validateSchema() |
||
49 | { |
||
50 | // Validate |
||
51 | $validator = new \JsonSchema\Validator(); |
||
52 | $validator->validate( |
||
53 | $this->descriptor, |
||
54 | (object)['$ref' => 'file://' . realpath(dirname(__FILE__)).'/schemas/table-schema.json'] |
||
55 | ); |
||
56 | if (!$validator->isValid()) { |
||
57 | foreach ($validator->getErrors() as $error) { |
||
58 | $this->addError( |
||
59 | SchemaValidationError::SCHEMA_VIOLATION, |
||
60 | sprintf("[%s] %s", $error['property'], $error['message']) |
||
61 | ); |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 | } |
||
66 |
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: