Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace G2R\Gitlab; |
||
35 | private static function objectValidation($data) |
||
36 | { |
||
37 | $data = json_decode($data); |
||
38 | |||
39 | if (!isset($data->object_kind)) { |
||
40 | throw new Exception('Object kind not found in the hook data'); |
||
41 | } |
||
42 | |||
43 | if (!in_array($data->object_kind, ['push', 'build'])) { |
||
44 | throw new Exception('Unknown Object kind from the hook'); |
||
45 | } |
||
46 | |||
47 | return $data; |
||
48 | } |
||
49 | } |
||
50 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: