| Total Complexity | 5 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | abstract class DefaultContext implements Context |
||
| 13 | { |
||
| 14 | protected $attributes = []; |
||
| 15 | |||
| 16 | protected $enableScalarAdapters = false; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Get an array of user defined attributes |
||
| 20 | * |
||
| 21 | * @return array |
||
| 22 | */ |
||
| 23 | public function getAttributes(): array |
||
| 24 | { |
||
| 25 | |||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Returns the attribute value for a given key or null if it's missing |
||
| 30 | * |
||
| 31 | * @param string $key |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | public function getAttribute(string $key) |
||
| 35 | { |
||
| 36 | |||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Add a custom attribute |
||
| 41 | * |
||
| 42 | * @param string $key |
||
| 43 | * @param $value |
||
| 44 | * @return DefaultContext |
||
| 45 | */ |
||
| 46 | public function addAttribute(string $key, $value): DefaultContext |
||
| 47 | { |
||
| 48 | |||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * If scalar values should get sent through the type adapter |
||
| 53 | * system or if they should just be read/written in place. |
||
| 54 | * |
||
| 55 | * @return bool |
||
| 56 | */ |
||
| 57 | public function enableScalarAdapters(): bool |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Defaults to true. Set to false if scalar values should be read/written |
||
| 64 | * through a type adapter. |
||
| 65 | * |
||
| 66 | * @param bool $enable |
||
| 67 | * @return mixed |
||
| 68 | */ |
||
| 69 | public function setEnableScalarAdapters(bool $enable) |
||
| 71 | |||
| 72 | } |
||
| 73 | } |
||
| 74 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: