1 | <?php |
||
12 | class PreCommitConfig implements HookConfigInterface, HookConfigExtraToolInterface |
||
13 | { |
||
14 | const HOOK_NAME = 'pre-commit'; |
||
15 | /** @var ConfigFileReaderInterface */ |
||
16 | private $configFileReader; |
||
17 | |||
18 | /** |
||
19 | * PreCommitConfig constructor. |
||
20 | * |
||
21 | * @param ConfigFileReaderInterface $configFileReader |
||
22 | */ |
||
23 | 6 | public function __construct(ConfigFileReaderInterface $configFileReader) |
|
27 | |||
28 | /** |
||
29 | * @param $service |
||
30 | * |
||
31 | * @return bool |
||
32 | */ |
||
33 | 4 | public function isEnabled($service) |
|
43 | |||
44 | /** |
||
45 | * @return array |
||
46 | */ |
||
47 | 5 | private function getData() |
|
57 | |||
58 | /** |
||
59 | * @return array |
||
60 | */ |
||
61 | 1 | public function getMessages() |
|
62 | { |
||
63 | 1 | $data = $this->configFileReader->getFileContents(); |
|
64 | |||
65 | 1 | return $data[self::HOOK_NAME][MessageConfigData::TOOL]; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param array $tool |
||
70 | * |
||
71 | * @return array |
||
72 | */ |
||
73 | 1 | public function extraOptions($tool) |
|
79 | } |
||
80 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.